From 307fa214fedd8ada12bcfe7b5d072795025fb3a1 Mon Sep 17 00:00:00 2001 From: Max Ghenis Date: Tue, 17 Nov 2026 13:17:33 -0500 Subject: [PATCH 1/8] Allow one feed cut on the split pin until the combined re-pin The county-pin guard accepted only the split pin 41b2fb2 or the county pin's own commit. The US feed owner now allows one named feed cut on the split pin, 60266a3 (41b2fb2 plus chronicle#430's five packages, for microcosm#880 through microcosm#1610). A second test retires the cut once both pins name one Chronicle commit. The doc says what a cut may be and dates the combined re-pin. Co-Authored-By: Claude Opus 5.5 --- .../us-feed-cut-on-split-pin.changed.md | 1 + docs/us-chronicle-feed-repin.md | 31 +++++++++--- .../us/test_us_chronicle_county_facts.py | 50 ++++++++++++++++--- 3 files changed, 69 insertions(+), 13 deletions(-) create mode 100644 changelog.d/us-feed-cut-on-split-pin.changed.md diff --git a/changelog.d/us-feed-cut-on-split-pin.changed.md b/changelog.d/us-feed-cut-on-split-pin.changed.md new file mode 100644 index 0000000000..4129812a80 --- /dev/null +++ b/changelog.d/us-feed-cut-on-split-pin.changed.md @@ -0,0 +1 @@ +The US county-pin guard allows one named main-feed cut on the split pin `41b2fb2` (today `60266a3`, for microcosm#880) until the combined re-pin moves both Chronicle pins to one commit. diff --git a/docs/us-chronicle-feed-repin.md b/docs/us-chronicle-feed-repin.md index 0f04cb794b..e14222c461 100644 --- a/docs/us-chronicle-feed-repin.md +++ b/docs/us-chronicle-feed-repin.md @@ -38,7 +38,8 @@ machine on 2026-11-13; the run notes are not in this repository. - **Commit.** Chronicle main `3e9d3a0694e8ca7e31ed5319c3ceb1bde92b12e0` (merged 2026-11-12), which carries every county package. It is on main, so - it needs no branch or tag; the next main re-pin starts at or after it. + it needs no branch or tag. The combined re-pin (below) moves both pins to + one Chronicle main commit at or after it. The rows are on the `chronicle.consumer_fact.v5` contract (schema digest `acd33a09…`); the main pin stays on v3. - **Pairs.** 10 (record set, period) pairs from nine packages, built at their @@ -105,11 +106,29 @@ machine on 2026-11-13; the run notes are not in this repository. A later main re-pin can fold these pairs into the main scope only by retiring the county pin in the same change. -The two pins move together. The main feed is pinned at `41b2fb2` and the -county facts at `3e9d3a0`; the next main re-pin starts at or after -`3e9d3a0`. From then on, a change that re-pins the main feed at a Chronicle -commit also rebuilds the county facts at that commit and re-pins them, so a -US build reads one Chronicle base. +The two pins move together. When the county facts were pinned at `3e9d3a0`, +the main feed was at `41b2fb2` (the split pin). Until the combined re-pin, the +main pin may also name one feed cut on the split pin that the US feed owner +allowed; `test_us_chronicle_county_facts.py` names it, and a later cut replaces +it. A cut is the split pin, or the cut before it, plus whole Chronicle packages +whose git trees equal Chronicle main's, built with `41b2fb2`'s Chronicle code +changed only in `SOURCE_PACKAGE_ALIASES`. Its re-pin report keeps every earlier +row byte for byte, or the cut brings its own reviewed check of the rows it +changes, and it changes no compiled state IRS SOI spec (cite the compile +delta). Only the county-facts rung reads both pins, and it reads only state +IRS SOI parents from the main feed, so such a cut leaves the rung's inputs +unchanged. Today the cut is `60266a3` (microcosm#880, through microcosm#1610). +Any other main re-pin starts at or after `3e9d3a0` and rebuilds and re-pins +the county facts at the same commit, so a US build reads one Chronicle base. + +The combined re-pin moves both pins to one Chronicle main commit at or after +chronicle#430's merge `b428468d`, rebuilds both feeds and retires the allowed +cut in the same change. It brings the 20 main-scope packages that differ +between `41b2fb2` and `3e9d3a0`, the v5 row contract, and a scope rebuild for +the ten pairs Chronicle main no longer emits (see the TY2023 state AGI bands +re-pin below), so it needs its own decisions. The US feed owner owns it and +starts it once the next certified build's commit is fixed; target merge +11 December 2026. ## A re-pin onto a newer row contract diff --git a/packages/microcosm-build/tests/engine_free/us/test_us_chronicle_county_facts.py b/packages/microcosm-build/tests/engine_free/us/test_us_chronicle_county_facts.py index 715846ac2a..b53c559374 100644 --- a/packages/microcosm-build/tests/engine_free/us/test_us_chronicle_county_facts.py +++ b/packages/microcosm-build/tests/engine_free/us/test_us_chronicle_county_facts.py @@ -129,21 +129,57 @@ def test_the_county_pin_is_not_the_main_pin() -> None: #: their own, at 3e9d3a0 (docs/us-chronicle-feed-repin.md). _MAIN_PIN_WHEN_THE_COUNTY_PIN_SPLIT = "41b2fb2b864a28c0eda03322b77a97ef147dfa3c" +#: The one feed cut on the split pin that the US feed owner allows until the +#: combined re-pin ("The two pins move together" in +#: docs/us-chronicle-feed-repin.md says what a cut may be). A later cut replaces +#: it, so the main pin cannot drift back to an older cut. 60266a3 is 41b2fb2 +#: plus chronicle#430's five packages, for microcosm#880 (microcosm#1610; +#: branch feed/us-41b2fb2-household-880, tag microcosm-us-feed-880-v1). +_FEED_CUT_ON_THE_SPLIT_PIN: str | None = "60266a3088319c909cf7fc89c9d00d3b055dc6e1" + def test_the_county_pin_moves_with_the_next_main_pin() -> None: """The two pins move together. The main feed may stay at the commit it - had when the county facts were pinned separately; once a change re-pins it - anywhere else, the same change re-pins the county facts to that commit, so - a US build reads one Chronicle base.""" + had when the county facts were pinned separately, or name the one allowed + feed cut on it; once a change re-pins it anywhere else, the same change + re-pins the county facts to that commit, so a US build reads one Chronicle + base.""" + + main = load_us_chronicle_feed() + county = load_us_chronicle_county_facts_pin() + allowed = {_MAIN_PIN_WHEN_THE_COUNTY_PIN_SPLIT, county.source_commit} + if _FEED_CUT_ON_THE_SPLIT_PIN is not None: + allowed.add(_FEED_CUT_ON_THE_SPLIT_PIN) + assert main.source_commit in allowed, ( + f"The main Chronicle feed pin moved to {main.source_commit}, which is " + "neither the split pin 41b2fb2 nor the allowed feed cut on it; re-pin " + "the county facts to the same commit in the same change." + ) + + +def test_the_combined_repin_retires_the_feed_cut() -> None: + """Once both pins name one Chronicle commit, no feed cut stays allowed.""" main = load_us_chronicle_feed() county = load_us_chronicle_county_facts_pin() - assert main.source_commit in ( + if main.source_commit == county.source_commit: + assert _FEED_CUT_ON_THE_SPLIT_PIN is None, ( + "Both pins name one Chronicle commit; set _FEED_CUT_ON_THE_SPLIT_PIN " + "to None in the same change." + ) + + +def test_the_feed_cut_is_a_full_commit_id_other_than_the_pins() -> None: + """The allowed cut is a full 40-character commit id, distinct from both pins.""" + + if _FEED_CUT_ON_THE_SPLIT_PIN is None: + return + county = load_us_chronicle_county_facts_pin() + assert len(_FEED_CUT_ON_THE_SPLIT_PIN) == 40 + assert set(_FEED_CUT_ON_THE_SPLIT_PIN) <= set("0123456789abcdef") + assert _FEED_CUT_ON_THE_SPLIT_PIN not in ( _MAIN_PIN_WHEN_THE_COUNTY_PIN_SPLIT, county.source_commit, - ), ( - f"The main Chronicle feed pin moved to {main.source_commit}; re-pin the " - "county facts to the same commit in the same change." ) From e71e6a570101a6a902c66b233bcb48b9ba51b82e Mon Sep 17 00:00:00 2001 From: Max Ghenis Date: Tue, 17 Nov 2026 13:53:23 -0500 Subject: [PATCH 2/8] Widen the feed-cut rule to every target the ACS local lane selects The lane reads state SNAP, state Medicaid enrollment, the state IRS SOI slice and the SSI age bands from the main feed, not only the county rung's SOI parents. A cut must leave all of those unchanged, shown by a compile on both feeds; for 60266a3 they are identical. Co-Authored-By: Claude Opus 5.5 --- docs/us-chronicle-feed-repin.md | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/docs/us-chronicle-feed-repin.md b/docs/us-chronicle-feed-repin.md index e14222c461..ea92623258 100644 --- a/docs/us-chronicle-feed-repin.md +++ b/docs/us-chronicle-feed-repin.md @@ -114,10 +114,17 @@ it. A cut is the split pin, or the cut before it, plus whole Chronicle packages whose git trees equal Chronicle main's, built with `41b2fb2`'s Chronicle code changed only in `SOURCE_PACKAGE_ALIASES`. Its re-pin report keeps every earlier row byte for byte, or the cut brings its own reviewed check of the rows it -changes, and it changes no compiled state IRS SOI spec (cite the compile -delta). Only the county-facts rung reads both pins, and it reads only state -IRS SOI parents from the main feed, so such a cut leaves the rung's inputs +changes, and it adds or changes no target that the ACS local lane selects +from the main feed (cite a compile of those selections on both feeds). The +lane is the only reader of both pins. Its county-facts rung takes state IRS SOI +parents from the main feed, and its calibration selects state SNAP, state +Medicaid enrollment, the state IRS SOI slice (with the state HT2 child tax +credit cells) and the SSI age bands from the same feed (`state_admin_surface` +and `acs_local_ssi_medicaid_take_up_targets` in +`tools/build_us_acs_local_release.py`). So such a cut leaves the lane's inputs unchanged. Today the cut is `60266a3` (microcosm#880, through microcosm#1610). +On it the lane selects the same 4,380 targets, SSI age bands and Medicaid +enrollment table as on `41b2fb2` (checked 17 November 2026 at main `5499382`). Any other main re-pin starts at or after `3e9d3a0` and rebuilds and re-pins the county facts at the same commit, so a US build reads one Chronicle base. From 3c848bdac1be9fdcce4932d0d5d59aad5453b034 Mon Sep 17 00:00:00 2001 From: Max Ghenis Date: Tue, 17 Nov 2026 21:16:50 -0500 Subject: [PATCH 3/8] Bar a feed cut from removing a lane-selected target (review r1) Review round 1 (P2): the cut admission rule in docs/us-chronicle-feed-repin.md forbade a cut from adding or changing a target the ACS local lane selects from the main feed, but not from removing one. The rule now says the cut adds, removes or changes no such target, and the operator cites a compile that gives identical selections on the cut and on the main feed it replaces. The paragraph also names who acts (microcosm#922 pinned the county facts; an operator builds a cut; the US feed owner allows 60266a3, the cut microcosm#1610 pins). Co-Authored-By: Claude Opus 5.5 --- docs/us-chronicle-feed-repin.md | 43 ++++++++++++++++++--------------- 1 file changed, 23 insertions(+), 20 deletions(-) diff --git a/docs/us-chronicle-feed-repin.md b/docs/us-chronicle-feed-repin.md index ea92623258..71b14f8e22 100644 --- a/docs/us-chronicle-feed-repin.md +++ b/docs/us-chronicle-feed-repin.md @@ -106,27 +106,30 @@ machine on 2026-11-13; the run notes are not in this repository. A later main re-pin can fold these pairs into the main scope only by retiring the county pin in the same change. -The two pins move together. When the county facts were pinned at `3e9d3a0`, -the main feed was at `41b2fb2` (the split pin). Until the combined re-pin, the -main pin may also name one feed cut on the split pin that the US feed owner -allowed; `test_us_chronicle_county_facts.py` names it, and a later cut replaces -it. A cut is the split pin, or the cut before it, plus whole Chronicle packages -whose git trees equal Chronicle main's, built with `41b2fb2`'s Chronicle code -changed only in `SOURCE_PACKAGE_ALIASES`. Its re-pin report keeps every earlier -row byte for byte, or the cut brings its own reviewed check of the rows it -changes, and it adds or changes no target that the ACS local lane selects -from the main feed (cite a compile of those selections on both feeds). The -lane is the only reader of both pins. Its county-facts rung takes state IRS SOI -parents from the main feed, and its calibration selects state SNAP, state -Medicaid enrollment, the state IRS SOI slice (with the state HT2 child tax -credit cells) and the SSI age bands from the same feed (`state_admin_surface` -and `acs_local_ssi_medicaid_take_up_targets` in +The two pins move together. When microcosm#922 pinned the county facts at +`3e9d3a0`, the main pin named `41b2fb2` (the split pin). Until the combined +re-pin, the main pin may also name one feed cut on the split pin that the US +feed owner allowed; `test_us_chronicle_county_facts.py` names it until the +owner allows a later cut in its place. An operator builds a cut from the split +pin, or the cut before it, plus whole Chronicle packages whose git trees equal +Chronicle main's, using `41b2fb2`'s Chronicle code with changes only to +`SOURCE_PACKAGE_ALIASES`. The cut's re-pin report keeps every earlier row byte +for byte, or the operator brings a reviewed check of the rows the cut changes. +Either way, the cut adds, removes or changes no target that the ACS local lane +selects from the main feed, and the operator cites a compile that gives +identical selections on the cut and on the main feed it replaces. Only the lane +reads both pins. Its county-facts rung takes state IRS SOI parents from the +main feed, and its calibration selects state SNAP, state Medicaid enrollment, +the state IRS SOI slice (with the state HT2 child tax credit cells) and the SSI +age bands from the same feed (`state_admin_surface` and +`acs_local_ssi_medicaid_take_up_targets` in `tools/build_us_acs_local_release.py`). So such a cut leaves the lane's inputs -unchanged. Today the cut is `60266a3` (microcosm#880, through microcosm#1610). -On it the lane selects the same 4,380 targets, SSI age bands and Medicaid -enrollment table as on `41b2fb2` (checked 17 November 2026 at main `5499382`). -Any other main re-pin starts at or after `3e9d3a0` and rebuilds and re-pins -the county facts at the same commit, so a US build reads one Chronicle base. +unchanged. Today the US feed owner allows `60266a3`, the cut that +microcosm#1610 pins for microcosm#880. On it the lane selects the same 4,380 +targets, SSI age bands and Medicaid enrollment table as on `41b2fb2`, in +compiles of both feeds at main `5499382` on 17 November 2026. Any other main +re-pin starts at or after `3e9d3a0` and rebuilds and re-pins the county facts +at the same commit, so a US build reads one Chronicle base. The combined re-pin moves both pins to one Chronicle main commit at or after chronicle#430's merge `b428468d`, rebuilds both feeds and retires the allowed From 74eed89ac25802835795053aca680bcbb3206692 Mon Sep 17 00:00:00 2001 From: Max Ghenis Date: Fri, 20 Nov 2026 00:30:49 +0000 Subject: [PATCH 4/8] End the split exceptions once the county pin moves (review r2) Review round 2 raised two P2s and two P3s. - P2, the guard could reopen the split after the combined re-pin. The guard now accepts the split pin 41b2fb2 and the allowed cut only while the county pin names 3e9d3a0 (_COUNTY_PIN_AT_THE_SPLIT). Once the county pin moves, the main pin must name the county pin's commit, and the retirement test requires the cut to hold None. test_the_split_exceptions_end_when_the_county_pin_moves feeds the three pin guards 13 pin states as data and checks which guards refuse each one. In a copy with the round-1 guard bodies, three of its cases fail, both of round 2's probes among them. - P2, the cut rule covered more SOI modes than its evidence. The doc's rule now asks for identical lane selections in every --soi-mode (state, totals, full, state_cd, state_county) and the same take-up output, from compiles of both feeds at the pinning change's head after its last merge of main. The doc labels the 4,380-target check state_county and says microcosm#1610 owes the comparison in every mode before it merges. - P3, what the county rung consumes. The doc names the county rung as the only build path that consumes both feeds and says what the rung checks on each. It adds that a cut meeting the rule leaves the lane's selected calibration inputs equal, while a build on the cut records the cut's feed digest in its run identity. - P3, "0 changed targets". The PR body now gives the scope of microcosm#1610's compile delta. The changelog fragment says when the exceptions end. Co-Authored-By: Claude Opus 5.5 --- .../us-feed-cut-on-split-pin.changed.md | 2 +- docs/us-chronicle-feed-repin.md | 76 ++++++--- .../us/test_us_chronicle_county_facts.py | 144 +++++++++++++++--- 3 files changed, 178 insertions(+), 44 deletions(-) diff --git a/changelog.d/us-feed-cut-on-split-pin.changed.md b/changelog.d/us-feed-cut-on-split-pin.changed.md index 4129812a80..175ee1343b 100644 --- a/changelog.d/us-feed-cut-on-split-pin.changed.md +++ b/changelog.d/us-feed-cut-on-split-pin.changed.md @@ -1 +1 @@ -The US county-pin guard allows one named main-feed cut on the split pin `41b2fb2` (today `60266a3`, for microcosm#880) until the combined re-pin moves both Chronicle pins to one commit. +The US county-pin guard allows one named main-feed cut on the split pin `41b2fb2` (today `60266a3`, for microcosm#880) while the county pin names `3e9d3a0`; once the county pin moves, the guard accepts only matching pins. diff --git a/docs/us-chronicle-feed-repin.md b/docs/us-chronicle-feed-repin.md index 71b14f8e22..9896a7b920 100644 --- a/docs/us-chronicle-feed-repin.md +++ b/docs/us-chronicle-feed-repin.md @@ -107,29 +107,61 @@ A later main re-pin can fold these pairs into the main scope only by retiring the county pin in the same change. The two pins move together. When microcosm#922 pinned the county facts at -`3e9d3a0`, the main pin named `41b2fb2` (the split pin). Until the combined -re-pin, the main pin may also name one feed cut on the split pin that the US -feed owner allowed; `test_us_chronicle_county_facts.py` names it until the -owner allows a later cut in its place. An operator builds a cut from the split -pin, or the cut before it, plus whole Chronicle packages whose git trees equal -Chronicle main's, using `41b2fb2`'s Chronicle code with changes only to -`SOURCE_PACKAGE_ALIASES`. The cut's re-pin report keeps every earlier row byte -for byte, or the operator brings a reviewed check of the rows the cut changes. -Either way, the cut adds, removes or changes no target that the ACS local lane -selects from the main feed, and the operator cites a compile that gives -identical selections on the cut and on the main feed it replaces. Only the lane -reads both pins. Its county-facts rung takes state IRS SOI parents from the -main feed, and its calibration selects state SNAP, state Medicaid enrollment, -the state IRS SOI slice (with the state HT2 child tax credit cells) and the SSI -age bands from the same feed (`state_admin_surface` and +`3e9d3a0`, the main pin named `41b2fb2` (the split pin). While the county pin +names `3e9d3a0`, the main pin may stay at the split pin or name one feed cut on +it that the US feed owner allowed; `test_us_chronicle_county_facts.py` names +that cut until the owner allows a later cut in its place. Once the county pin +moves, both exceptions end and the main pin names the county pin's commit. Any +other main re-pin starts at or after `3e9d3a0` and rebuilds and re-pins the +county facts at the same commit, so a US build reads one Chronicle base. + +An operator builds a cut from the split pin, or the cut before it, plus whole +Chronicle packages whose git trees equal Chronicle main's, using `41b2fb2`'s +Chronicle code with changes only to `SOURCE_PACKAGE_ALIASES`. The cut's re-pin +report keeps every earlier row byte for byte, or the operator brings a reviewed +check of the rows the cut changes. Either way, the cut adds, removes or changes +no target that the ACS local lane selects from the main feed, in any +`--soi-mode` the lane accepts: `state`, `totals`, `full`, `state_cd` and +`state_county`. The operator cites compiles of the cut and of the main feed it +replaces, both at one microcosm commit: the head of the change that pins the +cut, after its last merge of main. A later commit on that change that touches +no file under `tools/`, `packages/*/src` or `uv.lock` keeps the evidence. In +each mode, `state_admin_surface` with SNAP, Medicaid and SOI selects the same +targets from both feeds, equal in every `TargetSpec` field and in the same +order, with the same SOI receipt and substitution records. +`acs_local_ssi_medicaid_take_up_targets`, which takes no mode, returns the same +SSI age-band counts, Medicaid enrollment table and substitution records from +both. While `soi_surface_predicate` maps `state_county` to `state` and +`state_admin_surface` branches only on `state_cd`, those two modes select the +same main-feed targets, so one comparison covers both. + +The lane's county rung (`--soi-mode state_county`) is the only build path that +consumes both feeds. It loads the county facts the county pin names and checks +their digest, and it checks the main feed against the operator's +`--feed-sha256` (see Tool flags above). The country-spec loader reads both pin +declarations as package resources, but no feed rows. From the main feed, the +lane selects state SNAP, state Medicaid enrollment, the IRS SOI targets its +`--soi-mode` selects and the SSI age bands (`state_admin_surface` and `acs_local_ssi_medicaid_take_up_targets` in -`tools/build_us_acs_local_release.py`). So such a cut leaves the lane's inputs -unchanged. Today the US feed owner allows `60266a3`, the cut that -microcosm#1610 pins for microcosm#880. On it the lane selects the same 4,380 -targets, SSI age bands and Medicaid enrollment table as on `41b2fb2`, in -compiles of both feeds at main `5499382` on 17 November 2026. Any other main -re-pin starts at or after `3e9d3a0` and rebuilds and re-pins the county facts -at the same commit, so a US build reads one Chronicle base. +`tools/build_us_acs_local_release.py`). In `state` and `state_county` the SOI +targets are state targets, the state HT2 child tax credit cells among them; +`totals`, `full` and `state_cd` can also select congressional-district +targets. The county rung splits the selected state IRS SOI parents into county +targets using the county facts. So a cut that meets the rule leaves the lane's +selected calibration inputs equal. A build on the cut still records the cut's +feed digest in its run identity, so its receipts change. + +Today the US feed owner allows `60266a3`, the cut that microcosm#1610 pins for +microcosm#880, though its evidence is not yet complete. In `state_county` mode, +and so in `state`, the lane selects the same 4,380 targets on it as on +`41b2fb2` (102 SNAP, 51 Medicaid enrollment and 4,227 IRS SOI), with the same +SSI age bands and Medicaid enrollment table. Compiles of both feeds at main +`5499382` on 17 November 2026 showed this, before microcosm#1610's compiler +changes. No comparison has been run in `totals`, `full` or `state_cd`, and none +at microcosm#1610's head. Before it merges, microcosm#1610 owes the comparison +in every mode at the commit the rule above names. The change that runs the +comparison replaces this paragraph with the result and its evidence path. The +guard compares commit ids only, so it cannot check this evidence. The combined re-pin moves both pins to one Chronicle main commit at or after chronicle#430's merge `b428468d`, rebuilds both feeds and retires the allowed diff --git a/packages/microcosm-build/tests/engine_free/us/test_us_chronicle_county_facts.py b/packages/microcosm-build/tests/engine_free/us/test_us_chronicle_county_facts.py index b53c559374..143de61a95 100644 --- a/packages/microcosm-build/tests/engine_free/us/test_us_chronicle_county_facts.py +++ b/packages/microcosm-build/tests/engine_free/us/test_us_chronicle_county_facts.py @@ -129,43 +129,56 @@ def test_the_county_pin_is_not_the_main_pin() -> None: #: their own, at 3e9d3a0 (docs/us-chronicle-feed-repin.md). _MAIN_PIN_WHEN_THE_COUNTY_PIN_SPLIT = "41b2fb2b864a28c0eda03322b77a97ef147dfa3c" -#: The one feed cut on the split pin that the US feed owner allows until the -#: combined re-pin ("The two pins move together" in -#: docs/us-chronicle-feed-repin.md says what a cut may be). A later cut replaces -#: it, so the main pin cannot drift back to an older cut. 60266a3 is 41b2fb2 -#: plus chronicle#430's five packages, for microcosm#880 (microcosm#1610; -#: branch feed/us-41b2fb2-household-880, tag microcosm-us-feed-880-v1). +#: The county pin's own commit when it split from the main pin (microcosm#922). +#: Both exceptions below hold only while the county pin names this commit. +#: Once the county pin moves, the main pin names the county pin's commit. +_COUNTY_PIN_AT_THE_SPLIT = "3e9d3a0694e8ca7e31ed5319c3ceb1bde92b12e0" + +#: The one feed cut on the split pin that the US feed owner allows while the +#: county pin names 3e9d3a0 ("The two pins move together" in +#: docs/us-chronicle-feed-repin.md says what a cut may be and the evidence it +#: owes). A later cut replaces it, so the main pin cannot drift back to an older +#: cut. 60266a3 is 41b2fb2 plus chronicle#430's five packages, for microcosm#880 +#: (microcosm#1610; branch feed/us-41b2fb2-household-880, tag +#: microcosm-us-feed-880-v1). _FEED_CUT_ON_THE_SPLIT_PIN: str | None = "60266a3088319c909cf7fc89c9d00d3b055dc6e1" def test_the_county_pin_moves_with_the_next_main_pin() -> None: - """The two pins move together. The main feed may stay at the commit it - had when the county facts were pinned separately, or name the one allowed - feed cut on it; once a change re-pins it anywhere else, the same change - re-pins the county facts to that commit, so a US build reads one Chronicle - base.""" + """The two pins move together. While the county pin stays at its split + commit 3e9d3a0, the main feed may stay at the commit it had when the county + facts were pinned separately, or name the one allowed feed cut on it. Any + other main pin, and every main pin once the county pin moves, names the + county pin's commit, so a US build reads one Chronicle base.""" main = load_us_chronicle_feed() county = load_us_chronicle_county_facts_pin() - allowed = {_MAIN_PIN_WHEN_THE_COUNTY_PIN_SPLIT, county.source_commit} - if _FEED_CUT_ON_THE_SPLIT_PIN is not None: - allowed.add(_FEED_CUT_ON_THE_SPLIT_PIN) + allowed = {county.source_commit} + if county.source_commit == _COUNTY_PIN_AT_THE_SPLIT: + allowed.add(_MAIN_PIN_WHEN_THE_COUNTY_PIN_SPLIT) + if _FEED_CUT_ON_THE_SPLIT_PIN is not None: + allowed.add(_FEED_CUT_ON_THE_SPLIT_PIN) assert main.source_commit in allowed, ( - f"The main Chronicle feed pin moved to {main.source_commit}, which is " - "neither the split pin 41b2fb2 nor the allowed feed cut on it; re-pin " - "the county facts to the same commit in the same change." + f"The main Chronicle feed pin names {main.source_commit} and the county " + f"pin {county.source_commit}. Only while the county pin names 3e9d3a0 " + "may the main pin stay at the split pin 41b2fb2 or name the allowed feed " + "cut on it; otherwise re-pin both to one commit in the same change." ) def test_the_combined_repin_retires_the_feed_cut() -> None: - """Once both pins name one Chronicle commit, no feed cut stays allowed.""" + """Once both pins name one Chronicle commit, or the county pin leaves + 3e9d3a0, no feed cut stays allowed.""" main = load_us_chronicle_feed() county = load_us_chronicle_county_facts_pin() - if main.source_commit == county.source_commit: + if ( + main.source_commit == county.source_commit + or county.source_commit != _COUNTY_PIN_AT_THE_SPLIT + ): assert _FEED_CUT_ON_THE_SPLIT_PIN is None, ( - "Both pins name one Chronicle commit; set _FEED_CUT_ON_THE_SPLIT_PIN " - "to None in the same change." + "Both pins name one Chronicle commit or the county pin has left " + "3e9d3a0; set _FEED_CUT_ON_THE_SPLIT_PIN to None in the same change." ) @@ -183,6 +196,95 @@ def test_the_feed_cut_is_a_full_commit_id_other_than_the_pins() -> None: ) +_PIN_GUARDS = ( + test_the_county_pin_moves_with_the_next_main_pin, + test_the_combined_repin_retires_the_feed_cut, + test_the_feed_cut_is_a_full_commit_id_other_than_the_pins, +) + + +def _pin_guards_refusing(monkeypatch, *, main, county, cut) -> tuple[str, ...]: + """Run the three pin guards on these commits as data, without editing a pin, + and name the guards that refuse them, in ``_PIN_GUARDS`` order.""" + + main_pin = dataclasses.replace(load_us_chronicle_feed(), source_commit=main) + county_pin = dataclasses.replace( + load_us_chronicle_county_facts_pin(), source_commit=county + ) + namespace = globals() + monkeypatch.setitem(namespace, "load_us_chronicle_feed", lambda: main_pin) + monkeypatch.setitem( + namespace, "load_us_chronicle_county_facts_pin", lambda: county_pin + ) + monkeypatch.setitem(namespace, "_FEED_CUT_ON_THE_SPLIT_PIN", cut) + refusing = [] + for guard in _PIN_GUARDS: + try: + guard() + except AssertionError: + refusing.append(guard.__name__) + return tuple(refusing) + + +_MOVES = test_the_county_pin_moves_with_the_next_main_pin.__name__ +_RETIRES = test_the_combined_repin_retires_the_feed_cut.__name__ +_FULL_ID = test_the_feed_cut_is_a_full_commit_id_other_than_the_pins.__name__ +_SPLIT = _MAIN_PIN_WHEN_THE_COUNTY_PIN_SPLIT +_COUNTY = _COUNTY_PIN_AT_THE_SPLIT +#: A feed cut on the split pin (60266a3, the first allowed cut). +_CUT = "60266a3088319c909cf7fc89c9d00d3b055dc6e1" +#: A later Chronicle main commit: chronicle#430's merge b428468d, the earliest +#: commit the combined re-pin may name (docs/us-chronicle-feed-repin.md). +_LATER = "b428468dc8a1fad6d21fd4d703b822d5cb687e09" + + +@pytest.mark.parametrize( + ("main", "county", "cut", "refusing"), + [ + # While the county pin names 3e9d3a0. + (_SPLIT, _COUNTY, _CUT, ()), + (_CUT, _COUNTY, _CUT, ()), + (_SPLIT, _COUNTY, None, ()), + (_COUNTY, _COUNTY, None, ()), + (_CUT, _COUNTY, None, (_MOVES,)), + (_LATER, _COUNTY, _CUT, (_MOVES,)), + (_COUNTY, _COUNTY, _CUT, (_RETIRES,)), + (_SPLIT, _COUNTY, _SPLIT, (_FULL_ID,)), + # Once the combined re-pin has moved the county pin. + (_LATER, _LATER, None, ()), + (_LATER, _LATER, _CUT, (_RETIRES,)), + (_SPLIT, _LATER, None, (_MOVES,)), + (_SPLIT, _LATER, _CUT, (_MOVES, _RETIRES)), + (_CUT, _LATER, _CUT, (_MOVES, _RETIRES)), + ], + ids=[ + "split-pin", + "cut", + "split-pin-no-cut", + "both-at-3e9d3a0", + "cut-withdrawn", + "main-moves-alone", + "both-at-3e9d3a0-cut-kept", + "cut-names-the-split-pin", + "combined-repin", + "combined-repin-cut-kept", + "back-to-the-split-pin", + "back-to-the-split-pin-cut-kept", + "county-moves-alone-main-keeps-the-cut", + ], +) +def test_the_split_exceptions_end_when_the_county_pin_moves( + monkeypatch, main, county, cut, refusing +) -> None: + """Review r2 P2-1: the split pin and the cut stay allowed only while the + county pin names 3e9d3a0. Once the county pin moves, the main pin can + neither return to the split pin nor keep the cut. Each case names the + guards that refuse it, so it fails if any guard starts or stops refusing.""" + + refused_by = _pin_guards_refusing(monkeypatch, main=main, county=county, cut=cut) + assert refused_by == refusing + + def test_the_feed_builder_accepts_the_county_scope() -> None: scope = _builder().load_scope( _US_PACKAGE / US_CHRONICLE_COUNTY_FACTS_SCOPE_RESOURCE From 93a96d641c6b836bbb63d94c30870ffc5d59eb4b Mon Sep 17 00:00:00 2001 From: Max Ghenis Date: Fri, 20 Nov 2026 20:20:32 +0000 Subject: [PATCH 5/8] Run the cut's compiles on the merge tree (review r3) Review round 3 raised two P2s and two P3s. - P2, the evidence could test an older compiler than the one that merges. The operator now merges main into the pinning change, compiles both feeds at its new head and records that commit, both digests and how they built the compile environment. If main moves, or the change gains more than a record of the result, the operator compiles again, unless the change's reviewer finds no compile-input difference between the tested commit and the merge tree. That check now covers the workspace and package pyproject.toml files beside tools/, packages/*/src and uv.lock. GitHub does not refresh its test merge while a change conflicts with main, so the reviewer builds the merge tree from main's tip with git merge-tree just before the merge. The doc gives the commands. - P2, the regression missed a replacement cut and malformed cuts. test_a_later_cut_replaces_the_first sets a later allowed cut and checks that the guards accept a main pin at it and that the first guard refuses one at 60266a3. test_a_cut_that_is_not_a_full_id_other_than_the_pins_is_refused sets a short, a long, a non-hex, an upper-case and a county-commit cut, and only the full-id guard refuses each. The round-2 matrix gains a 14th state, a cut that names the commit both pins move to. Eight copies of the test file each carry one guard fault; in every copy the 13 round-2 cases pass and at least one new case fails. - P3, the county-pin introduction now says that giving the county facts their own pin left the main feed, its scope and the parity resources as they were, and that the county pin moves only with the main pin. The test module's docstring says the same. - P3, the full-id test's docstring limits the format to a cut that holds a commit id, and says the test also accepts None, which the combined re-pin requires. Co-Authored-By: Claude Fable 5.2 --- docs/us-chronicle-feed-repin.md | 53 ++++++++++++++---- .../us/test_us_chronicle_county_facts.py | 55 ++++++++++++++++++- 2 files changed, 93 insertions(+), 15 deletions(-) diff --git a/docs/us-chronicle-feed-repin.md b/docs/us-chronicle-feed-repin.md index 9896a7b920..547ea26ff7 100644 --- a/docs/us-chronicle-feed-repin.md +++ b/docs/us-chronicle-feed-repin.md @@ -21,8 +21,10 @@ PEP county population vintage 2024, and the ACS 2020-2024 5-year county tables B01003, B11001, B19001, B19013, B19025, B19051 and B19061. They have their own pin, `us/chronicle_county_facts.json`, with scope `us/chronicle_county_facts_scope.json` (scope name `us_county_facts`), beside -the main pin. No fiscal compile reads them, and the main feed, its scope and -the target-parity resources do not move when they do. +the main pin. No fiscal compile reads them. When microcosm#922 gave them their +own pin, the main feed, its scope and the target-parity resources stayed as +they were. From then on, the county pin moves only with the main pin (see the +joint re-pin rule, "The two pins move together", below). They are separate because of size. The ACS county rows keep both estimate and margin-of-error rows in one record set, about 5.2 KB per row, and the eight @@ -122,19 +124,46 @@ report keeps every earlier row byte for byte, or the operator brings a reviewed check of the rows the cut changes. Either way, the cut adds, removes or changes no target that the ACS local lane selects from the main feed, in any `--soi-mode` the lane accepts: `state`, `totals`, `full`, `state_cd` and -`state_county`. The operator cites compiles of the cut and of the main feed it -replaces, both at one microcosm commit: the head of the change that pins the -cut, after its last merge of main. A later commit on that change that touches -no file under `tools/`, `packages/*/src` or `uv.lock` keeps the evidence. In -each mode, `state_admin_surface` with SNAP, Medicaid and SOI selects the same -targets from both feeds, equal in every `TargetSpec` field and in the same -order, with the same SOI receipt and substitution records. +`state_county`. In each mode, `state_admin_surface` with SNAP, Medicaid and +SOI selects the same targets from both feeds, equal in every `TargetSpec` field +and in the same order, with the same SOI receipt and substitution records. `acs_local_ssi_medicaid_take_up_targets`, which takes no mode, returns the same SSI age-band counts, Medicaid enrollment table and substitution records from both. While `soi_surface_predicate` maps `state_county` to `state` and `state_admin_surface` branches only on `state_cd`, those two modes select the same main-feed targets, so one comparison covers both. +The operator compiles the cut and the main feed it replaces on the tree that +will merge (the merge tree). The operator first merges main into the change +that pins the cut, then compiles at the change's new head, the tested commit. +In the evidence, the operator records the tested commit and both feeds' +digests. The operator also records how they built the compile environment, for +example from the tested commit's `uv.lock`, and any package they swapped in by +hand. + +The operator compiles both feeds again if main moves after the compiles or the +change gains a commit beyond recording the result in the docs or the +changelog. The change's reviewer can skip that rerun on finding that the tested +commit and the merge tree share their compile inputs and dependency +configuration. The two match when no file differs under `tools/` or +`packages/*/src`, or in `uv.lock`, the workspace `pyproject.toml` or any +package's `pyproject.toml`. GitHub does not refresh its test merge, +`refs/pull//merge`, while the change conflicts with main. So just +before the merge, the reviewer builds the merge tree from main's tip and runs +the check: + +```bash +git fetch origin main +git merge-tree --write-tree origin/main +git diff --stat -- tools uv.lock pyproject.toml 'packages/*/src/**' 'packages/*/pyproject.toml' +``` + +`git merge-tree` prints the merge tree's id on its first line, and exits with +status 1 if the change conflicts with main. The `git diff` prints nothing when +the two match. Keep the trailing `/**`: without it, git's `packages/*/src` +pathspec matches no file, so the command misses every change under +`packages/*/src`. + The lane's county rung (`--soi-mode state_county`) is the only build path that consumes both feeds. It loads the county facts the county pin names and checks their digest, and it checks the main feed against the operator's @@ -157,9 +186,9 @@ and so in `state`, the lane selects the same 4,380 targets on it as on `41b2fb2` (102 SNAP, 51 Medicaid enrollment and 4,227 IRS SOI), with the same SSI age bands and Medicaid enrollment table. Compiles of both feeds at main `5499382` on 17 November 2026 showed this, before microcosm#1610's compiler -changes. No comparison has been run in `totals`, `full` or `state_cd`, and none -at microcosm#1610's head. Before it merges, microcosm#1610 owes the comparison -in every mode at the commit the rule above names. The change that runs the +changes. No run yet covers `totals`, `full` or `state_cd`, or any mode at +microcosm#1610's head. Before it merges, microcosm#1610 owes the comparison in +every mode, on the merge tree the rule above names. The change that runs the comparison replaces this paragraph with the result and its evidence path. The guard compares commit ids only, so it cannot check this evidence. diff --git a/packages/microcosm-build/tests/engine_free/us/test_us_chronicle_county_facts.py b/packages/microcosm-build/tests/engine_free/us/test_us_chronicle_county_facts.py index 143de61a95..96cca84f98 100644 --- a/packages/microcosm-build/tests/engine_free/us/test_us_chronicle_county_facts.py +++ b/packages/microcosm-build/tests/engine_free/us/test_us_chronicle_county_facts.py @@ -1,7 +1,8 @@ """The US county facts pin and its loader (microcosm#922). -The county facts sit in their own pin beside the main US feed pin, so the main -feed, its scope and the parity resources do not move when county facts do. +The county facts sit in their own pin beside the main US feed pin. Giving them +their own pin left the main feed, its scope and the parity resources as they +were; the pin guards below refuse a county pin that moves without the main pin. """ from __future__ import annotations @@ -183,7 +184,9 @@ def test_the_combined_repin_retires_the_feed_cut() -> None: def test_the_feed_cut_is_a_full_commit_id_other_than_the_pins() -> None: - """The allowed cut is a full 40-character commit id, distinct from both pins.""" + """When set, the allowed cut is a full commit id of 40 lowercase hex + characters, distinct from both pins. ``None`` is valid too, and the combined + re-pin requires it.""" if _FEED_CUT_ON_THE_SPLIT_PIN is None: return @@ -256,6 +259,7 @@ def _pin_guards_refusing(monkeypatch, *, main, county, cut) -> tuple[str, ...]: (_SPLIT, _LATER, None, (_MOVES,)), (_SPLIT, _LATER, _CUT, (_MOVES, _RETIRES)), (_CUT, _LATER, _CUT, (_MOVES, _RETIRES)), + (_LATER, _LATER, _LATER, (_RETIRES, _FULL_ID)), ], ids=[ "split-pin", @@ -271,6 +275,7 @@ def _pin_guards_refusing(monkeypatch, *, main, county, cut) -> tuple[str, ...]: "back-to-the-split-pin", "back-to-the-split-pin-cut-kept", "county-moves-alone-main-keeps-the-cut", + "combined-repin-cut-names-the-new-pin", ], ) def test_the_split_exceptions_end_when_the_county_pin_moves( @@ -285,6 +290,50 @@ def test_the_split_exceptions_end_when_the_county_pin_moves( assert refused_by == refusing +#: A later feed cut on the split pin, as a made-up full commit id. When the US +#: feed owner allows one, it takes 60266a3's place. +_NEXT_CUT = "0f" * 20 + + +@pytest.mark.parametrize( + ("main", "refusing"), + [(_NEXT_CUT, ()), (_CUT, (_MOVES,))], + ids=["next-cut", "first-cut-after-the-next-cut"], +) +def test_a_later_cut_replaces_the_first(monkeypatch, main, refusing) -> None: + """Review r3 P2-2: once the allowance names a later cut, the main pin may + name that cut and can no longer name 60266a3.""" + + refused_by = _pin_guards_refusing( + monkeypatch, main=main, county=_COUNTY, cut=_NEXT_CUT + ) + assert refused_by == refusing + + +@pytest.mark.parametrize( + "cut", + [_CUT[:7], _CUT + "0", _CUT[:39] + "g", _CUT.upper(), _COUNTY], + ids=[ + "short-cut", + "long-cut", + "non-hex-cut", + "upper-case-cut", + "cut-names-the-county-commit", + ], +) +def test_a_cut_that_is_not_a_full_id_other_than_the_pins_is_refused( + monkeypatch, cut +) -> None: + """Review r3 P2-2: the full-id guard alone refuses each of these cuts. A + 7- or 41-character id fails the length check, a 'g' or upper-case letters + fail the lowercase-hex check, and the county commit fails the distinct-id + check. The main pin stays at the split pin, which every other guard + accepts.""" + + refused_by = _pin_guards_refusing(monkeypatch, main=_SPLIT, county=_COUNTY, cut=cut) + assert refused_by == (_FULL_ID,) + + def test_the_feed_builder_accepts_the_county_scope() -> None: scope = _builder().load_scope( _US_PACKAGE / US_CHRONICLE_COUNTY_FACTS_SCOPE_RESOURCE From fcdcd1fe2ae2409a5a0a0d898e4959da2ed8bc24 Mon Sep 17 00:00:00 2001 From: Max Ghenis Date: Sat, 21 Nov 2026 13:38:34 +0100 Subject: [PATCH 6/8] Tighten the merge-tree check and the cut guard (review r4) Review round 4 raised five P2s and one P3. This commit answers the four P2s that concern its files. The fifth asks to confirm #1610's follow-up outside this PR, and the P3's attribution fix goes in the PR body. - P2, the reviewer's check could clear a rerun it should not. From packages/microcosm-build, the documented git diff printed nothing, though from the root it listed 101 files. The reviewer now fetches the change's head and main, naming origin/main as main's destination, and stops if the fetch fails. They write both commits as full shas, the head's from gh pr view, and go on only if git merge-tree exits 0. They run git diff with :(top) paths and --exit-code, take only exit 0 with no output as a match, and check again if either sha moves before the merge. - P2 (inferred), the evidence could describe another environment. The operator runs both compiles from one clean checkout of the tested commit, in the environment that uv sync --all-packages --locked --extra us builds. In a receipt, the operator records the interpreter, the imported packages' versions, the runner's and comparator's sha256, both feed digests, where the compile imported the lane's tool and each workspace and overridden package from, and git status --porcelain, and lists each departure. The reviewer checks the digests against the two pins, checks that git status printed nothing, and checks each import path against the checkout and the departures. A commit that records the result changes only the changelog and the doc's paragraph on the allowed cut, and reports a result from the runner, comparator and inputs the receipt names. - P2, a non-string cut passed all three guards. The full-id guard now requires a str before its length and character checks, and the malformed cases gain a tuple of the cut's characters and the cut's bytes. - P2, the pin-state matrix let two weaker county-pin guards pass. It gains a main pin that matches the cut in all but its last character, and main and county pins at two different later commits with no cut. The county-pin guard alone refuses each. Four copies of the test file each carry one fault: county-pin guards that compare seven- or ten-character prefixes, a county-pin guard that accepts any main pin but 41b2fb2 once the county pin moves and the cut holds None, and a full-id guard without the str check. On the engine-free harness, each copy fails one new case and passes the other 24 pin-state cases. Co-Authored-By: Claude Opus 5.5 --- docs/us-chronicle-feed-repin.md | 83 +++++++++++++------ .../us/test_us_chronicle_county_facts.py | 44 +++++++--- 2 files changed, 90 insertions(+), 37 deletions(-) diff --git a/docs/us-chronicle-feed-repin.md b/docs/us-chronicle-feed-repin.md index 547ea26ff7..f1a24f3adb 100644 --- a/docs/us-chronicle-feed-repin.md +++ b/docs/us-chronicle-feed-repin.md @@ -135,34 +135,62 @@ same main-feed targets, so one comparison covers both. The operator compiles the cut and the main feed it replaces on the tree that will merge (the merge tree). The operator first merges main into the change -that pins the cut, then compiles at the change's new head, the tested commit. -In the evidence, the operator records the tested commit and both feeds' -digests. The operator also records how they built the compile environment, for -example from the tested commit's `uv.lock`, and any package they swapped in by -hand. - -The operator compiles both feeds again if main moves after the compiles or the -change gains a commit beyond recording the result in the docs or the -changelog. The change's reviewer can skip that rerun on finding that the tested -commit and the merge tree share their compile inputs and dependency -configuration. The two match when no file differs under `tools/` or -`packages/*/src`, or in `uv.lock`, the workspace `pyproject.toml` or any -package's `pyproject.toml`. GitHub does not refresh its test merge, -`refs/pull//merge`, while the change conflicts with main. So just -before the merge, the reviewer builds the merge tree from main's tip and runs -the check: +that pins the cut, then compiles both feeds at the change's new head, the +tested commit. The operator runs both compiles from one clean checkout of the +tested commit, in the environment its `uv.lock` resolves: +`uv sync --all-packages --locked --extra us` builds it, and +`docs/agent-guide.md` lists that command under Commands as the US engine +environment. + +In a receipt in the evidence, the operator records the tested commit, the +interpreter version, the resolved versions of the packages the compile +imports, the sha256 of the runner and of the comparator, and both feeds' +digests. The operator also records where the compile imported the lane's tool, +each workspace package and each overridden package from, and the output of +`git status --porcelain` at compile time. The operator lists each way the run +departs from that checkout or environment, such as a package they swapped in +by hand. The change's reviewer checks the two digests against the main pin the +cut replaces and the pin the change sets. The reviewer also checks that +`git status` printed nothing. They check that the compile imported the tool +and each workspace package from the checkout, and each overridden package from +a path the operator listed as a departure. + +After the compiles, the operator may add commits that record the result. Each +changes nothing but the changelog and the paragraph below that starts "Today +the US feed owner allows", and reports a result from the runner, the +comparator and the inputs the receipt names. The operator compiles both feeds +again if main moves after the compiles or the change gains any other commit. +The change's reviewer can skip that rerun on finding that the tested commit +and the merge tree share their compile inputs and dependency configuration. +The two match when no file differs under `tools/` or `packages/*/src`, or in +`uv.lock`, the workspace `pyproject.toml` or any package's `pyproject.toml`. +GitHub does not refresh its test merge, `refs/pull//merge`, while the +change conflicts with main. So just before the merge, the reviewer builds the +merge tree from main's tip and runs the check: ```bash -git fetch origin main -git merge-tree --write-tree origin/main -git diff --stat -- tools uv.lock pyproject.toml 'packages/*/src/**' 'packages/*/pyproject.toml' +git fetch origin +refs/heads/main:refs/remotes/origin/main pull//head +git rev-parse origin/main +git merge-tree --write-tree
+git diff --exit-code --stat -- ':(top)tools' ':(top)uv.lock' ':(top)pyproject.toml' ':(top)packages/*/src/**' ':(top)packages/*/pyproject.toml' ``` -`git merge-tree` prints the merge tree's id on its first line, and exits with -status 1 if the change conflicts with main. The `git diff` prints nothing when -the two match. Keep the trailing `/**`: without it, git's `packages/*/src` -pathspec matches no file, so the command misses every change under -`packages/*/src`. +The reviewer stops if `git fetch` fails, since `origin/main` may then name an +older main. The fetch names `refs/remotes/origin/main` as its destination, so +it updates `origin/main` even in a clone whose fetch configuration leaves main +out. The reviewer writes each commit as its full sha: main's from +`git rev-parse origin/main`, and the change's head from +`gh pr view --json headRefOid`. `git merge-tree` prints the merge +tree's id on its first line. If the change conflicts with main, it exits with +status 1 and still prints a tree id, but that tree holds conflict markers. So +the reviewer goes on only when `git merge-tree` exits with 0. The `:(top)` +prefix makes git read each path from the repository root, so the `git diff` +checks the same files from any directory. The two match only when `git diff` +exits with status 0 and prints nothing; it exits with 1 when they differ and +with 128 on an error, such as an unknown commit. If main's tip or the change's +head moves before the merge, the reviewer runs the check again. Keep the +trailing `/**`: without it, git's `packages/*/src` pathspec matches no file, +so the command misses every change under `packages/*/src`. The lane's county rung (`--soi-mode state_county`) is the only build path that consumes both feeds. It loads the county facts the county pin names and checks @@ -188,9 +216,10 @@ SSI age bands and Medicaid enrollment table. Compiles of both feeds at main `5499382` on 17 November 2026 showed this, before microcosm#1610's compiler changes. No run yet covers `totals`, `full` or `state_cd`, or any mode at microcosm#1610's head. Before it merges, microcosm#1610 owes the comparison in -every mode, on the merge tree the rule above names. The change that runs the -comparison replaces this paragraph with the result and its evidence path. The -guard compares commit ids only, so it cannot check this evidence. +every mode, on the merge tree and with the receipt the rule above names. The +change that runs the comparison replaces this paragraph with the result and its +evidence path. The guard compares commit ids only, so it cannot check this +evidence. The combined re-pin moves both pins to one Chronicle main commit at or after chronicle#430's merge `b428468d`, rebuilds both feeds and retires the allowed diff --git a/packages/microcosm-build/tests/engine_free/us/test_us_chronicle_county_facts.py b/packages/microcosm-build/tests/engine_free/us/test_us_chronicle_county_facts.py index 96cca84f98..7afe13ab0c 100644 --- a/packages/microcosm-build/tests/engine_free/us/test_us_chronicle_county_facts.py +++ b/packages/microcosm-build/tests/engine_free/us/test_us_chronicle_county_facts.py @@ -184,13 +184,14 @@ def test_the_combined_repin_retires_the_feed_cut() -> None: def test_the_feed_cut_is_a_full_commit_id_other_than_the_pins() -> None: - """When set, the allowed cut is a full commit id of 40 lowercase hex - characters, distinct from both pins. ``None`` is valid too, and the combined - re-pin requires it.""" + """When set, the allowed cut is a string holding a full commit id of 40 + lowercase hex characters, distinct from both pins. ``None`` is valid too, and + the combined re-pin requires it.""" if _FEED_CUT_ON_THE_SPLIT_PIN is None: return county = load_us_chronicle_county_facts_pin() + assert isinstance(_FEED_CUT_ON_THE_SPLIT_PIN, str) assert len(_FEED_CUT_ON_THE_SPLIT_PIN) == 40 assert set(_FEED_CUT_ON_THE_SPLIT_PIN) <= set("0123456789abcdef") assert _FEED_CUT_ON_THE_SPLIT_PIN not in ( @@ -239,6 +240,11 @@ def _pin_guards_refusing(monkeypatch, *, main, county, cut) -> tuple[str, ...]: #: A later Chronicle main commit: chronicle#430's merge b428468d, the earliest #: commit the combined re-pin may name (docs/us-chronicle-feed-repin.md). _LATER = "b428468dc8a1fad6d21fd4d703b822d5cb687e09" +#: Another later commit, as a made-up full commit id. +_ANOTHER_LATER = "e1" * 20 +#: A made-up full commit id that matches the cut in all but its last character, +#: so a first guard that compares prefixes of any shorter length accepts it. +_CUT_PREFIX_TWIN = _CUT[:39] + "0" @pytest.mark.parametrize( @@ -253,6 +259,7 @@ def _pin_guards_refusing(monkeypatch, *, main, county, cut) -> tuple[str, ...]: (_LATER, _COUNTY, _CUT, (_MOVES,)), (_COUNTY, _COUNTY, _CUT, (_RETIRES,)), (_SPLIT, _COUNTY, _SPLIT, (_FULL_ID,)), + (_CUT_PREFIX_TWIN, _COUNTY, _CUT, (_MOVES,)), # Once the combined re-pin has moved the county pin. (_LATER, _LATER, None, ()), (_LATER, _LATER, _CUT, (_RETIRES,)), @@ -260,6 +267,7 @@ def _pin_guards_refusing(monkeypatch, *, main, county, cut) -> tuple[str, ...]: (_SPLIT, _LATER, _CUT, (_MOVES, _RETIRES)), (_CUT, _LATER, _CUT, (_MOVES, _RETIRES)), (_LATER, _LATER, _LATER, (_RETIRES, _FULL_ID)), + (_LATER, _ANOTHER_LATER, None, (_MOVES,)), ], ids=[ "split-pin", @@ -270,12 +278,14 @@ def _pin_guards_refusing(monkeypatch, *, main, county, cut) -> tuple[str, ...]: "main-moves-alone", "both-at-3e9d3a0-cut-kept", "cut-names-the-split-pin", + "main-shares-the-cut-prefix", "combined-repin", "combined-repin-cut-kept", "back-to-the-split-pin", "back-to-the-split-pin-cut-kept", "county-moves-alone-main-keeps-the-cut", "combined-repin-cut-names-the-new-pin", + "pins-at-two-later-commits", ], ) def test_the_split_exceptions_end_when_the_county_pin_moves( @@ -284,7 +294,10 @@ def test_the_split_exceptions_end_when_the_county_pin_moves( """Review r2 P2-1: the split pin and the cut stay allowed only while the county pin names 3e9d3a0. Once the county pin moves, the main pin can neither return to the split pin nor keep the cut. Each case names the - guards that refuse it, so it fails if any guard starts or stops refusing.""" + guards that refuse it, so it fails if any guard starts or stops refusing. + Review r4 P2-4 added two states that only the first guard refuses: a main + pin that matches the cut in all but its last character, and main and county + pins at two different later commits with no cut.""" refused_by = _pin_guards_refusing(monkeypatch, main=main, county=county, cut=cut) assert refused_by == refusing @@ -312,23 +325,34 @@ def test_a_later_cut_replaces_the_first(monkeypatch, main, refusing) -> None: @pytest.mark.parametrize( "cut", - [_CUT[:7], _CUT + "0", _CUT[:39] + "g", _CUT.upper(), _COUNTY], + [ + _CUT[:7], + _CUT + "0", + _CUT[:39] + "g", + _CUT.upper(), + _COUNTY, + tuple(_CUT), + _CUT.encode(), + ], ids=[ "short-cut", "long-cut", "non-hex-cut", "upper-case-cut", "cut-names-the-county-commit", + "tuple-cut", + "bytes-cut", ], ) def test_a_cut_that_is_not_a_full_id_other_than_the_pins_is_refused( monkeypatch, cut ) -> None: - """Review r3 P2-2: the full-id guard alone refuses each of these cuts. A - 7- or 41-character id fails the length check, a 'g' or upper-case letters - fail the lowercase-hex check, and the county commit fails the distinct-id - check. The main pin stays at the split pin, which every other guard - accepts.""" + """Review r3 P2-2 and r4 P2-3: the full-id guard alone refuses each of these + cuts. A 7- or 41-character id fails the length check, a 'g' or upper-case + letters fail the lowercase-hex check, and the county commit fails the + distinct-id check. A tuple of the cut's 40 characters and the cut's bytes + fail the string check. The main pin stays at the split pin, which every + other guard accepts.""" refused_by = _pin_guards_refusing(monkeypatch, main=_SPLIT, county=_COUNTY, cut=cut) assert refused_by == (_FULL_ID,) From 6389676f28f16600a4cd3f1f2bf1b63eb63be7c4 Mon Sep 17 00:00:00 2001 From: Max Ghenis Date: Sat, 21 Nov 2026 14:04:33 +0100 Subject: [PATCH 7/8] Define the runner and comparator and say where the receipt goes A reader of the follow-up comment for microcosm#1610 found two gaps in the doc's evidence rule. The doc asked for the sha256 of "the runner" and "the comparator" without saying what either script does, and the repository holds neither. It also put the receipt "in the evidence" without saying where. If the operator committed the receipt to the change, that commit would change more than a record commit may, and the operator would compile again unless the reviewer's merge-tree check let them skip the rerun. The doc now says what each script takes and produces, and that the repository holds neither, so the receipt records their sha256. The operator keeps the receipt with the evidence, outside the repository, and links to it or quotes it in the change's pull request. The paragraph on the allowed cut asks for a link to its evidence in place of an evidence path. The record-commit rule and the reviewer's skip check stay as they were. Co-Authored-By: Claude Opus 5.5 --- docs/us-chronicle-feed-repin.md | 35 ++++++++++++++++++++++----------- 1 file changed, 23 insertions(+), 12 deletions(-) diff --git a/docs/us-chronicle-feed-repin.md b/docs/us-chronicle-feed-repin.md index f1a24f3adb..d104630e6f 100644 --- a/docs/us-chronicle-feed-repin.md +++ b/docs/us-chronicle-feed-repin.md @@ -142,15 +142,26 @@ tested commit, in the environment its `uv.lock` resolves: `docs/agent-guide.md` lists that command under Commands as the US engine environment. -In a receipt in the evidence, the operator records the tested commit, the -interpreter version, the resolved versions of the packages the compile -imports, the sha256 of the runner and of the comparator, and both feeds' -digests. The operator also records where the compile imported the lane's tool, -each workspace package and each overridden package from, and the output of -`git status --porcelain` at compile time. The operator lists each way the run -departs from that checkout or environment, such as a package they swapped in -by hand. The change's reviewer checks the two digests against the main pin the -cut replaces and the pin the change sets. The reviewer also checks that +The operator compiles each feed with a script (the runner) that calls +`state_admin_surface` in each mode and `acs_local_ssi_medicaid_take_up_targets` +on that feed and writes what each call returns to a file. A second script (the +comparator) reads the runner's files for both feeds and reports each target in +the lane's selection that the cut adds, removes or changes in any `TargetSpec` +field, and any change in the targets' order. It also reports any difference in +the SOI receipt, the substitution records, the SSI age-band counts or the +Medicaid enrollment table. The repository holds neither script, so the +operator records each one's sha256 in a receipt. The operator keeps the +receipt with the evidence, outside the repository, and links to it or quotes +it in the change's pull request. + +In the receipt, the operator also records the tested commit, the interpreter +version, the resolved versions of the packages the compile imports and both +feeds' digests. The operator records where the compile imported the lane's +tool, each workspace package and each overridden package from, and the output +of `git status --porcelain` at compile time. The operator lists each way the +run departs from that checkout or environment, such as a package they swapped +in by hand. The change's reviewer checks the two digests against the main pin +the cut replaces and the pin the change sets. The reviewer also checks that `git status` printed nothing. They check that the compile imported the tool and each workspace package from the checkout, and each overridden package from a path the operator listed as a departure. @@ -217,9 +228,9 @@ SSI age bands and Medicaid enrollment table. Compiles of both feeds at main changes. No run yet covers `totals`, `full` or `state_cd`, or any mode at microcosm#1610's head. Before it merges, microcosm#1610 owes the comparison in every mode, on the merge tree and with the receipt the rule above names. The -change that runs the comparison replaces this paragraph with the result and its -evidence path. The guard compares commit ids only, so it cannot check this -evidence. +change that runs the comparison replaces this paragraph with the result and a +link to its evidence. The guard compares commit ids only, so it cannot check +this evidence. The combined re-pin moves both pins to one Chronicle main commit at or after chronicle#430's merge `b428468d`, rebuilds both feeds and retires the allowed From ebf6cb612ff6c79a5c5599a26fe930d39bfca512 Mon Sep 17 00:00:00 2001 From: Max Ghenis Date: Sat, 21 Nov 2026 14:23:57 +0100 Subject: [PATCH 8/8] Keep both scripts with the receipt and split the comparator sentence The operator records the sha256 of the runner and of the comparator in the receipt, since the repository holds neither script. The doc did not say where the operator keeps the scripts, so a reviewer had no copy to check those hashes against. The operator now keeps the receipt and both scripts with the evidence, outside the repository, and links to them or quotes them in the change's pull request. Keeping them needs no commit, so the record-commit rule and the reviewer's skip check stay as they were. The doc also splits the comparator's 38-word sentence in two, so a reader sees that the comparator reports any change in the targets' order. Co-Authored-By: Claude Opus 5.5 --- docs/us-chronicle-feed-repin.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/docs/us-chronicle-feed-repin.md b/docs/us-chronicle-feed-repin.md index d104630e6f..f3f08c0adf 100644 --- a/docs/us-chronicle-feed-repin.md +++ b/docs/us-chronicle-feed-repin.md @@ -145,14 +145,14 @@ environment. The operator compiles each feed with a script (the runner) that calls `state_admin_surface` in each mode and `acs_local_ssi_medicaid_take_up_targets` on that feed and writes what each call returns to a file. A second script (the -comparator) reads the runner's files for both feeds and reports each target in -the lane's selection that the cut adds, removes or changes in any `TargetSpec` -field, and any change in the targets' order. It also reports any difference in -the SOI receipt, the substitution records, the SSI age-band counts or the -Medicaid enrollment table. The repository holds neither script, so the -operator records each one's sha256 in a receipt. The operator keeps the -receipt with the evidence, outside the repository, and links to it or quotes -it in the change's pull request. +comparator) reads the runner's files for both feeds. It reports each target +that the cut adds to or removes from the lane's selection or changes in any +`TargetSpec` field, and any change in the targets' order. It also reports any +difference in the SOI receipt, the substitution records, the SSI age-band +counts or the Medicaid enrollment table. The repository holds neither script, +so the operator records each one's sha256 in a receipt. The operator keeps the +receipt and both scripts with the evidence, outside the repository, and links +to them or quotes them in the change's pull request. In the receipt, the operator also records the tested commit, the interpreter version, the resolved versions of the packages the compile imports and both