Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
651501e
Bind UK gate signing to a committed key registry
MaxGhenis Oct 22, 2026
a093b36
Give the national-build tests the test signing key
MaxGhenis Oct 22, 2026
fee05bd
Add a one-command, resumable UK cut runner with pinned inputs
MaxGhenis Oct 22, 2026
a1790ef
Script the policyengine.py certification handoff for a UK cut
MaxGhenis Oct 22, 2026
762c6e4
Document building a UK cut without the original builder's machine
MaxGhenis Oct 22, 2026
ac0a14d
Point the agent guide's release boundary at the UK cut runner
MaxGhenis Oct 22, 2026
1e4d31d
Allow the UK cut inputs manifest to name the gated data repository
MaxGhenis Oct 22, 2026
f89d22f
Allow the UK cut doc to name the upload destination
MaxGhenis Oct 22, 2026
8f611bd
Measure what area runs lose on an accepted regional mismatch
MaxGhenis Oct 22, 2026
bd53acb
Report pytest preflight checks by exit code and failing ids
MaxGhenis Oct 22, 2026
46d34ce
Bind the legacy schema-3 trust root to the key registry too
MaxGhenis Oct 22, 2026
5c5b47d
Move hosted inputs into place, and rerun a failed national dry run
MaxGhenis Oct 22, 2026
ea985e5
Add a Modal path for the UK cut runner
MaxGhenis Oct 22, 2026
bedd04e
Merge remote-tracking branch 'origin/main' into uk-cut-anyone
MaxGhenis Oct 22, 2026
61e25de
Pin the hosted Chronicle UK artifact
MaxGhenis Oct 22, 2026
bbe90ae
Make UK certification stackable, timed and fail closed on operational…
Oct 23, 2026
3fccb97
Expose timed preflight and stream long-running certification logs
Oct 23, 2026
ac0d747
Label certification handoff qualification pending and allow stacked P…
Oct 23, 2026
c64c0d4
Probe country input registry once at exact model and core versions
Oct 23, 2026
10ae2be
Avoid unrelated country initialization in constant rewrite and UC floor
Oct 23, 2026
f1114e5
Report measured UC floor status and request acceptance only for failures
Oct 23, 2026
ed8e730
Preserve upstream handoff coverage and discover rehearsal regressions…
Oct 23, 2026
ca29a1c
Adapt upstream fixtures to measured UC and immutable exact-pair inter…
Oct 23, 2026
97e4e1b
Expose full-suite test identities and slowest durations in streamed logs
Oct 23, 2026
f362667
Dump nonfatal worker tracebacks when full-suite tests exceed five min…
Oct 23, 2026
fa2a8c3
Refuse full-suite fixtures nested inside a Git repository before heav…
Oct 23, 2026
e00c055
Resume unfinished certification worktrees and stage only generated ar…
Oct 23, 2026
555fd2f
Report pytest startup stalls through original stderr without terminat…
Oct 23, 2026
4f5e80d
Fit the rehearsal patches to the repo's lint and to other hosts
MaxGhenis Oct 23, 2026
8554039
Measure the regional loss on the regional file's own columns
MaxGhenis Oct 23, 2026
300ce55
Keep failed attempts' evidence, resolve paths, bind stage 1, harden t…
MaxGhenis Oct 23, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/uk-cut-modal.added.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
`tools/modal_uk_cut.py` runs the UK cut runner in a Modal container, with its work directory on a Modal volume so a rerun resumes, for when the build machine is busy or asleep.
1 change: 1 addition & 0 deletions changelog.d/uk-cut-pepy-certification.added.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
`tools/certify_uk_cut_in_policyengine_py.py` certifies a published UK cut into policyengine.py on a fresh branch: it refuses when another pull request is already certifying the cut, checks the regional route before writing anything, runs certify-data, the lock, TRO, constant and snapshot regeneration and the strict bundle check, measures the UC floor and runs the tests, then drafts the pull request with every judgment call left as a checklist.
1 change: 1 addition & 0 deletions changelog.d/uk-cut-runner.added.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
`tools/run_uk_cut.py` builds, signs and assembles a Microcosm UK national cut in one resumable command, fetching every input from Hugging Face by the pins the build already enforces (`tools/uk_cut_inputs.json` says only where each input lives). `tools/modal_rebuild_uk_chronicle_artifact.py` rebuilds the pinned Chronicle UK consumer artifact on Modal and hosts it privately.
1 change: 1 addition & 0 deletions changelog.d/uk-gate-signing-key-registry.added.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
UK gate reports, release-cut certifications and dense gate reports now verify only under a signing key registered in `microcosm.data.gate_signing_keys`, and every UK signer refuses an unregistered or retired key. The national build checks its key before loading any input, instead of failing after the solve. `python -m microcosm.data.gate_signing_keys check` reports whether the key in the environment may sign.
41 changes: 41 additions & 0 deletions conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,3 +130,44 @@ def unexpected_start(*args, **options):
yield emitters
for emitter in emitters:
emitter.close()


@pytest.fixture(autouse=True)
def _admit_test_gate_signing_keys(request, monkeypatch):
"""Let tests sign with their own UK gate keys.

Production verifies only keys registered in
``microcosm.data.gate_signing_keys``. Tests sign with throwaway keys, so
every unregistered key counts as an active test key here, while the
committed entries keep their real status. A test marked
``committed_gate_key_registry`` sees the committed registry unchanged.
"""

if request.node.get_closest_marker("committed_gate_key_registry"):
return
try:
from microcosm.data import gate_signing_keys
except ImportError:
return
committed = gate_signing_keys._registry

class _AdmitTestKeys(dict):
def __missing__(self, key_sha256):
return gate_signing_keys.GateSigningKey(
key_sha256=key_sha256,
label="test-key",
status="active",
custodian="the test suite",
held_in="the test",
registered="test",
evidence="admitted by the root conftest",
)

def get(self, key_sha256, default=None):
return self[key_sha256]

def registry(country):
entries = committed(country)
return None if entries is None else _AdmitTestKeys(entries)

monkeypatch.setattr(gate_signing_keys, "_registry", registry)
5 changes: 4 additions & 1 deletion docs/agent-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,10 @@ grades every waiver register on the staged frame before the solve; see README
"Dry-running the release's registers". Publication also refuses a
release whose build recorded staging telemetry that never reached its repo
(`--allow-missing-staging` overrides); a build that declared `--no-staging`
publishes without the flag. Never publish or promote artifacts as a side
publishes without the flag. A UK national cut runs end to end with
`tools/run_uk_cut.py` ([uk-cut-anyone.md](uk-cut-anyone.md)): inputs fetched
by pin, a signing key registered in `microcosm.data.gate_signing_keys`, and
an inspection-only `--publish`. Never publish or promote artifacts as a side
effect of another task. A UK rowwise run's **staged** bundle
(`staged/<run_id>/` in the private repository, written by the build itself)
is inspection evidence, not a release: it never moves `releases/` or
Expand Down
346 changes: 346 additions & 0 deletions docs/uk-cut-anyone.md

Large diffs are not rendered by default.

5 changes: 4 additions & 1 deletion packages/microcosm-build/src/microcosm/build/gate_battery.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
weights_audit_gate,
)
from microcosm.build.trace import compute_composition_fingerprint
from microcosm.data.gate_signing_keys import require_registered_gate_signing_key
from microcosm.frame import Frame

__all__ = [
Expand Down Expand Up @@ -155,7 +156,9 @@ def _signing_key(country: str) -> bytes:
raise RuntimeError(f"{env} must be valid base64.") from exc
if len(key) != 32:
raise RuntimeError(f"{env} must decode to exactly 32 bytes.")
return key
# A key the committed registry does not let sign would produce reports
# no verifier accepts; refuse it here so the report says why.
return require_registered_gate_signing_key(country, key, purpose="sign")


def _json_safe(value: object) -> object:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
uk_time_period,
)
from microcosm.calibrate import TargetRegistry
from microcosm.data.gate_signing_keys import require_registered_gate_signing_key
from microcosm.frame import Frame

_REPOSITORY = Path(__file__).resolve().parents[6]
Expand Down Expand Up @@ -992,6 +993,7 @@ def resign_uk_gate_report(payload: dict[str, object]) -> None:
raise RuntimeError(f"{env} must be valid base64.") from exc
if len(key) != 32:
raise RuntimeError(f"{env} must decode to exactly 32 bytes.")
require_registered_gate_signing_key("uk", key, purpose="sign")
attestation.pop("signing_error", None)
attestation["signing_key_sha256"] = hashlib.sha256(key).hexdigest()
attestation["signature"] = None
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3604,6 +3604,7 @@ def _national_attempt(
# These checks must precede input loading. The emitter is already
# running so a refusal is visible as a failed attempt.
refuse_occupied_national_output(args)
national_role.require_signing_key()
preflight_staged_dataset(args)
predecessor = resolve_predecessor(args.logbook_prev_row_digest)
telemetry = create_staging_run_bundle(args, build_id=state.build_id)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import numpy as np
import pandas as pd

from microcosm.build.gate_battery import _signing_key
from microcosm.build.logbook_adoption import atomic_write_json
from microcosm.build.staging_dataset import (
SHA256SUMS_FILENAME,
Expand Down Expand Up @@ -62,6 +63,7 @@
"national_dry_run",
"national_manifest",
"require_bound_input",
"require_signing_key",
]


Expand Down Expand Up @@ -126,6 +128,24 @@ def require_bound_input(args: argparse.Namespace) -> None:
_require_bound_input = require_bound_input


def require_signing_key() -> None:
"""Refuse a national build whose gate reports could not be signed.

The seam signs its terminal report only after the solve, so a missing,
malformed or unregistered key used to surface 25-40 minutes in, as
"unsigned full-scale calibration runs refuse to stage". Check it before
any input is read.
"""

try:
_signing_key("uk")
except RuntimeError as error:
raise ValueError(
"--release-role national signs its gate reports and needs a "
f"registered UK gate signing key: {error}"
) from error


def national_dry_run(
args: argparse.Namespace,
*,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,10 @@
uk_cgt_projection_read_from_engine,
)
from microcosm.build.uk_runtime.terminal_gates import uk_export_candidate_columns
from microcosm.data.gate_signing_keys import (
GateSigningKeyError,
require_registered_gate_signing_key,
)

__all__ = [
"UK_RELEASE_CERTIFICATION_KIND",
Expand Down Expand Up @@ -594,7 +598,12 @@ def _require_signing_key() -> bytes:
raise UKReleaseCertificationError(
f"{env_name} must decode to exactly 32 bytes."
)
return key
# The certifier verifies every part and signs the certification with
# this one key, so it must be a registered key that may still sign.
try:
return require_registered_gate_signing_key("uk", key, purpose="sign")
except GateSigningKeyError as exc:
raise UKReleaseCertificationError(f"{env_name}: {exc}") from exc


def _verify_part(
Expand Down
Loading
Loading