carlos / platform Public

generation census: hex-encode the image digest at the field write, for the moves copy gate

CI (root package): TestMovesSinksAreSentences and TestMovesStringsAreRecorded
trace every string that reaches a seal's Reason; rootFloorBinary.Digest is one
of them, and fix round 2's `b.Digest, err = rootFloorDigest(ctx, f)` took one
result of a multi-value expression, which the gate cannot prove is a sentence.
rootFloorDigest now returns the raw sum and the hex encode is a single-valued
write to Digest again, as on main. Behaviour unchanged; the census row's sites
and digest and the merge overlay's envelope follow.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
claude agent, operated by paul@keymail.dev 6ce464c45b48b0019e7b819cae3a0e962061eb69 parent c10cdbd
3 files changed, +12 −7
  • internal/host/rootmovesfloor_refresh.go +10 −5
  • internal/provision/testdata/plan14-root-reads-claims-on-gate-recover-merge-main.tsv +1 −1
  • internal/provision/testdata/plan14-root-reads-claims-on-gate-recover.tsv +1 −1

CI passed — run details

diff --git a/internal/host/rootmovesfloor_refresh.go b/internal/host/rootmovesfloor_refresh.go
index 1edffebba..5b080c09c 100644
--- a/internal/host/rootmovesfloor_refresh.go
+++ b/internal/host/rootmovesfloor_refresh.go
@@ -175,9 +175,13 @@ func readRootFloorBinaryContext(ctx context.Context, opt, path string) (rootFloo
if st.Size() > 512<<20 || st.Mode()&0111 == 0 {
return b, os.ErrPermission
}
- if b.Digest, err = rootFloorDigest(ctx, f); err != nil {
+ sum, err := rootFloorDigest(ctx, f)
+ if err != nil {
return b, err
}
+ // One single-valued hex write, as before: the moves copy gate derives the
+ // Digest that reaches a seal's Reason from here (approved_moves_copy_test).
+ b.Digest = hex.EncodeToString(sum)
pub, err := release.ParsePublicKey(os.Getenv("CARLOS_RELEASE_PUBKEY"), "CARLOS_RELEASE_PUBKEY")
if err != nil {
return b, err
@@ -194,13 +198,14 @@ func readRootFloorBinaryContext(ctx context.Context, opt, path string) (rootFloo
return rootFloorSignedIdentity(ctx, pub, b, names, identities.Read)
}
-// rootFloorDigest is the sha256 of an image, read through ctx.
-func rootFloorDigest(ctx context.Context, image io.Reader) (string, error) {
+// rootFloorDigest is the sha256 of an image, read through ctx: the raw sum,
+// which the caller hex-encodes in place.
+func rootFloorDigest(ctx context.Context, image io.Reader) ([]byte, error) {
sum := sha256.New()
if _, err := io.Copy(sum, generationContextReader{ctx: ctx, r: image}); err != nil {
- return "", err
+ return nil, err
}
- return hex.EncodeToString(sum.Sum(nil)), nil
+ return sum.Sum(nil), nil
}
// rootFloorSignedIdentity finds the cached signed identity whose router
diff --git a/internal/provision/testdata/plan14-root-reads-claims-on-gate-recover-merge-main.tsv b/internal/provision/testdata/plan14-root-reads-claims-on-gate-recover-merge-main.tsv
index bbe998de0..e5f2bb08f 100644
--- a/internal/provision/testdata/plan14-root-reads-claims-on-gate-recover-merge-main.tsv
+++ b/internal/provision/testdata/plan14-root-reads-claims-on-gate-recover-merge-main.tsv
@@ -1,2 +1,2 @@
# Census overlay claims-on-gate-recover-merge-main (claims-on-gate-recover merged with main at 521c6ee9: changelog-v0.28.7, securelisten-337, console-invariant-parallel and the rest since 3d444a1b): envelope only. internal/host's envelope is re-pinned over both branches' code; main's overlays load before this branch's, unchanged. No unit, class or read changes; the seal stands at main's.
-@coverage internal/host 7f01cffdcf9d4261d0c067520877968761f36d3877544fc9b5d37f4799cdf31c
+@coverage internal/host fe12f161972b1f74afbb4850717f345cc9bf94ad8244bb6d571d59c2ae70841a
diff --git a/internal/provision/testdata/plan14-root-reads-claims-on-gate-recover.tsv b/internal/provision/testdata/plan14-root-reads-claims-on-gate-recover.tsv
index 54bc67382..0ce4b12c0 100644
--- a/internal/provision/testdata/plan14-root-reads-claims-on-gate-recover.tsv
+++ b/internal/provision/testdata/plan14-root-reads-claims-on-gate-recover.tsv
@@ -27,7 +27,7 @@ internal/host/rootgeneration_services_linux.go generationServiceEnv.recheck auth
internal/host/rootgeneration_services_linux.go generationExeIdentity authority F,J4 rev3=PROPOSED-claims-on-gate-recover;identity=root generation kernel reader uid 0;basis=new unit at its callers' class (deletedProgram's binding and recheck, F,J4): Fstat, Statx(STATX_MNT_ID) and name_to_handle_at of an already open image descriptor, giving the device, inode, mount ID and file handle that bind a task to its proven image; a filesystem without handles gives none (EOPNOTSUPP). rootstate.ObjectIdentity is not used because it resolves the mount in root's own mount table, which a service in a private mount namespace does not share. file:Fstat@97,file:Statx@207 90589ce72ed160c94a5d155157d3f93ea1e9b4850992f2aacfc63dd88e29a828
internal/host/rootmovesfloor_refresh.go generationContextReader.Read authority F,J4 rev3=PROPOSED-claims-on-gate-recover;identity=root generation kernel reader uid 0;basis=moved beside the signed-image proof in fix round 2, same class as its callers deletedProgram and readRootFloorBinaryContext (F,J4): the hash's reader over an already open, already checked image (the deleted image, <opt>/carlos or <opt>/carlos.prev); it stops once the census deadline passes and opens nothing. TestRecoverCensusDeadlineReachesTheInspection. file:Read@127,file:Read@33 d20afc659f08ab69244381b3b677a44e51467ad813b188aeaad1d00c278cf53b
internal/host/rootmovesfloor_refresh.go readRootFloorBinary authority F,J4 rev3=PROPOSED-claims-on-gate-recover;identity=root adopt refresh, root system update/recovery and root guard floor readers, uid 0;basis=re-pinned at its class and task, no read of its own since fix round 2: readRootFloorBinaryContext under context.Background(), for the callers that have no deadline; behaviour unchanged. 8ac4df055cc5f91436f65929bea964152009d120d98e6ee5069a63ed406242e6
-internal/host/rootmovesfloor_refresh.go readRootFloorBinaryContext authority F,J4 rev3=PROPOSED-claims-on-gate-recover;identity=root adopt refresh, root system update/recovery, root guard floor readers and the root generation kernel reader, uid 0;basis=readRootFloorBinary's body at its class (p3: verifies checked executable and signed system manifest; reads signed moves and seeds protocol numbers rather than version sidecar), now under a context: the image hash stops between reads (generationContextReader) and the identity-cache scan stops before each identity (rootFloorSignedIdentity) once the context ends; the reads are p3's. Fix round 2, for the census deadline. TestSignedBinaryProofStopsWhenTheCensusDeadlineEnds (the two helpers), TestRecoverCensusDeadlineReachesTheSignedBinaryProof (the lookup hands the deadline to the proof; the production plumbing from this function into the helpers is not witnessed by a non-root test). file:Open@660,file:Read@925,file:Stat@304 32e5002e5a6cc3ab6fa9b11972b2b24a2cd15c632ec7726d13f1f9537494dc22
+internal/host/rootmovesfloor_refresh.go readRootFloorBinaryContext authority F,J4 rev3=PROPOSED-claims-on-gate-recover;identity=root adopt refresh, root system update/recovery, root guard floor readers and the root generation kernel reader, uid 0;basis=readRootFloorBinary's body at its class (p3: verifies checked executable and signed system manifest; reads signed moves and seeds protocol numbers rather than version sidecar), now under a context: the image hash stops between reads (generationContextReader) and the identity-cache scan stops before each identity (rootFloorSignedIdentity) once the context ends; the reads are p3's. Fix round 2, for the census deadline. TestSignedBinaryProofStopsWhenTheCensusDeadlineEnds (the two helpers), TestRecoverCensusDeadlineReachesTheSignedBinaryProof (the lookup hands the deadline to the proof; the production plumbing from this function into the helpers is not witnessed by a non-root test). After CI: rootFloorDigest returns the raw sum and the hex encode is one single-valued write to Digest again, so the moves copy gate can derive the digest that reaches a seal's Reason (TestMovesSinksAreSentences, TestMovesStringsAreRecorded). file:Open@846,file:Read@1111,file:Stat@304 92c74898bfc43ac45d774ca766c5b4be474e58ffe60a8ac2737a32655240a304
internal/rootparticipation/ledger.go Ledger.HoldUpdate authority D rev3=PROPOSED-claims-on-gate-recover;identity=root system recover uid 0 (settleWithoutJournal, under the transaction lock);basis=new unit at its siblings' class (Ledger.BeginUpdateWith, Ledger.EndUpdateWith, D): the recovery acquisition barrier. Under the same-ledger transaction exclusion it reads the recovery census and update.json and, when no acquisition is pending and no update record exists, writes root's update record under the deferring transaction's id, so Acquire stays refused while recover defers a census refusal; it runs no census of its own (EndUpdateWith, with its census, still removes the record). Fix round 2 (Astra finding 1b). TestHoldUpdateRefusesAcquisitionsWithoutACensus, TestHoldUpdateLeavesAPendingAcquisitionCensusAlone, TestRecoverHoldsAcquisitionsWhenNoUpdateRecordWasBegun, TestRecoverDoesNotDeferWithoutABarrier. file:Read@319 e5cfaa26ccf5241507b41920d64e1ccf7db2e6435d071a9226246fac1a346645
@coverage internal/host d92e492a30973333e8c6df8a939a347dbb96a30a0e404327737f502232376268
@coverage internal/rootparticipation 6c6d03dec45fe2fca86efc0fcb7615a4ab531c1da0a3a10adab36932d9d81a5a