Files
PlantAI-dev/.superpowers/sdd/task-2-verification.md
2026-08-03 18:42:47 +08:00

4.2 KiB
Executable File

Task 2 Independent Verification — Reference-bundle ID evidence schema

Verdict

PASS

Task 2 satisfies the accepted brief. Numeric NCBI GeneID is exposed as a separate ncbi_gene_id field/TSV column, the existing LOC-style gene_id semantics are unchanged, missing GeneID metadata produces an empty string, and the generated TSV remains readable as a tab-delimited table.

Baseline/current diff evidence

Commands run from /data/project_roots/PlantAI-dev:

diff -u /tmp/ppi-id-resolution-task2-baseline/pipeline_backend.py apps/web/pipeline_backend.py
diff -u /tmp/ppi-id-resolution-task2-baseline/test_pipeline_backend_execution_env.py tests/unit/test_pipeline_backend_execution_env.py

The expected diff exit status was 1 because differences exist. The complete production diff contains only four additions in the two allowed functions:

  • _fasta_header_index() adds the exact numeric parser re.search(r"\[db_xref=GeneID:(\d+)\]", header) and stores its capture in ncbi_gene_id, defaulting to "" when absent.
  • _build_reference_bundle_id_map() adds ncbi_gene_id to the TSV field list and fills it using the same CDS-first, PEP-fallback precedence as gene_id.
  • The pre-existing gene_id regex and row expression are byte-for-byte unchanged by the diff: cds.get("gene_id", "") or pep.get("gene_id", "").

The complete test diff contains only the csv import and one focused test, test_reference_bundle_id_map_preserves_loc_and_numeric_geneid. That test writes a CDS header containing both [gene=LOC110806180] and [db_xref=GeneID:110806180], reads the generated TSV with csv.DictReader(..., delimiter="\t"), and asserts the two values remain in separate columns.

CodeGraph inspection of the complete changed functions confirmed that the remaining FASTA indexing, ID union/sorting, presence flags, headers, overlap metrics, and return schema are unchanged. No PPI query, ortholog, frontend, canonical-ID, contract, manifest, or unrelated-stage code appears in either diff.

Fresh required verification

Focused reference-bundle/PPI suite

/home/xia-lab/miniconda3/envs/test4py311/bin/python -m pytest tests/unit/test_pipeline_backend_execution_env.py -k 'reference_bundle or ppi' -q

Exit code: 0

collected 31 items / 6 deselected / 25 selected
25 passed, 6 deselected in 1.67s

Syntax compilation

/home/xia-lab/miniconda3/envs/test4py311/bin/python -m py_compile apps/web/pipeline_backend.py tests/unit/test_pipeline_backend_execution_env.py

Exit code: 0; no output.

Independent TSV round-trip probe

I ran an additional temporary-file probe against the current _build_reference_bundle_id_map() implementation. It created two aligned PEP/CDS records: one containing LOC plus numeric GeneID metadata, and one legacy record containing LOC but no GeneID metadata. It then opened the emitted file with csv.DictReader(delimiter="\t") and asserted the exact header and values.

Exit code: 0

{"fieldnames": ["species_code", "protein_id", "pep_id", "cds_id", "gene_id", "ncbi_gene_id", "pep_present", "cds_present", "pep_header", "cds_header"], "missing": {"gene_id": "LOC0002", "ncbi_gene_id": ""}, "present": {"gene_id": "LOC0001", "ncbi_gene_id": "12345"}, "readable": true, "result_counts": {"cds_records": 2, "pep_cds_overlap": 2, "pep_records": 2}, "row_count": 2}

This directly verifies:

  • LOC gene_id remains unchanged (LOC0001/LOC0002).
  • Numeric GeneID occupies the separate ncbi_gene_id column (12345).
  • Missing GeneID is deterministic ("").
  • The generated TSV header and both data rows are readable.

Notes and residual scope

  • Pytest and the independent probe emitted the pre-existing RequestsDependencyWarning about installed urllib3 and character-detection dependency versions. It did not affect execution or assertions.
  • No manifest count was added, which is permitted by the brief.
  • This verification used focused unit and temporary parser/schema data, not a live reference-bundle download or backend API execution; the accepted Task 2 brief scopes required validation to these focused checks.
  • No production or test source file was edited during this verification.