From 543c35f069e0ad99fa6d1584b5ff5278f86e76be Mon Sep 17 00:00:00 2001 From: Max Ghenis Date: Thu, 29 Oct 2026 12:47:53 -0400 Subject: [PATCH 1/2] Pin the fact decoder in both UK target kernel hashes #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 --- .../uk/test_uk_target_compile_modules.py | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/packages/microcosm-build/tests/engine_free/uk/test_uk_target_compile_modules.py b/packages/microcosm-build/tests/engine_free/uk/test_uk_target_compile_modules.py index 55cf8f77f3..810c13c1a2 100644 --- a/packages/microcosm-build/tests/engine_free/uk/test_uk_target_compile_modules.py +++ b/packages/microcosm-build/tests/engine_free/uk/test_uk_target_compile_modules.py @@ -6,6 +6,7 @@ import importlib from pathlib import Path +from microcosm.build import ledger_artifact from microcosm.build import ledger_targets as shared_ledger_targets from microcosm.build.uk_runtime import ( graph_national, @@ -106,6 +107,18 @@ def test_full_target_kernels_hash_the_measure_simulation(monkeypatch): assert measure_simulation in _hashed_by(kernel, monkeypatch, graph_targets) +def test_full_target_kernels_hash_the_fact_decoder(monkeypatch): + """full_targets loads the ledger facts inside run through + ledger_artifact's decoder, so an edit there alone re-keys both kernels + that share this hash (microcosm#1382). The pin holds even if no listed + module imports ledger_artifact any more.""" + for kernel in ( + graph_targets.UKFullTargetCompilationKernel(), + graph_targets.UKFullMeasureKernel(), + ): + assert ledger_artifact in _hashed_by(kernel, monkeypatch, graph_targets) + + def test_national_target_kernel_hashes_the_same_compile_modules(monkeypatch): hashed = _hashed_by( graph_national.UKNationalTargetKernel(), monkeypatch, graph_national @@ -122,3 +135,14 @@ def test_national_target_kernels_hash_the_measure_simulation(monkeypatch): graph_national.UKNationalProblemKernel(resolver_factory=None), ): assert measure_simulation in _hashed_by(kernel, monkeypatch, graph_national) + + +def test_national_target_kernels_hash_the_fact_decoder(monkeypatch): + """The national targets load the ledger facts through full_targets and + ledger_artifact's decoder too, so an edit there alone re-keys both + kernels that share this hash (microcosm#1382).""" + for kernel in ( + graph_national.UKNationalTargetKernel(), + graph_national.UKNationalProblemKernel(resolver_factory=None), + ): + assert ledger_artifact in _hashed_by(kernel, monkeypatch, graph_national) From 220e9cb7c3e0a74f335cc27a6833f0835927e94a Mon Sep 17 00:00:00 2001 From: Max Ghenis Date: Thu, 29 Oct 2026 13:53:07 -0400 Subject: [PATCH 2/2] Pin the decoder hash on the selection and problem kernels too 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 --- .../engine_free/uk/test_uk_target_compile_modules.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/packages/microcosm-build/tests/engine_free/uk/test_uk_target_compile_modules.py b/packages/microcosm-build/tests/engine_free/uk/test_uk_target_compile_modules.py index 810c13c1a2..8abc5978f7 100644 --- a/packages/microcosm-build/tests/engine_free/uk/test_uk_target_compile_modules.py +++ b/packages/microcosm-build/tests/engine_free/uk/test_uk_target_compile_modules.py @@ -109,12 +109,15 @@ def test_full_target_kernels_hash_the_measure_simulation(monkeypatch): def test_full_target_kernels_hash_the_fact_decoder(monkeypatch): """full_targets loads the ledger facts inside run through - ledger_artifact's decoder, so an edit there alone re-keys both kernels - that share this hash (microcosm#1382). The pin holds even if no listed - module imports ledger_artifact any more.""" + ledger_artifact's decoder, so an edit there alone re-keys every full-graph + kernel built on this hash: compilation, selection and measure share it, + and the problem kernel embeds it (microcosm#1382). The pin holds even if + no listed module imports ledger_artifact any more.""" for kernel in ( graph_targets.UKFullTargetCompilationKernel(), + graph_targets.UKFullTargetSelectionKernel(), graph_targets.UKFullMeasureKernel(), + graph_targets.UKFullProblemKernel(), ): assert ledger_artifact in _hashed_by(kernel, monkeypatch, graph_targets)