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

9.3 KiB
Executable File

Task 3 authoritative re-verification

Verdict

PASS

Fresh post-correction verification found no remaining Critical, Important, or Minor Task 3 defect. The final implementation closes every finding from the prior verification, anti-pattern, and spec/code-quality reviews. Production and repository test source files were not edited during this re-verification; this report is the only repository file created.

Review basis and patch scope

Read in full before verification:

  • AGENTS.md.
  • PLAN.md and PLAN-REVIEW-LOG.md through Round 4 VERDICT: APPROVED.
  • Approved Task 3 in docs/superpowers/plans/2026-07-10-ppi-id-resolution.md.
  • .superpowers/sdd/task-3-brief.md.
  • Updated .superpowers/sdd/task-3-report.md.
  • Updated .superpowers/sdd/task-3-review-package.md.
  • Prior .superpowers/sdd/task-3-verification.md.
  • Prior .superpowers/sdd/task-3-antipattern.md.
  • Prior .superpowers/sdd/task-3-review.md.
  • .superpowers/sdd/progress.md.

The workspace has no functional Git repository (.git contains only an info/ directory), so the review-package baselines were used as required. Complete baseline/current diffs were inspected for:

/tmp/ppi-id-resolution-task3-baseline/run.py
  -> skills/ppi/run.py
/tmp/ppi-id-resolution-task3-baseline/pipeline_backend.py
  -> apps/web/pipeline_backend.py
/tmp/ppi-id-resolution-task3-baseline/test_ppi_string_policy.py
  -> tests/unit/test_ppi_string_policy.py

Complete-file inspection was performed for the new files gfa_core/string_rate_gate.py (116 lines) and tests/unit/test_ppi_id_resolution.py (978 lines). The diff remains confined to the Task 3 allowlist plus the explicitly authorized migration of one stale legacy-interface test in test_ppi_string_policy.py. That test still checks OSA normalization, resolution metrics, artifact creation, and selected STRING ID submission through the deterministic fake-client seam.

Fresh automated verification with sockets blocked

Before each pytest invocation, the verifier replaced all four connection/DNS entry points below with a function that raises AssertionError("live network blocked by Task 3 re-verifier"):

socket.socket.connect = blocked
socket.socket.connect_ex = blocked
socket.create_connection = blocked
socket.getaddrinfo = blocked

Thus any attempted live HTTP connection, including from forked rate-gate test processes, would fail the run.

Required focused Task 3 suite

/home/xia-lab/miniconda3/envs/test4py311/bin/python [socket-blocked pytest wrapper]
  tests/unit/test_ppi_id_resolution.py
  tests/unit/test_ppi_string_policy.py -q

collected 91 items
91 passed in 0.71s
exit 0

Relevant backend STRING image/PPI selection

/home/xia-lab/miniconda3/envs/test4py311/bin/python [socket-blocked pytest wrapper]
  tests/unit/test_pipeline_backend_execution_env.py
  -k 'string_network_image or ppi' -q

collected 31 items / 5 deselected / 26 selected
26 passed, 5 deselected in 5.76s
exit 0

Combined regression

/home/xia-lab/miniconda3/envs/test4py311/bin/python [socket-blocked pytest wrapper]
  tests/unit/test_id_resolution.py
  tests/unit/test_ppi_id_resolution.py
  tests/unit/test_ppi_string_policy.py
  tests/unit/test_pipeline_backend_execution_env.py -q

collected 134 items
134 passed in 7.13s
exit 0

All three runs emitted the pre-existing environment-level RequestsDependencyWarning for the installed urllib3/chardet versions. It did not affect collection or assertions.

Syntax compilation

/home/xia-lab/miniconda3/envs/test4py311/bin/python -m py_compile \
  gfa_core/string_rate_gate.py \
  skills/ppi/run.py \
  apps/web/pipeline_backend.py

exit 0; no output

Fresh direct/offline defect probes

A separate inline Python probe imported the unmodified production skills/ppi/run.py, blocked the same four socket/DNS entry points, used only temporary files and local fake STRING/HTTP clients, and exited 0. Its exact terminal summary was:

PASS mapping preferredName/stringId whitespace and type validation
PASS unknown species fail closed before HTTP; declared alias resolves
PASS stable URL authority allowlist and deceptive-address rejection
PASS mapping taxon types plus network taxon/finite score validation
PASS malformed HTTP status is typed protocol failure
PASS partial/all-missing/empty/comment-only Ortholog denominators; missing cases make no API call
PASS wrapper/subclass cannot select a legacy signature fail-open path
PASS production PpiSkill.run 24 relationships -> 12 selected STRING IDs (5 raw + 7 GeneID), 24 provenance rows
PASS rate gate rejects nonfinite interval/clock and fails closed on corrupt/read-error state
DIRECT_OFFLINE_PROBE_PASS all requested prior defects; sockets blocked

The probe established the following evidence independently of pytest:

  1. preferredName and stringId: missing, non-string, and whitespace-only values raised typed StringApiError(kind="protocol").
  2. Species identity: empty and unknown species raised before the fake HTTP client recorded any call; Spinacia oleracea resolved to taxon 3562.
  3. Stable URL authority: exact https://string-db.org and genuine *.string-db.org /api forms normalized successfully. HTTP, unrelated and deceptive suffix hosts, credentials, explicit ports, query/fragment data, unexpected/double-slash paths, empty-label pseudo-subdomains, and javascript: were rejected as typed protocol failures.
  4. Mapping taxon types: integer 3562 and digit string "3562" were accepted. Boolean, integer-valued/decimal floats, empty/mixed strings, and wrong taxon 3702 were rejected.
  5. Network rows: the selected taxon plus finite score 1.0 was accepted; missing/wrong taxon and negative, greater-than-one, NaN, and infinite scores were rejected as typed protocol failures.
  6. Malformed HTTP status: a response with status_code="not-an-integer" raised typed protocol failure rather than leaking ValueError.
  7. Ortholog denominators: the partial production run reported exactly input_member_count=2, relationship_count=1, resolved_member_count=1, and unresolved_member_count=1. All-missing, empty, and comment-only supplied Ortholog files each reported exactly 2/0/0/2, returned ID-resolution failure, and recorded zero mapping and zero network calls on their fake clients.
  8. No signature fail-open: a subclass overriding analyze_network(self, *args, **kwargs) still invoked deterministic resolution and submitted only 3562.PROT1. A static rg -n 'inspect\\.signature' skills/ppi/run.py scan returned no match.
  9. Rate gate: NaN and positive/negative infinity intervals were rejected; NaN and positive/negative infinity clock values raised StringRateGateError; NaN, infinity, nonnumeric, and empty existing timestamp files plus a non-missing directory/read error all failed closed.
  10. Production 24 -> 12 path: PpiSkill.run() consumed 24 canonical members and 24 exact relationships, retained 24 TSV data rows, deduplicated to 12 reference queries, resolved 5 by raw XP and 7 only by GeneID, and submitted exactly 12 selected STRING IDs. Metrics were 24 input / 24 relationships / 12 unique queries / 5 raw / 7 GeneID / 12 resolved queries / 12 selected IDs / 24 resolved / 0 unresolved / 0 ambiguous. A valid fake network -> [] produced success, network_status=empty_network, and the exact header-only protein1\tprotein2\tscore\n artifact.

Static closure of the prior findings

  • skills/ppi/run.py:100 resolves species with an empty fallback and rejects unsupported values; no active string_taxon_id(..., "3702") fallback or inspect.signature dispatch remains.
  • skills/ppi/run.py:107 validates stable address scheme, authoritative host, credentials, port, path, query, and fragment.
  • skills/ppi/run.py:231 validates queryIndex, echo, non-whitespace stringId/preferredName, and strict taxon type/value.
  • skills/ppi/run.py:314 validates network taxon and finite score in [0, 1].
  • skills/ppi/run.py:817 accepts the complete canonical member set for denominators; skills/ppi/run.py:1118 selects Ortholog mode from explicit mapping-file presence rather than mapping content truthiness.
  • gfa_core/string_rate_gate.py rejects non-finite interval/clock/timestamp state, distinguishes missing state from corrupt/read-failure state, retains the lock across wait/update, and atomically replaces the timestamp.
  • Scientific version/mapping/network requests call the shared gate at skills/ppi/run.py:157; every active optional image/SVG attempt calls it at apps/web/pipeline_backend.py:3245. Both use caller_identity=PlantAI.

Scope and residual validation

  • This verdict covers approved Task 3 only. Task 4 backend discovery/Reset identity and CLI wiring, Task 5 final manifest/contract/diagnosis/frontend closure, and Task 6 live STRING/full-real-job execution remain outside this checkpoint.
  • No live STRING request, backend service execution, Celery restart, or full real-job run was performed. Task 3 explicitly requires offline fake clients; the socket-blocked executions prove that this verification stayed offline.
  • No service or Celery restart was required for this read-only checkpoint, and no diagnosis record was updated because diagnosis is Task 5 scope.