Commit graph

3 commits

Author SHA1 Message Date
Shay
0ad97e5ef7
perf(tests): extract math_teaching_corpus lane from pytest into CI lane SHAs (-9m suite time) (#261)
* perf(tests): extract math_teaching_corpus lane from pytest into CI lane SHAs

The two slowest tests in the pytest suite were:

  388s test_adr_0131_2_teaching_corpus_lane::test_report_is_byte_equal_across_runs
  161s test_adr_0131_2_teaching_corpus_lane::test_lane_passes_exit_criterion

Both invoked build_report() from evals.math_teaching_corpus.v1.runner —
the canonical math-teaching-corpus lane runner — once for the exit
criterion and again for byte-equality. Together: 549s = 9m 9s, 30% of
the full pytest suite, recomputed on every developer run.

This is the exact 'lane runner invoked from pytest' anti-pattern that
the existing scripts/verify_lane_shas.py CI job is designed to absorb.
The other 7 lanes (reviewer_registry, miner_loop_closure, etc.) all
run in CI via SHA pinning rather than in pytest.

Changes:

  scripts/verify_lane_shas.py — add math_teaching_corpus_v1 spec +
    PINNED_SHAS entry (eaf160d145da29f9..., computed locally from
    a clean run of the lane in this commit's tree).
  scripts/generate_claims.py — add _LANE_ADR entry (ADR-0131) +
    claim text. Failing fast on missing lanes is by design.
  CLAIMS.md — regenerated; one new row.
  tests/test_adr_0131_2_teaching_corpus_lane.py — delete TestLaneGate
    class (2 tests, 549s). Retain TestDatasetIntegrity (5 tests),
    TestBoundedDomain (2), TestHonestEvidence (1) — these are
    fast (0.26s total) and pin contracts the lane runner does not
    cover (dataset shape, lemma boundedness, evidence reachability).
    Replace deletion with an explanatory comment block.

The deleted contracts are still enforced — just in CI instead of
pytest:

  exit criterion → runner exit code (returns 1 on failure)
  byte-equality  → PINNED_SHAS verification (SHA-256 of report.json)

Verified locally:

  scripts/verify_lane_shas.py — 8/8 lanes match pinned SHAs
  pytest tests/test_adr_0131_2_teaching_corpus_lane.py — 8/8 pass in 0.26s

Expected full-suite delta: -549s (from ~30m to ~21m). Further speedup
will come from the upcoming full-pytest CI gate with pytest-xdist -n4.

* ci: bump lane-shas timeout 12m → 20m for new math_teaching_corpus lane

The math_teaching_corpus_v1 lane added in this PR runs in ~5-6 min,
pushing the total lane-shas job over the previous 12-min timeout.
First CI run cancelled at 12m17s. Bumping to 20m gives ~8m headroom.

* fix(ci): bump lane subprocess timeout 300s→900s + add math_teaching_corpus to test_lane_sha_verifier EXPECTED_LANES

Two issues surfaced by CI run on the prior commit:

1. The math_teaching_corpus lane takes ~142s wall-clock locally (3.79
   cores × ~538s CPU). On CI's single/dual-core runner that translates
   to ~5-9 min, exceeding the 300s subprocess timeout in
   scripts/verify_lane_shas.py. Bumping to 900s gives ~60% headroom.

2. tests/test_lane_sha_verifier.py::TestExpectedLaneCoverage::test_all_expected_lanes_covered
   hardcodes the expected lane set. Adding math_teaching_corpus_v1 to
   LANE_SPECS triggered the 'extra lanes' assertion. Adding it to
   EXPECTED_LANES (the file's own contract: 'if intentional, add here').
2026-05-25 05:42:12 -07:00
Shay
5da8988a63 chore(tests): reconcile pre-existing main rot — 58 failures → 0
Tests on main had drifted from intentional substrate changes that
weren't propagated to their fixtures or pinned values. Categories:

1. PackMutationProposal missing source= arg (3 tests across
   test_mutation_proposal_type, test_provenance, test_expert_demo_runnable):
   add ProposalSource(kind="operator", source_id="", emitted_at_revision="test")
   to the shared fixture. test_expert_demo_runnable also retargets the
   "unpromoted domain" example from systems_software (now promoted) to
   arithmetic (real but unpromoted).

2. Pack content grew (test_en_core_meta_v1_pack 73→77 entries, 49→53 verbs;
   test_en_core_spatial_v1_pack 24→25 entries adding "places" plural surface):
   bump expected counts; allow new provenance shapes from the
   adr-0085-style-v2 review (including the seed:core_meta/seed:core_spatial
   author-time typos on two entries each — documented inline rather than
   masked).

3. Registry self-documenting "add names to the set" failures
   (test_lane_sha_verifier: add curriculum_loop_closure;
   test_register_runtime_threading: add gloss_aware_cause_surface,
   pack_grounded_unknown_surface, teaching_grounded_surface_transitive).

4. Gloss content was seeded where tests pinned None
   (test_pack_resolver_glosses TestMissingGlossesIsBackCompat): switch
   the no-glosses pack from en_core_relations_v1 (since glossed) to
   en_minimal_v1 (still gloss-free); narrow resolve_gloss probe to that
   pack so other packs' glosses can't shadow.

5. Entry-id renumber from cognition-pack expansion
   (test_language_pack_cache): en-core-cog-085 → en-core-cog-091.

6. Holdout tests fail without CORE_HOLDOUT_KEY or local plaintext
   (test_eval_holdout_split + test_transitive_surface): add
   _requires_holdout skip-marker mirroring _decrypt_holdout's contract;
   gate the transitive_surface holdout iteration on the same check.

7. Byte-identity surface guards regressed after the gloss-aware
   composer landed (test_realizer_guard_holdout, test_prompt_diversity_runner,
   test_register_substantive_consumption): re-pin to current surfaces
   ("Light is a visible medium that reveals truth." replaces "Light is a
   source of revelation that makes things knowable.", etc.). The guard's
   regression-catching role is preserved by pinning current output going
   forward; the new gloss-driven phrasings are visibly more grounded.

Touched 14 test files: 176 passed, 4 skipped (holdout-gated), 0 failed
on a targeted re-run. No production code touched.
2026-05-23 11:04:55 -07:00
Shay
a21d31a95c ci(lanes): pin ADR-0092..0099 lane SHAs and wire GitHub Actions verifier
Six lanes (reviewer_registry, miner_loop_closure,
domain_contract_validation, fabrication_control_summary,
demo_composition, public_demo) now have CI-enforced SHA-256 pins.
A failing job means a lane's deterministic output changed without
an explicit ADR-tracked pin update.

- new scripts/verify_lane_shas.py: single source of truth
  - PINNED_SHAS dict mapping lane_id → 64-char hex SHA
  - LANE_SPECS tuple wiring each lane to its runner module + canonical
    report path
  - accepts_report_flag handles the fabrication_control runner's
    different arg shape (--lane-dir not --report)
  - verify_all() runs each lane in subprocess isolation (clean Python
    state per lane — relevant for adapters that cache pack loads at
    module import)
  - --update flag refreshes pins after intentional ADR-tracked changes;
    diff is the audit trail
  - --json flag emits machine-readable report
  - exits non-zero on any mismatch

- new .github/workflows/lane-shas.yml:
  - triggers on push to main and pull_request to main
  - concurrency group cancels in-progress runs on new commits
  - Python 3.11 + pip-cached deps + editable install
  - runs verify_lane_shas.py; emits JSON report on failure
  - 12-minute timeout (lanes take ~30s in practice)

- new tests/test_lane_sha_verifier.py: cheap local-pytest pinning
  - every LaneSpec has a corresponding PINNED_SHAS entry
  - no orphan pins without a LaneSpec
  - every pin is a 64-char hex SHA-256
  - every runner module path exists on disk
  - canonical report paths are under repo root
  - all six expected lanes (ADR-0092/0093/0095/0096/0098/0099) covered;
    ADR-0094 and ADR-0097 are schema/ratification only, intentionally
    excluded from EXPECTED_LANES
  - 6 tests run in <100ms — catches drift before CI

- evals/public_demo/results/v1_dev.json: refreshed to match the new
  pin (21751aaf..) — earlier pin was generated under slightly different
  runner argparse defaults; --update produced the canonical bytes

Local verifier: 6/6 lanes match pinned SHAs. Smoke 67/67. Lane SHAs:
  reviewer_registry            681a2aab..
  miner_loop_closure           9f071733..
  domain_contract_validation   f9c06cde..
  fabrication_control_summary  01e1b6b7..
  demo_composition             27d83824..
  public_demo                  21751aaf..
2026-05-21 19:59:37 -07:00