Files
2026-08-03 18:42:47 +08:00

4.3 KiB
Executable File

Task 2 Anti-pattern Review

Verdict

PASS

The complete baseline/current diffs are surgical and implement only the approved local evidence-schema extension. No forbidden inference, identity mutation, downstream behavior change, or hidden I/O was introduced.

Critical findings

None.

Important findings

None.

Minor findings

None.

Material reviewed

  • AGENTS.md
  • PLAN.md
  • docs/superpowers/plans/2026-07-10-ppi-id-resolution.md, especially Task 2
  • .superpowers/sdd/task-2-brief.md
  • .superpowers/sdd/task-2-report.md
  • .superpowers/sdd/task-2-review-package.md
  • Exact production baseline/current pair from the review package
  • Exact test baseline/current pair from the review package
  • Indexed source/call-path context for _fasta_header_index() and _build_reference_bundle_id_map()

Production and test files were not edited during this review.

Exact baseline/current comparison

The production diff against /tmp/ppi-id-resolution-task2-baseline/pipeline_backend.py has four additions and no deletions:

  1. one exact db_xref=GeneID:<digits> regex match;
  2. one ncbi_gene_id FASTA-record field;
  3. one ncbi_gene_id TSV header field; and
  4. one CDS-first, PEP-fallback TSV row value.

The test diff against /tmp/ppi-id-resolution-task2-baseline/test_pipeline_backend_execution_env.py has only the csv import and the focused schema regression test described in the approved plan. No other production or test hunk differs.

Guard-by-guard review

  • No LOC replacement: the pre-existing gene_id extraction and TSV row expression are byte-for-byte unchanged. A header carrying both annotations produces gene_id=LOC110806180 and ncbi_gene_id=110806180.
  • No heuristic or fuzzy inference: the added regex accepts only the exact bracketed annotation form [db_xref=GeneID:<digits>]. It does not scan bare numbers, LOC suffixes, partial strings, alternate spellings, or sequence similarity. Near-miss annotations remained empty in the fresh audit.
  • No PPI, Ortholog, canonical-ID, or frontend behavior change: all production additions are confined to _fasta_header_index() and _build_reference_bundle_id_map(). There are no changes to PPI queries, Ortholog relationships, canonical member files, manifests, scheduling, frontend files, or stage policy.
  • No hidden network or external lookup: the new execution consists only of re.search, dictionary storage, and dict.get fallback. It adds no HTTP client, socket, subprocess, database, NCBI/UniProt call, or filesystem discovery path.
  • Deterministic missing values: a missing or non-exact numeric annotation becomes "" in the FASTA record and TSV. Selection is explicitly CDS value or PEP value or ""; existing sorted row order is unchanged. Two independent builds from the same audit inputs were byte-identical.
  • Stable legacy columns: every old header remains present in its original relative order, and removing the new column yields the exact baseline header list. All existing row expressions and meanings are unchanged. Repository consumers locate these values by named csv.DictReader columns; no positional consumer of pep_cds_idmap.tsv was found.
  • No LOC-by-LOC replacement or broad rewrite: the 286-byte production-size increase corresponds to the four additive lines above; no existing implementation block was replaced.

Fresh verification

/home/xia-lab/miniconda3/envs/test4py311/bin/python -m pytest \
  tests/unit/test_pipeline_backend_execution_env.py \
  -k 'reference_bundle or ppi' -q
25 passed, 6 deselected in 1.62s (exit 0)

/home/xia-lab/miniconda3/envs/test4py311/bin/python -m py_compile \
  apps/web/pipeline_backend.py
exit 0, no output

Read-only temporary-file audit:
- exact `[db_xref=GeneID:<digits>]` parsing: PASS
- near-miss/no-GeneID values remain empty: PASS
- CDS-first/PEP-fallback behavior: PASS
- LOC `gene_id` preservation: PASS
- legacy header subsequence and values: PASS
- repeated output byte determinism: PASS

Pytest/import startup emitted the already-reported environment-level RequestsDependencyWarning. It did not affect the checks and is unrelated to the Task 2 diff.

Scope note

This verdict covers Task 2 only. It does not approve later planned PPI/STRING, Ortholog wiring, Reset, manifest, contract, diagnosis, frontend, or real-data behavior changes.