devbox mode (#474): record-write census (9B8) overlay
devboxModeWriteCensusInventory, layered on fleetPublicRoutesWriteCensusInventory. One re-pin: main.go main (key-site), the `carlos devbox` dispatch, same literals. Five new units, all nonrecord: Links.Put (devbox's own links.json owner store in the service's private data dir) and the registrar's four Links.Put callers (restoreLink, serveShareLive, serveShareFolder, undoUnshare). None names a record key or record path or reaches the deployment bucket; the registrar's other writes go to the box's local registry. Census data only, no behaviour change.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
internal/provision/devbox_mode_census_test.go+75 −0internal/provision/plan9_b8_census_test.go+1 −1
CI failed — run details
Intent
<task-notification> <task-id>a35d03d5506036f88</task-id> <tool-use-id>toolu_01HK2gt7PhybwjUqhgY7G2bL</tool-use-id> <output-file>/home/paulca/.cache/tmp/claude-1001/-home-paulca-amadan-net-carlos-platform/9b370a04-693c-4bda-b2eb-9a4b08f7626d/tasks/a35d03d5506036f88.output</output-file> <status>completed</status> <summary>Agent "Apply approved copy C55-C57" finished</summary> <note>A task-notification fires each time this agent stops with no live background children of its own. The user can send it another message and resume it, so the same task-id may notify more than once.</note> <result>Status: done, committed, not pushed. Commit: 94e57770 (working tree clean). Tests: `go test -run 'TestDevboxCopy' .` passed, and `go test ./internal/docsite` passed. Both only passed with the sandbox disabled, because the Go cache was read-only and the sandbox TMPDIR sits under a `.carlos/config`. Placement: C55 sits under `### carlos devbox` before the example block, and C56 follows the block in `docs/site/cli.md`. C57 is the last paragraph of `infra/devbox/README.md`, after the C52 loopback-ports sentence. The text was read from the deck rows by script, so it is byte-identical. "eg a tailnet" is kept. Concerns: in the deck, C57's text is word for word the same as C56's, including "run both the dev server and carlos devbox share outside the agent's sandbox", so the README agent note is the CLI note repeated. This follows the deck, but you may want to check it was intended. The commit printed a lock warning ("remove the file manually to continue"), but the commit still landed. I left the lock file alone.</result> <usage><subagent_tokens>41477</subagent_tokens><tool_uses>7</tool_uses><duration_ms>48175</duration_ms></usage> </task-notification>
Attributed to this commit: 37.8 g CO₂e (4,854,954 tokens). This is an attribution, not a measurement — usage counted from this commit's own marker forward to the next one on design-devbox-mode, 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/devbox_mode_census_test.go b/internal/provision/devbox_mode_census_test.go| new file mode 100644 |
| index 000000000..5f1c4cc16 |
| --- /dev/null |
| +++ b/internal/provision/devbox_mode_census_test.go |
| @@ -0,0 +1,75 @@ |
| +package provision |
| + |
| +// Record-write census entries for devbox mode (#474, branch |
| +// design-devbox-mode), layered on fleetPublicRoutesWriteCensusInventory |
| +// (main's newest at the branch's base). Reviewed by the branch author |
| +// against the source; the census approval is recorded on #280 with the |
| +// root-read card (docs/superpowers/notes/census-proposal-devbox-mode.md). |
| +// |
| +// One re-pin, no class or kinds change: |
| +// - main.go main (key-site): dispatches the new `carlos devbox` verb |
| +// (case "devbox": runDevbox(args)); its instances and sidecars literals |
| +// are unchanged. It writes no record. |
| +// |
| +// Five new units, all nonrecord. internal/devbox's Links is devbox's own |
| +// owner store: links.json in the devbox service's private data dir |
| +// (runDevboxServe opens dataDir/links.json), written by temp file, fsync, |
| +// rename and directory fsync. It is not an objstore, names no record key |
| +// and no record path, and never reaches the deployment bucket. The |
| +// registrar's other writes are to this box's local registry |
| +// (Registry.UpsertUnlessRootfs, Registry.Delete), which the census does not |
| +// match and which are not records either. |
| +// - internal/devbox/links.go Links.Put: the store's own Put, replacing |
| +// the link of that name in links.json. |
| +// - internal/devbox/registrar.go Registrar.restoreLink: rolls back a |
| +// failed share by Links.Put of the earlier link (or Links.Delete). |
| +// - internal/devbox/registrar.go Registrar.serveShareLive: Links.Put of |
| +// the new live link, then the local registry row. |
| +// - internal/devbox/registrar.go Registrar.serveShareFolder: Links.Put of |
| +// the new folder link, then the snapshot swap and the local registry |
| +// row. |
| +// - internal/devbox/registrar.go Registrar.undoUnshare: puts the link |
| +// back with Links.Put after an unsynced Links.Delete, then the local |
| +// registry row. |
| +func devboxModeWriteCensusInventory() []censusEntry { |
| + entries := append([]censusEntry(nil), fleetPublicRoutesWriteCensusInventory()...) |
| + repins := []censusEntry{ |
| + // devbox mode: the `carlos devbox` dispatch; the same literals. |
| + {"main.go", "main", "key-site", "lit:instances,lit:sidecars", "0b32028ee730fcbd13f135cbcee2d45393c0a42b0b3ed60abf8a4075343f7450"}, |
| + } |
| + 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("devbox-mode re-pin changes the class or kinds of " + r.File + ":" + r.Unit) |
| + } |
| + entries[i], found = r, true |
| + } |
| + } |
| + if !found { |
| + panic("devbox-mode re-pin of an unlisted unit " + r.File + ":" + r.Unit) |
| + } |
| + } |
| + added := []censusEntry{ |
| + // Devbox's own owner store: replaces a link in links.json (temp file, fsync, rename) in the service's private data dir; no record key, no bucket. |
| + {"internal/devbox/links.go", "Links.Put", "nonrecord", "def:Put", "9488356a3202404a9f84eee9a7412c92a6aca1ea93ccf95d7f11510748284b1a"}, |
| + // Rolls a failed share back with Links.Put (or Delete) on devbox's links.json; no record key, no bucket. |
| + {"internal/devbox/registrar.go", "Registrar.restoreLink", "nonrecord", "sel:Put", "75797d1ae897357abe9924c6f1dbedc298970deba926ce1af72693f5de3e6e5b"}, |
| + // Links.Put of a live link in devbox's links.json, then this box's local registry row (UpsertUnlessRootfs); no record key, no bucket. |
| + {"internal/devbox/registrar.go", "Registrar.serveShareLive", "nonrecord", "sel:Put", "a3397fb5e2727304b6fee7ac932960314ec4b3529c73ec7bc8de0eb311287bbb"}, |
| + // Puts the link back in devbox's links.json after an unsynced delete, then the local registry row; no record key, no bucket. |
| + {"internal/devbox/registrar.go", "Registrar.undoUnshare", "nonrecord", "sel:Put", "46544028be2cfac0439ff6a8c35fb702266d609653d382867cc6e0846dc4934f"}, |
| + // Links.Put of a folder link in devbox's links.json, then the spool swap and the local registry row; no record key, no bucket. |
| + {"internal/devbox/registrar.go", "Registrar.serveShareFolder", "nonrecord", "sel:Put", "5997a8533d8b9fac76cedb071a4e26136fb0ad7e927ac7ff35b6a8be90628034"}, |
| + } |
| + for _, a := range added { |
| + for _, e := range entries { |
| + if e.File == a.File && e.Unit == a.Unit { |
| + panic("devbox-mode addition of an already listed unit " + a.File + ":" + a.Unit) |
| + } |
| + } |
| + entries = append(entries, a) |
| + } |
| + return entries |
| +} |
diff --git a/internal/provision/plan9_b8_census_test.go b/internal/provision/plan9_b8_census_test.go| index 893794f4d..ea6ae4205 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 := fleetPublicRoutesWriteCensusInventory() |
| + inventory := devboxModeWriteCensusInventory() |
| 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 ")) |