Repository navigation
Tighten NZ's ageing and declarations tests after #1488 and #1507 - #1517
Conversation
Cloud review 220's nit 1 on #1507: test_nz_reference_aging.py's test_p1_rounds_once_and_the_truncated_numerator_refuses used p1_ty2026_to_ty2027_central. Its truncated numerator differs from the declared one, but all three intermediate roundings match it, so the test couldn't tell one rounding from rounding N or the projected quarters to cents, or q to six digits. A new helper, _p1_numerators, computes each P1 profile's numerator under one half-even rounding and under truncation and those three roundings. The parametrized refusal test sets each differing alternative as the declared numerator and expects the resolver to refuse it. A feed-free test checks that the three profiles between them separate one rounding from every alternative. Review 216's nits 2 and 3 on #1488: - The docstring of test_every_calibration_node_has_its_own_standin_as_the_only_writer said composition checks the measurement proof on the skeleton alone. Since #1488, composition also runs _check_measurement_proofs on the extended graph, where the compiled graph has to prove each nz.v.<V>.calibrate producer. - add_measurement inserted a compile-only producer "until G declares one". NZ's transport graph and all eight calibration scenarios now declare the measurement through their stand-ins, so the helper returned at once on every call. It and its two calls go. #1507 left one assert unformatted in each of test_nz_reference_aging.py and test_nz_money_normalization.py; ruff format now formats both files, and neither syntax tree changes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Merged by the NZ hub (session local_e407a527) at e48af5a with --merge. Gates: |
Tests only. This PR carries cloud review 220's nit 1 on #1507 and review 216's nits 2 and 3 on #1488; each needed its PR in
mainfirst.What changes
The P1 rounding test (
test_nz_reference_aging.py, review 220's nit 1).test_p1_rounds_once_and_the_truncated_numerator_refusesusedp1_ty2026_to_ty2027_central. Truncation changes that factor's numerator (1029852 against 1029853), but rounding N to cents, rounding the projected quarters to cents and rounding q to six digits all give 1029853, so the test couldn't tell one rounding from any of them._p1_numerators, computes a P1 profile's numerator in millionths at 60 digits under one half-even rounding, and under truncation and each of those three intermediate roundings.test_p1_rounds_once_and_refuses_truncated_or_intermediate_numeratorsruns for the low, central and high profiles. It checks that one rounding gives_EXPECTED's numerator, then declares each alternative that differs and expects the resolver to refuse it ("expected factor mismatch"). It needs the feed, so CI skips it.test_p1_profiles_separate_one_rounding_from_each_alternativeneeds no feed, so it runs in CI. It checks that across the three profiles every alternative differs from one rounding at least once.The docstring of
test_every_calibration_node_has_its_own_standin_as_the_only_writer(test_nz_transport_declarations.py, review 216's nit 2). It said composition checks the measurement proof on the skeleton alone. Since Prove extension calibration nodes' measurement producers in compose #1488,compose_transport_graphalso runs_check_measurement_proofson the extended graph withextension_nodes, where the compiled graph has to prove eachnz.v.<V>.calibrateproducer.add_measurementgoes (nit 3), with its two calls in_nz_composition_spec_and_config. It inserted a compile-only producer "until G declares one". NZ's packagedtransport_graph.jsonand all eight calibration scenarios inscenarios.jsonnow declareird_taxable_income_ty2027_v1through their stand-ins (nz.income.standin,nz.v.<V>.income.standin), so its early return fired on every call.Formatting. NZ: re-declare the ageing factors from the September 2026 QES #1507 left one
assertunformatted in each oftest_nz_reference_aging.pyandtest_nz_money_normalization.py.ruff format(0.15.16, the version CI pins) now formats both files, and neither syntax tree changes. CI's lint job runsruff check, which doesn't check formatting.Invariants
tools/generate_nz_reference_aging.py:131). A growth re-declaration has to update that literal in_p1_numeratorstoo; the generator's check andtest_root_enclosure_certifies_no_rounded_quarters_and_irrational_rootcarry the same 2.7. With the new numbers in place, the test fails if they stop separating any of the four schemes._MEASUREMENTstays, since six other tests in the file use it. Withadd_measurement's early return firing on every call, removing it leaves each graph's node list as it was.Checks
89178aaf. The hub ran these one process at a time under its memory guard (-n 0). The tree was78907367, a local commit of main3e7a7045plus NZ: re-declare the ageing factors from the September 2026 QES #1507 plus this change. Main has since gained Test low counts and digests, and anchors listed second, in later reports #1513 and Sign off the local cuts' target-fit rows (dbacb023, 83802786), and the company car base #1491, and neither changes an NZ file:test_nz_reference_aging.py: 25 passed in 19.5 s, none skipped, so the feed-gated refusal tests ran;test_nz_transport_declarations.py: 62 passed in 180 s.e48af5a0passed all 11 checks. The 3.13 engine-free leg's pytest command names all three changed files and reports 25,886 passed, 291 skipped, 3 xfailed and none failed. The feed-gated tests skip there; the separation test has no skip path, so it ran. Main has since gained Add binding-local views to the Axiom adapter, registry, compose and closure (S2b PR 1) #1482, which shares no file with this PR; the merge audit comment gives the check.20261104-170839-nz-nits-review) reviewed the same patch (c78112a7e..83b4fe2d9; this PR's patch-id matches). Verdict: APPROVE_WITH_NITS, needs Max: no.reference_factors.py:611-614).add_measurementreturned early on all nine calls, and that the formatting hunks leave the syntax trees unchanged.🤖 Generated with Claude Code