Skip to content

Pin the fact decoder in both UK target kernel hashes - #1424

Merged
MaxGhenis merged 2 commits into
mainfrom
nzhub/uk-decoder-hash-pin
Oct 29, 2026
Merged

MaxGhenis merged 2 commits into
mainfrom
nzhub/uk-decoder-hash-pin

Conversation

@MaxGhenis

@MaxGhenis MaxGhenis commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Test-only follow-up to #1382. #1382 listed microcosm.build.ledger_artifact in UK_TARGET_COMPILE_MODULE_NAMES, because both UK target kernels decode their ledger facts inside run:

  • full_targets.load_uk_full_target_inputs and load_uk_national_target_inputs call load_ledger_consumer_artifact;
  • the hash didn't cover that decoder before the listing.

The import-coverage test (test_every_direct_import_of_a_listed_module_is_listed_or_excluded) keeps ledger_artifact listed only while some listed module imports it. Today that module is ledger_targets, which imports it for LexicalFloat. Two holes were open:

  • While the import stays, ledger_artifact could move from the tuple into EXCLUDED_DIRECT_IMPORTS with every test green. Add feed-derived NZ reference ageing factors (G8-r2a) #1382's b36c702 shipped exactly that state before its review asked for the listing.
  • If the import goes away, ledger_artifact could leave the tuple with every test green. (Moving it into the exclusions then fails test_exclusions_are_live_and_never_listed, since the entry would be dead.)

The independent review of #1382's listing raised this as a nit.

This PR pins the module directly, as the measure_simulation tests do. test_full_target_kernels_hash_the_fact_decoder and test_national_target_kernels_hash_the_fact_decoder assert that every kernel built on the two UK target hashes hashes ledger_artifact:

  • The full graph. Target compilation, target selection and measure share the hash, and the problem kernel embeds it in its own.
  • The national graph. Target and problem share the hash. The gates kernel overrides its hash and decodes no facts.

Invariant

Every UK kernel whose run decodes ledger facts includes the decoder module in its implementation hash, so an edit to the decoder alone re-keys it.

Evidence

Tests ran with CI's import path (every packages/*/src plus the repo root):

  • Clean: test_uk_target_compile_modules.py passes, 8 of 8.
  • Mutant (ledger_artifact moved from the tuple into EXCLUDED_DIRECT_IMPORTS): the import-coverage test stays green, and both new tests fail. That is the hole they close. The hub re-ran it at 220e9cb: 2 failed, 6 passed.

No source change, so no implementation hash moves and no cache re-keys.

Review

  • Independent review of 543c35f (Opus 5.5 in session, since every Codex lane was held; jobs/review-microcosm-1424): APPROVE_WITH_NITS, no defects.
    • It confirmed both kernel families hash *uk_target_compile_modules(), and it confirmed the call traces from each run to load_ledger_consumer_artifact.
    • Mutant A (exclusion) fails both new tests. Mutant B (deleted, no exclusion) also fails the import-coverage test.
    • At head, a comment-only edit to ledger_artifact.py moves the full, full-problem and national hashes; under mutant A it moves none.
    • Its nits: the body paired the wrong hole with its condition (fixed above), and the full-graph pin left out the selection and problem kernels. 220e9cb adds both and names them in the docstring; it changes only the test file.
  • Delta review of 220e9cb (same reviewer): APPROVE. The delta touches only the test file. UKFullProblemKernel() takes no arguments, and its hash reaches the patched source_hash through super(). Under mutant A, ledger_artifact drops out of each of the four full-graph kernels' hashed objects on its own. A comment-only edit to ledger_artifact.py moves all four hashes at head and none under mutant A.
  • CI at 220e9cb: every job passed (gh pr checks exit 0; run 40925575253): engine-free and engine-uk on Python 3.13 and 3.14, integration-uk, lint, select-countries and wheels; engine-us reported skipping.

🤖 Generated with Claude Code

MaxGhenis and others added 2 commits October 29, 2026 12:47
#1382 listed microcosm.build.ledger_artifact in
UK_TARGET_COMPILE_MODULE_NAMES because both UK target kernels decode
their ledger facts inside run through full_targets ->
load_ledger_consumer_artifact. The import-coverage test keeps it listed
only while a listed module (ledger_targets, for LexicalFloat) imports
it; drop that import and ledger_artifact could leave the tuple with
every test green.

Pin it directly, as the measure_simulation tests do: all four kernels
that share the two UK target hashes (full target, full measure,
national target, national problem) must hash ledger_artifact. Moving
ledger_artifact from the tuple to EXCLUDED_DIRECT_IMPORTS leaves the
coverage test green and turns both new tests red.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Three full-graph kernels share the UK target hash: target compilation,
target selection and measure. The problem kernel embeds that hash in its
own. The decoder pin covered only compilation and measure, so it now
loops over all four, and its docstring names them.

With ledger_artifact moved from the listing into EXCLUDED_DIRECT_IMPORTS,
both decoder pins fail and the other six tests pass, as before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@MaxGhenis
MaxGhenis marked this pull request as ready for review October 29, 2026 19:17
@MaxGhenis
MaxGhenis merged commit 945cb23 into main Oct 29, 2026
9 checks passed
@MaxGhenis

Copy link
Copy Markdown
Contributor Author

Merged by the NZ hub (session local_e407a527) at 220e9cb with --merge. Gates: gh pr checks exit 0; MERGEABLE; not draft; no CHANGES_REQUESTED review. Reviewed head: 220e9cb. Independent review (Opus 5.5 in session, jobs/review-microcosm-1424/out-opus.md) approved 543c35f with nits; its delta review approved 220e9cb (test-only, adds the selection and problem kernels). gh pr checks exit 0 on run 40925575253.

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