Skip to content

Make Belgium's gate rows pass the transport gate registry - #1626

Merged
MaxGhenis merged 2 commits into
mainfrom
be/gate-rows-registry
Nov 16, 2026
Merged

MaxGhenis merged 2 commits into
mainfrom
be/gate-rows-registry

Conversation

@MaxGhenis

@MaxGhenis MaxGhenis commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

Ready. Round 1 of the Subfleet hard-tier review (20261115-142458-be-gate-rows-r1) approved 9fecb6e with two P2s and seven P3s; f575cd9 takes up all nine. Round 2 (20261115-180257-be-gate-rows-r2, a full review of c4ad232..f575cd9) approved with no findings and found all nine closed. The branch is rebased onto main at c4ad232 (#1611). CI at f575cd9: run 43772590109 passed all 12 jobs. The NZ hub OK'd the shared test_gate_battery.py hunk at 9fecb6e; its blob (sha256 429a4da1…) is unchanged.

Why

Five of Belgium's ten be/gates.json rows failed TRANSPORT_GATE_REGISTRY's validators (validate_gate_parameters and validate_required_gate_parameters).

  • Nothing ran them: Belgium has no transport graph yet, and only NZ's manifest goes through the validators in a test (test_transport_gate_bindings.py, TestNewZealandManifest).
  • PR 4b adds Belgium's graph. Its gates.battery@1 node runs validate_gate_parameters on the whole manifest (transport/gate_kernels.py:911 at e555b4d), so it would refuse on configuration before any gate ran.

PR 4a's second independent review (#1602) found the first two failing rows. Checking each row on its own turned up the other three, because each validator stops at its first refusal.

What changes

Row Was Now
calibration_per_family_fit within 0.1, min_family_share 0.8; lacked hard_within, min_hard_family_share, min_family_size Not applicable, awaiting d1902
commune_fiscal_income_fit report_worst_fit 25, which no binding routes; lacked default_rtol Not applicable until a commune fiscal income reference and a commune tolerance exist
demographics_vs_statbel surface: demography, which no binding routes families: [demography]; default_rtol 0.02 unchanged
nonnegative_columns no columns [household_weight, age], the source manifest's nonnegative_outputs
formula_owned_export no formula_owned_columns The 16 variables Belgium's Axiom bindings request

national_and_nuts1_admin_aggregates keeps its parameters; only its notes change (below).

Only the per-family row waits for d1902. BE-MC6 proposes three fit tolerances: each calibration target within 5%, demography within 2%, and administrative aggregates within 5%. All three sit in Max's parked decision d1902.

  • The per-family row goes not applicable. Its old values (10%, 80% of a family) matched no proposal, and the transport binding needs three keys it lacked, so writing it now would set new unruled values. NZ's fit row took this posture before its ruling (2fc0502), and Armenia's does today.
  • The two aggregate_admin rows keep the card's unruled 5% and 2%, which they already carried. That is deliberate. NZ (at 2fc0502) and Armenia made their aggregate rows not applicable as well, so this differs from both.
    • demographics_vs_statbel is Belgium's live fit grading while the per-family row waits: the 18 NUTS1 demography references are the only active ones.
    • national_and_nuts1_admin_aggregates grades nothing yet beyond those demography anchors, at 5%. It stays applicable so it binds as soon as a country-level reference activates. Until then it fails on any calibrated surface, because its country level selects no active reference.
  • The cost is the one the card warns of: if d1902 rules looser after a candidate exists, a gate would have to relax. So d1902 has to rule before the first calibrated Belgian candidate, and a ruling moves all three rows. The fit row's notes and the d1902 card say d1902 must rule first; both aggregate rows' notes say a ruling moves all three; the test keeps both aggregate rows applicable and ties their tolerances to the references'.

The per-family row's notes give the proposal in parameter form. NZ's ruled d1376 wrote its two tolerances as two per_family_fit rows, each with evidence_absent_blocks true: one at 5% over its calibration families, and demography_per_family_fit at 2%. Belgium's 2% already lives in demographics_vs_statbel, so on activation this row takes within = hard_within = 0.05, both family shares 1, min_family_size 1 and evidence_absent_blocks true. A demography per_family_fit row at 0.02, as NZ has, is the other option. NZ's rows also list their families, so a missing calibration family fails the row; without families, target_profile_coverage catches a missing family.

The commune row has nothing to select. Belgium's 60 target references sit at the country and NUTS1 levels only. The reference generator leaves commune fiscal income to a later commune spine gate, and no ruling sets a commune tolerance. report_worst_fit has no counterpart in the transport aggregate_admin binding (its keys are default_rtol, families and geography_levels). So the row's worst-25 intent moves into its notes, with an activation recipe.

surface is an artifact argument, not a parameter. _aggregate_admin takes the calibrated surface as its surface argument (transport/gate_bindings.py:634-636, bound to the surface artifact at :1954), and FunctionBinding.evaluate writes that artifact over any declared surface key (gate_battery.py:337-341). The validator refuses the unrouted key before any run (gate_kernels.py:911). Had the key been routable, the old row would have graded every anchor at 2%. Reading it as the demography family is an inference; families: [demography] makes it explicit.

formula_owned_columns is a lower bound. It lists every variable a binding in axiom_rules_bindings.json requests. That is the bindings' share of the composer's non-exportable scratch set, which also takes the money-normalize outputs it doesn't rewrite and the money-bridge and reporting.* outputs (transport/compose.py:1848-1873). NZ's real list comes from its export contract and carries one name beyond its bound outputs. Belgium's switches to its export contract at B4c.

Tests

  • New test_be_gate_manifest.py (six tests):
    • runs both validators on Belgium's manifest;
    • checks every applicable row's gate has a transport binding, with macro_realism_nbb named as the one exception (the validators skip unbound rows, so a dropped binding would otherwise pass unseen);
    • pins columns to the source manifest and formula_owned_columns to the bindings;
    • ties the fit row to the BE-MC6 references' method_card_status: it must take parameters when they stop being proposed_pending_d1902. The generator writes one status for every card row today, so ruling BE-MC6 alone needs per-row statuses there first;
    • keeps both aggregate_admin rows applicable, and pins demographics_vs_statbel's 0.02 to the demography references' fit_tolerance and the national row's 0.05 to the others'. The national pin ties BE-MC6's administrative-aggregate 5% to its per-target 5%; they coincide today, and a ruling that splits them changes the pin;
    • keeps the commune row not applicable only while no commune fiscal income reference exists.
  • TestBelgianCompatibility (test_gate_battery.py) now accepts not_applicable when its reason equals the row's declaration. The other gates must still be evidence_absent, shippable stays false and enforce still blocks.
  • be_country_spec.json moves only by resource_hashes["gates.json"] and the fingerprint.

Verification

At 00a5c09e4 (on e555b4d), with pytest one file at a time (-n 0):

  • test_be_gate_manifest.py: 6 passed.
  • test_gate_battery.py -k Belgian: passed.
  • test_country_spec.py (golden, Belgian and fingerprint tests): passed. The golden is regenerated from load_country_spec("be") and rendered with canonical_json_bytes, as the golden test renders it.
  • test_spec_source_citations.py, Belgian guards: passed.
  • ruff check and ruff format --check (0.15.16, the lockfile's version) pass.

The rebase onto c4ad232 changed nothing but two lines of be_country_spec.json: outside that file, both commits keep their patch-ids (git patch-id --stable). The golden is main's with the new gates.json hash and a fingerprint recomputed by trace.compute_composition_fingerprint's rule (sha256 of the sorted resource hashes, newline-joined). That rule reproduces 00a5c09e4's golden exactly. No pytest ran after the rebase (the host was under a disk write-stop); CI is the test run.

An independent check of the round-1 commit (executed mutants against every changed test, and a round-diff read of every finding and body claim) found nothing above P3. Its P3s are folded in.

At 9fecb6e, CI passed all 12 jobs (run 43752237313).

Shared file

test_gate_battery.py is shared. The NZ hub OK'd its one hunk at 9fecb6e (blob sha256 429a4da1…), after checking that a not-applicable outcome carries the row's declared reason (gate_battery.py:702-707). From now on, a shared PR that adds a required parameter to a gate Belgium binds also fails test_be_gate_manifest.py, as it already fails NZ's twin. That holds for applicable rows only: validate_required_gate_parameters skips not-applicable rows (transport/gate_bindings.py:2110-2112), so the parameter recipes in the fit and commune rows' notes can go stale without a test failing. A shared PR that adds a transport binding for macro_realism also fails the new bound-or-declared test, by design: macro_realism_nbb's bands then need checking against that binding's vocabulary.

Open PR #1609 (US hub) also edits test_gate_battery.py and the gate contract doc. The hunk here changes only the assertion inside TestBelgianCompatibility, so it applies by content. docs/gate-battery-contract.md still counts nine Belgian entries ("8 blocking + 1 diagnostic"); #1602 made it ten. I left that row for after #1609, which rewrites the same table.

Open items for PR 4b

  • The fit row's activation. A not-applicable row counts as shippable (gate_battery.py:439) and never blocks (:539-552). Until d1902 rules and the row takes parameters, it grades nothing.
  • What stops a candidate today. Only side effects:
    • macro_realism_nbb has no transport binding, so it resolves to absent evidence (gate_battery.py:709-714), which blocks a release candidate;
    • target_profile_coverage and national_and_nuts1_admin_aggregates fail on a demography-only calibration (next item).
  • Rows that fail on a demography-only calibration. Belgium's only active references are the 18 NUTS1 demography rows.
    • national_and_nuts1_admin_aggregates needs an active country-level target, and none is active yet.
    • target_profile_coverage requires five families (transport/gate_bindings.py:789-823), and only demography is active.
    • This matters only if 4b calibrates. 4b's scope names no calibration node, so that is an inference.
  • Weight rows. BE-MC6 also proposes the weight rows (ESS ≥ 3,000, max/median ≤ 5, cell screens). be/gates.json has none, and W3 owes them before the first calibrated candidate.
  • The battery node's inputs. Under nonnegative_columns, the node must set weight_entity to household and slice person age.

Belgium stays inactive.

🤖 Generated with Claude Code

MaxGhenis and others added 2 commits November 15, 2026 18:01
Five of Belgium's ten gate rows failed TRANSPORT_GATE_REGISTRY's
validators. Nothing ran them, because Belgium has no transport graph
yet, and only NZ's manifest is checked in a test. PR 4b's battery node
would refuse the manifest on configuration before any gate ran.

- calibration_per_family_fit lacked hard_within, min_hard_family_share
  and min_family_size. It is now not applicable, awaiting d1902, as
  NZ's fit rows were before their ruling: the method card's fit
  tolerances are proposed, not ruled. Its notes give the proposal as
  parameters.
- commune_fiscal_income_fit declared report_worst_fit, which no binding
  routes, and lacked default_rtol. Belgium has no commune-grain
  reference or commune tolerance, so it is not applicable, and the
  worst-25 intent moves into its notes.
- demographics_vs_statbel declared surface, which no binding routes. It
  now selects families [demography]; its 2% tolerance is unchanged.
- nonnegative_columns now lists the source manifest's non-negative
  outputs, household_weight and age.
- formula_owned_export now lists the 16 variables Belgium's Axiom
  bindings request, until an export contract lists the exclusions.

test_be_gate_manifest.py runs both validators on Belgium's manifest and
pins the column lists and the two not-applicable rows to their sources.
TestBelgianCompatibility now accepts a declared not-applicable row. The
country-spec golden moves only by the gates.json hash and fingerprint.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The Subfleet hard-tier review (20261115-142458-be-gate-rows-r1)
approved 9fecb6e with two P2s and seven P3s.

P2-1: only the per-family row waits for d1902, but the two
aggregate_admin rows carry BE-MC6's unruled 5% and 2%. They stay
applicable on purpose: demographics_vs_statbel is Belgium's live fit
grading while the per-family row waits, and the national row binds once
a country-level reference activates (until then it fails on its country
level). Both rows' notes now say so and that a d1902 ruling moves all
three rows. The test keeps both rows applicable and pins the national
row's default_rtol to the non-demography references' fit_tolerance, as
it already pins demography's.

P2-2: the d1902 tripwire read every reference's method_card_status,
which all card rows share, while the card lets d1902 rule row by row.
It now reads the BE-MC6 references' status and says the generator
writes one status for every row today.

P3s: the fit row's notes describe NZ's two d1376 rows and
evidence_absent_blocks correctly; the commune row's reason and test key
on commune fiscal income, not any commune reference; a Belgian twin of
NZ's bound-or-declared test catches a dropped binding, with
macro_realism_nbb named as the one unbound applicable row. The fit row's
notes also say NZ's rows list their families. The other P3s are PR-body
wording.

An independent check of this commit (executed mutants and a round-diff
read) found no P0 to P2; its P3s are folded in here: the tripwire
refuses an empty BE-MC6 set, the commune test's name says fiscal income,
and the national row's case is stated as above rather than as grading
it does not yet do.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@MaxGhenis
MaxGhenis force-pushed the be/gate-rows-registry branch from 9fecb6e to f575cd9 Compare November 15, 2026 23:02
@MaxGhenis
MaxGhenis marked this pull request as ready for review November 16, 2026 03:50
@MaxGhenis
MaxGhenis merged commit 361e2d9 into main Nov 16, 2026
12 checks passed
@MaxGhenis
MaxGhenis deleted the be/gate-rows-registry branch November 16, 2026 03:51
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>
MaxGhenis added a commit that referenced this pull request Nov 16, 2026
The BE column of the "Two postures, one executor" table in
docs/gate-battery-contract.md still counted nine entries, eight blocking
and one diagnostic. #1602 added release_input_coverage, so be/gates.json
declares ten: nine release-blocking and one diagnostic. #1626 made two of
them (calibration_per_family_fit and commune_fiscal_income_fit) not
applicable, which the entries row now says.

The review of the count fix noted that the incumbent-posture cell read as
if external oracles already replace self-parity. be/gates.json's policy
text leaves their implementation (EUROMOD-BE baselines and Federal
Planning Bureau reform scores) to microcosm#264, so the cell now says they
are planned there.

Review: Subfleet 20261116-091127-be-gate-contract-count-r1 approved
08b8548 with no in-scope finding.

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.

1 participant