census: re-pin putManifestAt and registerCLIRoutes for #522
The record-write census rejected two reviewed digests. Reviewed both: putManifestAt writes the same key through the same Put at the caller's etag and now also returns the bytes it wrote (for the receipt's version); registerCLIRoutes gains one read-only route, GET config/ effective. Neither writes anything new; classes and kinds unchanged. Re-pinned in a config-receipts layer over the stateless-replicas inventory, which TestPlan9B8RecordWriteCensus now reads.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2 files changed,
+42
−1
internal/provision/config_receipts_census_test.go+41 −0internal/provision/plan9_b8_census_test.go+1 −1
CI passed — run details
Intent
Attributed to this commit: 7.17 g CO₂e (911,328 tokens). This is an attribution, not a measurement — usage counted from this commit's own marker forward to the next one on config-receipts-1, never backward from it. A turn that produced more than one commit books all of its tokens to the last one, and a concurrent session on this branch can add to the same figure. Some of it was priced using the shared default rate, because no model-specific factor row exists yet for at least one model involved. The Carbon view has the repo total, which is never derived from this attribution.
diff --git a/internal/provision/config_receipts_census_test.go b/internal/provision/config_receipts_census_test.go| new file mode 100644 |
| index 000000000..9d32ae1b8 |
| --- /dev/null |
| +++ b/internal/provision/config_receipts_census_test.go |
| @@ -0,0 +1,41 @@ |
| +package provision |
| + |
| +// Record-write census re-pins for config versions, digests, conditional |
| +// writes and receipts (#522 plan 1, branch config-receipts-1), layered on |
| +// statelessReplicasWriteCensusInventory (main's newest at the merge base |
| +// 5394c7f9). Reviewed by the branch author against the source; census |
| +// approval on #280. No record write is added, moved or reclassified, and |
| +// neither unit writes anything new: |
| +// - putManifestAt (appconfig): still the ONE write of a config manifest, |
| +// to the same key, through the same s.Put at the caller's etag (the same |
| +// CAS; "" still create-only). It now also returns the bytes it wrote, so |
| +// a receipt's version is the hash of exactly those bytes rather than of |
| +// a second read. Same kind, sel:Put: nonrecord. |
| +// - Server.registerCLIRoutes: one new read-only route, GET |
| +// /api/cli/apps/{account}/{app}/config/effective (handleAPIConfigEffective, |
| +// apiconfigeffective.go), a plain cliRoute so a team credential is |
| +// refused. It reads the app's instance record and config layers and |
| +// writes nothing. The instances and sidecars literals are unchanged: |
| +// still key-site. |
| +func configReceiptsWriteCensusInventory() []censusEntry { |
| + entries := append([]censusEntry(nil), statelessReplicasWriteCensusInventory()...) |
| + repins := []censusEntry{ |
| + {"internal/appconfig/store.go", "putManifestAt", "nonrecord", "sel:Put", "af054838199c3095672e6d04d779341e64e4a01673be2d85b5a046a9ab95eacb"}, |
| + {"internal/console/authcli.go", "Server.registerCLIRoutes", "key-site", "lit:instances,lit:sidecars", "d5c9a91cf5d5938f13c25041dc10e2cc69cbd90f6327b1fe1ea6100a0624a299"}, |
| + } |
| + for _, r := range repins { |
| + found := false |
| + for i, e := range entries { |
| + if e.File == r.File && e.Unit == r.Unit { |
| + if e.Class != r.Class || e.Kinds != r.Kinds { |
| + panic("config-receipts re-pin changes the class or kinds of " + r.File + ":" + r.Unit) |
| + } |
| + entries[i], found = r, true |
| + } |
| + } |
| + if !found { |
| + panic("config-receipts re-pin of an unlisted unit " + r.File + ":" + r.Unit) |
| + } |
| + } |
| + return entries |
| +} |
diff --git a/internal/provision/plan9_b8_census_test.go b/internal/provision/plan9_b8_census_test.go| index dcd3668c9..62bfb1115 100644 |
| --- a/internal/provision/plan9_b8_census_test.go |
| +++ b/internal/provision/plan9_b8_census_test.go |
| @@ -366,7 +366,7 @@ func TestPlan9B8RecordWriteCensus(t *testing.T) { |
| if len(got) < 100 { |
| t.Fatalf("census found only %d units under %s; the walk is broken", len(got), root) |
| } |
| - inventory := statelessReplicasWriteCensusInventory() |
| + inventory := configReceiptsWriteCensusInventory() |
| problems := append(censusDiff(inventory, got), censusPolicy(inventory)...) |
| if len(problems) > 0 { |
| t.Fatalf("record-write census rejected %d site(s); update the explicit inventory only after reviewing the source:\n %s", len(problems), strings.Join(problems, "\n ")) |