Repository navigation
Conversation
benefit_unit_rule.json cited concepts.py:880-919 and concepts.py lines 892-901 for the relationship pointers. #1120 shifted both ranges by one line on main, and #1134 (open) adds seven more lines above them: at its head, lines 892-901 are the partner pointer's text rather than the "always parent 1" sentence, and 880-919 stops before reference_person_id. The file also cited executor.py by line, and scenarios.json cited the harness as "ops main run.py:168", which moves with ops main. Cite the Relationships block, _pointer("parent_1_person_id"), the executor functions, and WEEKS_IN_MODEL_YEAR at ops ba6e7d6e instead. Add unpinned_python_line_citations: no NZ spec resource may cite a line of a Python source unless it pins that source at a commit (as as_rate_bridge.json pins the harness), with Hypothesis cases per refusal branch, plus checks that the cited pointers match the concepts source and that every dotted microcosm symbol the package names resolves. Re-pin the two resource hashes and the NZ spec fingerprint in the golden. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Invariant
No NZ spec resource cites a line number of a Python source unless the same resource pins that source at a commit. In practice:
pathnames the.pyfile and whosecommitis 7–40 hex digits.The check is
unpinned_python_line_citationsintest_nz_spec_package.py. It scans every string, mapping keys included, in every NZ package resource (the JSON files andspec/*.yaml).Scope:
x.py:N,x.py:N-M,x.py:N,M,x.py#LN,x.py LN,x.py line N,x.py, lines N-M,x.py (lines N-M), and the reverse formslines N-M of x.pyandline N in x.py..pyfile is out of scope, for exampleharness_linesor "lines 1695-1790 of the same file at 302e43b…". Those already sit beside a commit.Why
benefit_unit_rule.jsoncitedconcepts.py:880-919(the relationship pointer block) andconcepts.py lines 892-901(the "always parent 1" sentence). fe698c9 wrote them against the file at that commit._pointer(.The same file also cited
executor.py lines 636-643andlines 1550-1573. Those were exact when this branch was cut from 0daf83c, but #888 has since merged and moved the two functions to lines 638 and 1531.scenarios.jsoncited the conformance harness asops main run.py:168, which moves whenever ops main does.Changes
benefit_unit_rule.jsonpointer_concepts.citationconcepts.py:880-919concepts.py, the "# --- Relationships" block: _pointer("partner_person_id") through _pointer("reference_person_id")benefit_unit_rule.jsondependent-child ruleconcepts.py lines 892-901concepts.py _pointer("parent_1_person_id")benefit_unit_rule.jsondescription(…_structural_columns, executor.py lines 636-643),(_validate_population_declaration, executor.py lines 1550-1573)(microcosm.graph.executor._structural_columns),(microcosm.graph.executor._validate_population_declaration)scenarios.jsonMC12 annualisation note(ops main run.py:168)(WEEKS_IN_MODEL_YEAR in TheAxiomFoundation/ops nz-lane/emtr_reproduction/run.py at ba6e7d6e)as_rate_bridge.json'srun.py:Ncitations are unchanged. Itssourceblock pinsnz-lane/emtr_reproduction/run.pyatba6e7d6e4f488fdb2762dfb9d91c90f3238b719c, and the new test asserts that they are scanned and covered by that pin, so the exemption is not vacuous.Each cited claim was re-read for this PR:
ba6e7d6e,run.py:168isWEEKS_IN_MODEL_YEAR = D365 / D7. That commit is still ops main's head._pointer("parent_1_person_id")'s definition says "When only one parent is co-resident it is always parent 1."_check_pointersemitsparent_orderforparent_2withoutparent_1._validate_population_declarationraises when a non-structural node owns an entity id or person membership column.Tests (engine-free,
TestSourceCitations)main,HEADor a 6-hex prefix, does not;benefit_unit_rule.jsonequal the_pointer(...)calls in concepts.py's Relationships block, in order._check_pointersexists.microcosm.*symbol named anywhere in the package resolves through import plus getattr. A missing attribute and a missing shard both raise.Mutation check. Each of these mutants fails one of the new tests, and each was reverted:
_check_pointers;executor._structural_columns;parent_2_person_idin the block.On origin/main's JSON, the validator flags all five old citations (2× concepts.py, 2× executor.py, 1× run.py). On this branch it flags none.
Robustness to #1134: with #1134's
microcosm-frame/srcdiff applied on top of this branch,TestSourceCitationsand the three country goldens pass (18 passed).Re-pins
packages/microcosm-build/tests/golden/nz_country_spec.json, regenerated from the loaded spec (3 lines):benefit_unit_rule.json:9e507e78…→2dcc3a89…scenarios.json:5dbf2b96…→1ca42272…fingerprint:df8850d5…→b7a6622b…Downstream search:
package_fingerprintfor NZ moves fromd7ef7887…to45566f35…. No file in this repo pins it, by full hash or by 8-character prefix, and neither does Chronicle at0f2cd96or a PolicyEngine-wide code search.spec_sha256anddocumentation_sha256are unchanged, because the legacy JSON is in neither surface.sources.yamlcontract receipts pin onlysource_stages.jsonandgeography_spine.json, which are untouched.Verification
Commands:
ruff check .: clean.ruff format --checkon the test file: clean.pytest test_nz_spec_package.py test_country_spec.py test_spec_engine_country_bundles.py test_spec_engine_loader.py -p no:cacheprovider --basetemp=.hub-scratch/pytest -o tmp_path_retention_policy=failed: 251 passed.Only the targeted files were run, not the full suite.
Out of scope
The US spec has the same defect.
us/ecps_parity_known_gaps.jsoncitespackages/microcosm-build/src/microcosm/build/us_runtime/asec_pool.py lines 61…andlines 397…, which are in-repo and unpinned. That is filed as a separate follow-up, not changed here.axiom: n/a: spec citation text and an engine-free test; no policy or rule change.
🤖 Generated with Claude Code