S4 — Retire the _validate replica: test the gate that exists, where it lives (C-03) #185
Description
Part of epic #181. Closes register C-03 (Tier 3).
Background
tests/test_validation.py opens with this:
"Note: views-pipeline-core may not be installed in test environments, so we replicate the validation logic here rather than importing the manager class. The logic tested matches unfao.py:_validate() exactly."
That claim is now false, and has been since #149.
The _validate that existed when the file was written null-gated the nine GAUL metadata columns. The _validate that exists today does not — its own docstring says so:
def _validate(self) -> None:
"""Assert the read produced what the save needs, then check coverage.
Neither payload is null-gated here. The historical artifact's metadata
null-gate fires at build time (``historical.assert_metadata_complete``);
...
"""It now asserts that _read resolved (_historical_frame is not None, _forecast_resolution is not None) and calls _check_coverage. The null gate moved to contract/historical.assert_metadata_complete during the frame-native migration.
So the test file:
- tests a gate that no longer lives where it says,
- asserts fidelity to a method it no longer resembles,
- hardcodes
REQUIRED_METADATA_COLSas a 9-element literal instead of importinggaul_schema.METADATA_COLS— the exact single-source-of-truth defect C-70 was resolved to prevent.
Point 3 already has a witness in the suite: tests/test_falsification_campaign_4_3.py:32 notes "The validation tests use a hardcoded REQUIRED_METADATA_COLS list that…". Someone saw it and moved on.
C-03's registered residual is exactly these two gaps: "the standalone _validate() replica and the missing enrich→validate end-to-end test." The first has since decayed from a duplication risk into an active falsehood.
Work
- Delete the replica's false claim and the duplicated column list. Import
METADATA_COLSfromviews_postprocessing.contract.gaul_schema. The list stops being a copy. - Re-point the null-gate tests at the module that owns the gate. The behaviour C-01 fixed (null validation, and the failure messages the CIC promises) is real and worth keeping — it just lives in
contract/historical.assert_metadata_completenow. Test it there, directly, with no replica: that module is dependency-light and imports fine without pipeline-core, so the original justification for replicating no longer applies either. - Correct the module docstring to say what the file now tests and where the gate lives.
- Close C-03's second residual — the missing enrich→validate end-to-end path — or state in the register why it stays open.
test_historical_parity.pyandtest_historical_builder.pymay already cover it end to end via the frame-native path; check before writing a new test. Do not add a redundant test to close an entry.
Acceptance criteria
- No hardcoded copy of the nine metadata column names anywhere in
tests/. - No test file claims to replicate a manager method.
- The null-gate behaviour is asserted against
historical.assert_metadata_complete, the module that performs it. _validate's current contract (both resolution assertions + the coverage call) has at least one test, or the register states why it does not.- C-03 is closed with the command that proves it, or its remaining scope is narrowed in writing.
Testing
ruff check .
pytest -q tests/test_validation.py tests/test_historical_builder.py tests/test_historical_parity.py
pytest -q
Sanity check that the replica is really gone:
grep -rn "REQUIRED_METADATA_COLS\|matches unfao.py" tests/
Dependencies
None.
Files
tests/test_validation.py— the replica and the false claimviews_postprocessing/unfao/managers/unfao.py:228-262—_validate/_check_coverageas they actually areviews_postprocessing/contract/historical.py—assert_metadata_complete, where the gate livesviews_postprocessing/contract/gaul_schema.py:48—METADATA_COLS, the declared contract (C-70)tests/test_falsification_campaign_4_3.py:32— the earlier witnessdocs/CICs/UNFAOPostProcessorManager.md— check it does not repeat the stale claim
Activity
test(validation): S4 #185 — retire the _validate replica; test the ga…
Polichinel commentedon Aug 2, 2026
Landed in #200. C-03 closed.
The old
tests/test_validation.pyran 43 parametrised cases against a function it defined itself — zero production code. Ifassert_metadata_completehad been deleted outright, every one would still have passed.Replaced by 14 tests of the real gate, parametrised over the imported
METADATA_COLS. The numbers are the argument:C-03's second residual is relocated to #18 by number. Every leg is covered — enrichment, artifact build, reader parity, invariants, wire e2e, null-gate. What remains is the manager orchestrating them, which needs a production-like Appwrite environment þing-02 D2 forbids.
Three discharged
assert Falseprobes retired, with dated notes. C-36 predicted this: "a fixed finding won't auto-flip — inherent to marker-style tests." One was a stated scope extension (abouttest_enrichment.py, not the replica) — verified false first, called out in the PR rather than buried.Review caught the story closing C-03 while the CIC still cited it as open next to a now-false "replica tests". Corrected.