Skip to content

v2 surface migration plan: retire frozen ledger-named machine surfaces #143

Open

Description

@MaxGhenis

The 2026-08-07 rename (PR #142) deliberately froze every machine surface at its v1 ledger-named form. This issue scopes the deliberate v2 migration:

  • Schema ids: ledger.bundle*.v1, ledger.build_artifact.v1, ledger.consumer_fact.v1, ledger.relational.v1, policyengine_ledger.{consumer_artifact,target_profile,resolved_target,approved_agents}.v1
  • Fact-identity hash domains (ledger.*.v2) — renaming changes every fact hash; needs an explicit identity-migration story (dual-hash window or v3 domains) coordinated with the witnessed journal
  • R2 buckets ledger-raw/ledger-derived and storage.r2 manifest keys; ledger.db artifact filename
  • Supabase schema "ledger", mirror tables/columns (ledger_builds, ledger_source_status)
  • Governance role ids (ledger-*) and concept authorities (ledger-us)
  • POLICYENGINE_LEDGER_* / LEDGER_* env names (dual-read fallback)
  • CLI ledger alias retirement after consumers migrate (María's publish flow, microcosm build scripts)
  • codex/thesis-ledger-facts branch + thesis witness machinery (Thesis session owns the canonical-URL PR)
  • thesisinstitute.org /ledger app dir + journal data paths (deferred with the witness machinery)

Activity

  1. MaxGhenis commented on Aug 20, 2026

    @MaxGhenis
    ContributorAuthor

    Migration spec: three mechanisms, strict order

    Each frozen surface is load-bearing in one of three different ways, so this is three migrations, not one rename. Historical bytes migrate nowhere under any of them — witnessed history keeping ledger-era names is a feature, the same way the immutable releases/README.md is: the record shows what things were called when they were recorded.

    1. Fact identity — migrate by epoch, never in place

    The hash domains (ledger.aggregate_fact.v2, ledger.semantic_fact.v2, assertion ids av2:) sit inside every fact key, golden, witnessed row, and registered-target binding. Renaming in place invalidates all of them simultaneously; the correct move is the av1→av2 precedent:

    • Introduce chronicle.*.v3 domains for newly emitted facts at a declared cutover release.
    • Dual-domain acceptance in every validator, landed in lockstep before the cutover: chronicle build/load, microcosm require_pins row validation, the brier append gate (which recomputes keys byte-identically with the chronicle side — both move together or neither), and the vidimus append_gate/release_chain spec pins. The vidimus change requires a pins update plus a fresh byte-equivalence re-proof at chronicle's then-current pin, per the standing rule in the shims.
    • ledger.*.v2 hashes stay valid as history forever. No golden regenerates; no witnessed row rewrites. Consumers distinguish era by domain prefix, which is the point.
    • Schema ids (ledger.bundle*.v1, ledger.consumer_fact.v1, …) ride the same mechanism: v2 schema ids are chronicle-named, v1 stays parseable, emit flips at cutover.

    2. The journal — migrate by witnessed continuation

    The codex/thesis-ledger-facts branch, journal data paths, and pin bindings can move only the way the journal itself moves: append-forward, witnessed.

    • Rename the branch (GitHub preserves history and redirects); cut a genesis-style release manifest attesting continuation at the new name — and, once Anchor witnessed release manifests in Bitcoin via OpenTimestamps #182/Schedule daily OpenTimestamps anchoring of the witnessed journal #183 land, anchor that continuation release via OTS as well as the TSA pair.
    • Repoint the brier pin and the site in lockstep. The pin validator accepts the historical branch string for historical v3 registration snapshots — their contract hashes contain thesis-ledger-facts and remain true statements about the past — and requires the new name from the continuation release forward.
    • Thesis session owns the canonical-URL and witness-pin halves (already noted in the issue body); coordinate the cutover release with them so both land in one witnessed step.

    3. Operational stores — migrate by dual-run

    R2 buckets, ledger.db, the Supabase "ledger" schema and mirror tables, env names, role ids, concept authorities: new chronicle-named homes for new writes, backfill, repoint consumers, retire the old — with one hard exception: archived witness records pin raw R2 URLs by hash. ledger-raw/ledger-derived go read-only-preserved forever; nothing archived is rewritten or moved. Env names get a dual-read window (CHRONICLE_* preferred, LEDGER_* honored with a deprecation warning) so María's publish flow and the microcosm build scripts migrate on their own schedule; the CLI ledger alias retires last, after both are confirmed off it.

    Sequencing and gates

    Epoch (1) first — it unblocks nothing else but touches the most validators, so it wants the longest bake. Journal continuation (2) second, as a single witnessed step. Infra (3) third, piecewise and boring. Each phase behind the existing gates: dual-domain validators land with adversarial tests before any emit flips; the continuation release is judged by the append gate like any other; vidimus equivalence re-proof precedes the consumption bump.

    Out of scope, deliberately: microcosm-dynamics (its own repin ceremony, microcosm-dynamics#373, dynamics lane owns it — "ledger" there is generic vocabulary inside registered keys); all committed goldens, fixtures, and recorded traces; anything under releases/ (byte-immutable post-genesis).

    Open context worth tracking alongside: residuals R2/R5/R9 from the July hardening reviews (feed-dir publication, typed periods on US-fiscal paths, allowedHosts provenance), and Thesis's USAspending contract-controls-outcome fix, which must land before any registration references those templates.

  2. MaxGhenis commented on Sep 2, 2026

    @MaxGhenis
    ContributorAuthor

    Execution started 2026-09-02, per the three-mechanism spec above. Three PRs are in preparation and will link back here:

    • Mechanism 1, step 1 (this repo): dual-domain acceptance — chronicle-era hash domains (chronicle.*.v3) and chronicle-named schema ids accepted by every reader/validator, emit unchanged. The emit flip is a later PR gated on the consumer validators.
    • Mechanism 3, slice 1 (this repo): CHRONICLE_* env names with LEDGER_* fallback and deprecation warning, chronicle.db for new suite outputs (ledger.db still read), R2 bucket names configurable with defaults unchanged, plus a documented bucket-cutover checklist. Supabase schema/table names and the ledger CLI alias stay for later slices.
    • Consumer side (PolicyEngine/microcosm): accept both consumer-artifact schema ids and both key epochs; CHRONICLE_* env names.

    Gates that are not code:

  3. MaxGhenis commented on Sep 2, 2026

    @MaxGhenis
    ContributorAuthor

    Mechanism 3 progress (2026-09-02): chronicle-raw and chronicle-derived now exist on the pinned account. Backfill of ledger-raw → chronicle-raw is complete: all 156 manifest-declared raw objects are present in the new bucket at their recorded keys, each verified against the sha256 in the key, with a hash-verified readback. Twelve of them had never been uploaded to ledger-raw at all despite manifests recording a URI there; they were recovered from publishers (8, byte-exact) or tracked repo copies (4) and written to both buckets at the recorded keys, so nothing archived was rewritten and the recorded URIs are now true. Details and the three follow-ups (R2-verify in inventory, IRS re-publication of the 2022 IRA tables, OBR blocking unattended fetch) are in #225.

    ledger-derived cannot be enumerated with the current tooling (no object-list command in wrangler; remote dev needs a workers.dev subdomain on the account), so its dual-run starts with new writes only; backfill follows once listing is possible. Bucket defaults stay on ledger-* until the slice-1 PR lands and the consumers repoint.

  4. added a commit that references this issue on Sep 4, 2026
  5. juaristi22 commented on Sep 7, 2026

    @juaristi22
    Collaborator

    Consumer side, mechanism 1 step 1 (2026-09-07): PolicyEngine/microcosm#849 merged to main (396df96f), rebased onto current main with CI green (23/23).

    What landed:

    • Consumer-artifact manifests load under every id a producer stamps: Microcosm's own minted policyengine_ledger.consumer_artifact.v1, the policyengine_ledger.consumer_artifact.v2 Chronicle emits today, and policyengine_chronicle.consumer_artifact.v3 after the flip. Per-row ledger.consumer_fact.v1 / chronicle.consumer_fact.v2 alike. Only the manifest id is gated; row ids and fact keys are carried as published.
    • The declared identity table (microcosm.build.chronicle_epoch) matches chronicle/epoch.py from Epoch prep: accept chronicle-era fact domains and schema ids; emit unchanged (#143, mechanism 1) #228 pair for pair. Provenance and the UK run's build record now witness which era resolved the targets (schema_epoch, fact_key_epochs, undeclared_fact_key_domains, fact_schema_versions); an undeclared chronicle.* spelling is reported, never counted as an era.
    • Verified on the real UK feed (128,717 rows, v2 manifest): loads on the branch, refused on main, no undeclared domains.
    • The env half reduces to nothing on this side: Microcosm reads no Chronicle env names and never invoked the ledger CLI. The only ledger-named variables were the Logbook store's POPULACE_LEDGER_*, which the branch moves to LOGBOOK_* (microcosm#632), per the correction on #849.

    Next: the emit-flip PR, gated on #849 merging and on the Thesis-side validators — the pin scripts compare the journal branch string and bytes rather than fact keys, so the brier append-gate half of that gate still needs its dual acceptance confirmed. #226 (mechanism 3, slice 1) awaits re-gate. Mechanism 2's gates are met (#182/#183 closed, OTS proofs 0000–0019 committed, daily anchor green) but the continuation release is not cut. Supabase schema and mirror tables, governance role ids, and the ledger CLI alias are untouched.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions