| 1 | package provision |
| 2 | |
| 3 | // Record-write census entries for pro-6214-service-runs (Linear PRO-6214: |
| 4 | // run-role service credentials, keyed run create; spec |
| 5 | // docs/superpowers/specs/2026-10-24-service-runs-design.md), layered on |
| 6 | // secSidecarCreateGateWriteCensusInventory (main's last at 3d7cbe30). |
| 7 | // Reviewed by the branch author; census-ruling-pro-6214-service-runs, |
| 8 | // approved by Paul (census owner), in session, 2026-10-24, at tip ffe8f40a |
| 9 | // (docs/superpowers/notes/census-proposal-pro-6214-service-runs.md). |
| 10 | // Every unit keeps its class and its site kinds; only digests move, and no |
| 11 | // write site is added, moved to another class or removed. |
| 12 | // - Server.admitRun passes the keyed create's scoped key, request digest |
| 13 | // and caller into RunAdmit, and answers a *RunKeyReplay naming its own |
| 14 | // id as its admission. Still one SetRecordRun (RunAdmit): the key is |
| 15 | // recorded in run_keys by that same compare-and-swap, never by a write |
| 16 | // of its own. record-writer. |
| 17 | // - Server.handleAPIRunAck, Server.handleAPIRunCancel and |
| 18 | // Server.handleAPIRunExpire: refusal codes only (jsonErrorCode); their |
| 19 | // RunClear, RunCancelTransition and RunExpire writes are unchanged, and |
| 20 | // none of them touches run_keys. A run service reaches them only for a |
| 21 | // run its own credential started (runGate, no census site). |
| 22 | // record-writer. |
| 23 | // - Server.auditRunEnd adds a service's run's requester line to the |
| 24 | // run-end activity detail; its one Put, the audited marker under |
| 25 | // runs/<id>/, is unchanged. nonrecord. |
| 26 | // - Server.registerCLIRoutes registers the five run doors with |
| 27 | // svcrole.Exactly(svcrole.Run) instead of svcrole.Set{}, and adds GET |
| 28 | // .../instances/{host}/runs (handleAPIRunKeyLookup, which writes |
| 29 | // nothing). Route lines only. key-site. |
| 30 | // |
| 31 | // provision.RunAdmit, the transition admitRun applies, names no census |
| 32 | // identifier, so it is not a site here; its run_keys change is in the |
| 33 | // root-read overlay plan14-root-reads-pro-6214-service-runs.tsv. |
| 34 | func serviceRunsWriteCensusInventory() []censusEntry { |
| 35 | entries := append([]censusEntry(nil), secSidecarCreateGateWriteCensusInventory()...) |
| 36 | replacements := []censusEntry{ |
| 37 | {"internal/console/apiruns.go", "Server.admitRun", "record-writer", "key:SetRecordRun", "b2d56d70b24aeecbe191fc868a8afb8c2ee4c9eb73371edad17210441e0bd8ce"}, |
| 38 | {"internal/console/apirunsfollow.go", "Server.auditRunEnd", "nonrecord", "sel:Put", "e112ac93c83aebf1325fca43f4d94a257783f5d2f3983b462d8f7c84459297f6"}, |
| 39 | {"internal/console/apirunsfollow.go", "Server.handleAPIRunAck", "record-writer", "key:SetRecordRun", "2680a0bb0550b3c4811487dfffb8ec56ec9c381085d67ef4b6af0e3b17035587"}, |
| 40 | {"internal/console/apirunsfollow.go", "Server.handleAPIRunCancel", "record-writer", "key:SetRecordRun", "4a7f3b95ccdffb9c868d92a368036fb7af8115972ea060c0949f065c27f93581"}, |
| 41 | {"internal/console/apirunsfollow.go", "Server.handleAPIRunExpire", "record-writer", "key:SetRecordRun", "fd67215764cf8c0ae94a240f2637fd126e79675bd17ab72603cb43e7b7ba7277"}, |
| 42 | {"internal/console/authcli.go", "Server.registerCLIRoutes", "key-site", "lit:instances,lit:sidecars", "12e06989835b4de0d1fc2e8082cb2f62d1e961b689a61c886d6e201ac350285f"}, |
| 43 | } |
| 44 | for _, r := range replacements { |
| 45 | found := false |
| 46 | for i, e := range entries { |
| 47 | if e.File == r.File && e.Unit == r.Unit { |
| 48 | entries[i], found = r, true |
| 49 | } |
| 50 | } |
| 51 | if !found { |
| 52 | entries = append(entries, r) |
| 53 | } |
| 54 | } |
| 55 | return entries |
| 56 | } |
| 57 | |