Skip to content

Drop the wall-clock assert from the composed stage-scan test - #1629

Merged
MaxGhenis merged 1 commit into
mainfrom
nzhub/composed-scan-untimed
Nov 16, 2026
Merged

MaxGhenis merged 1 commit into
mainfrom
nzhub/composed-scan-untimed

Conversation

@MaxGhenis

Copy link
Copy Markdown
Contributor

test_precalibration_ancestry_composed_stage_scan_is_linear (packages/microcosm-build/tests/engine_free/shared/test_transport_composed_graph.py) already pins the composed pass's linear scan exactly: it counts json.JSONDecoder.raw_decode calls and expects zero offsets decoded. It also kept an elapsed < 1 wall-clock assert, which measured 2.13 s on a loaded engine-free 3.13 runner and failed #1611's CI, though the exact count passed. The docstring already says "the count is exact, not timed".

This removes the three timing lines. time stays imported, since other tests use it. Test-only, plus a changelog fragment.

🤖 Generated with Claude Code

test_precalibration_ancestry_composed_stage_scan_is_linear already pins
the linear scan exactly: it counts JSON decodes from an offset and
expects none. Its extra `elapsed < 1` assert measured 2.13 s on a loaded
engine-free 3.13 runner and failed a Belgian PR's CI, though the exact
count passed. The docstring already says the count is exact, not timed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
MaxGhenis added a commit that referenced this pull request Nov 15, 2026
…-2) (#1611)

Plan step PR 4a-2 of the Belgian transport port. Brussels article 25 §2(b) and Flemish article 8 §2 item 3 pay family benefits to a child in education up to 25; PR 4a defaulted both flags to false. This binds each flag, like Wallonia's and the German-speaking Community's, to a person_role predicate over fact:person.education_enrollment's six enrolled bands, in its scheme's eligibility module and in the regional routing bridge. The closure goes from 35 encoded and 242 defaulted roots to 39 and 238; a new test pins all four regions' post-18 flags to one enrolment predicate; the coverage and country-spec goldens are regenerated; the transport ADR now says encode runs Belgium's person_role bindings and defers only its 11 other group bindings.

A Subfleet hard-tier review (20261113-190022-be-pr4a2-review-sf, at 8890611) approved it with three P3 notes, two taken and one needing no change. The commit was rebuilt on #1602's later rounds (same eight names in 15 entries) and moved onto main with the same patch-id. CI on main: run 43751784209; engine-free (3.13) first failed on a wall-clock assert in a test this PR doesn't touch (2.13 s against 1 s; its exact-count assert passed; NZ removes the timer in #1629), and passed on rerun (attempt 2).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@vahid-ahmadi vahid-ahmadi left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The fix is right: Counted.offsets == 0 (packages/microcosm-build/tests/engine_free/shared/test_transport_composed_graph.py:7143) pins the linear scan exactly, so the timing added nothing.

Two more wall-clock asserts in the same file can flake the same way. These are test_precalibration_ancestry_inventory_scan_is_linear (:7064-7069) and test_precalibration_ancestry_inventory_scan_stops_at_32_layers (:7436-7448, including the 40,000-layer chain_40000 case). Both end with assert time.perf_counter() - started < 1. They assert outcomes too, but neither has an exact-count check like Counted, so the timing is their only check that the scan stays bounded. A loaded runner can push them over 1 s, as it did here (2.13 s). Main still has both asserts (:7069, :7451). If they flake, the same approach applies: count passes or raw_decode calls, as Counted does at :7082, instead of timing. Not a blocker for this PR.

Review drafted with AI assistance and checked against the code at 376e980.

@MaxGhenis
MaxGhenis marked this pull request as ready for review November 16, 2026 14:59
@MaxGhenis
MaxGhenis merged commit 5b2f45d into main Nov 16, 2026
12 checks passed
@MaxGhenis

Copy link
Copy Markdown
Contributor Author

Merge audit (NZ hub): squash-merged at reviewed head 376e980 as 5b2f45d.

  • Class: test-only (drops the wall-clock assert from test_precalibration_ancestry_composed_stage_scan_is_linear; keeps the exact Counted.offsets == 0 count) plus a changelog fragment.
  • Independent review: round 1 (Subfleet 20261115-150437-mc1629-r1) and round 2 (20261116-090952-mc1629-r2) each raised one P2 and no P0 or P1: the reviewer's environment couldn't run the mutation check (round 2 lacked pytest-xdist and microcosm_emitter_interface). Neither round found a defect, so the review finished at round 2.
  • Supporting evidence for the count: a probe on 11/15 found the old per-binding path makes Counted see 100/200/400 decode offsets and the layered path 0. A slowdown that never calls the JSON decoder would not be caught; the fragment scopes the test to that.
  • Gates at merge: gh pr checks 12/12 pass; MERGEABLE/CLEAN; --match-head-commit used. Shared-file OK from the Belgium lane at this head.

🤖 Generated with Claude Code

MaxGhenis added a commit that referenced this pull request Nov 16, 2026
Main gained #1619, #1621, #1609, #1540, #1629 and #1594 since 429d7a0.
Two files conflicted. docs/evidence/spec-engine/us-f0-coverage.json and
test_us_multispine_pool_tool.py took main's side, and the five-step US
spec-engine repin then regenerated them: spec_sha256 3fd1a384..., with
the field counts and pointer digests from tools/spec_engine_coverage.py.
The spec_sha256 comment keeps main's #1387 line and this PR's #922 line.

Checks: the three --check modes, ci_test_plan verify, ruff check and git
diff --check pass. Tests: county focused 751 (1 skip), pins 116 and
national 481, all passing.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
MaxGhenis added a commit that referenced this pull request Nov 16, 2026
Main brought nine first-parent merges since c4ad232: #1626 (Belgium gate
rows), #1628 (NZ B8 reference teen heads), #1621 (County Files household
measures sidecar and schema manifest tools), #1540 (L0 release practice
docs), #1609 (gate battery shared scopes), #1619 (ACS partnership_income
kept at zero where SEMP holds it, #1387), #1629 (untimed composed stage-scan
test), #1594 (withdraw a release build) and #1541 (Microcosm name sweep).
Main changed nothing under packages/microcosm-fit or packages/microcosm-graph.

Four pin files conflicted; each block took main's text plus this branch's
own comment lines, placed after main's #1387 sentence:
- docs/evidence/spec-engine/us-f0-coverage.json: five digest blocks, main's
  side (the branch has no comment there).
- packages/microcosm-build/src/microcosm/build/spec_engine/inventory_coverage.py:
  main's #1387 comment, then the branch's #1543 sentence, then the digests.
- packages/microcosm-build/tests/engine_free/shared/test_spec_engine_loader.py:
  main's #1387 comment, then the branch's fit-input-checks sentence, then the
  golden.
- packages/microcosm-build/tests/engine_workflow/us/test_us_multispine_pool_tool.py:
  main's #1387 comment, then the branch's #1543 line, then spec_sha256.
No code or test file conflicted, and no other file was changed by both sides.

The tools then wrote every value on the merged tree:
- tools/repin_us_spec_engine_contracts.py: EXPECTED_HASHES seed_map
  d5898b93 and seed_protocol 206be396, the loader golden b7c843a1 and the
  multispine pool spec_sha256 4062e22e (its first pass moved the coverage
  tool test's covered_item_count to 40; its second pass restored 41, so that
  file equals main's).
- tools/spec_engine_coverage.py: us-f0-coverage.json's eight digest lines
  (42395/42395 configuration fields; 41/41 inventory checks).
- fit.qrf/pins.json keeps the branch's values: the merged fit sources equal
  the branch's and the kernel's implementation hash reproduces, so
  tools/graph_parity_repin.py was not run.
The repinner's quote style was then reformatted with ruff format.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants