make key-mint drops a removed key's state entry before the mint (SL-23) #24
No reviewers
Labels
No labels
needs-info
needs-triage
ready-for-agent
ready-for-human
review
merge-ready
review
needs-fix
review
needs-human
review
needs-operator
review
needs-review
review
waiting
wayfinder:grilling
wayfinder:map
wayfinder:prototype
wayfinder:research
wayfinder:task
wontfix
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
olympus/infra-silo!24
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "hermes/23-stale-key-state"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Addresses SL-23:
make store-planshows two updates on the tracker deploy keys.Summary
The cause, measured and recorded on SL-23: SC-15's two deploy keys were created by
make store, which wrotesecret_key_wo_version = 1into their state entries. They were then removed and re-created by hand under the same access keys, and the old entries stayed. The provider's read never clears that field, somake store-planreads2 to change, each onesecret_key_wo_version -> null. The 19 keys that were imported hold null and plan clean.make key-mintleft the same diff on the path its own refusal recommends: remove an implied key, then run the mint again with the same pair. On that second run the address was already in the state, so it imported nothing.The stale entry is dropped before the create, so a run that stops at any point leaves nothing behind for the re-run to miss. Dropping it after the create would leave it in place if the run died between the two steps, because the re-run then sees the key as existing.
Runbook 0003 §7 gets one paragraph on this, with the commands for a key re-created by hand outside the Target:
state rm,import,store-plan.Evidence
main'sscripts/key-mint.sh, the newrecreatedcase inscripts/tests/key-mint.test.shfails 5 checks: nostate rm, no import, nore-adoptedline, and both order checks fail (key-mint-test: 5 case(s) failed).After:
mise exec -- make key-mint-testprintskey-mint-test: every case passed. That includes:the entry is dropped before the key is mintedand the key is minted before it is importedan entry for a key the store holds is kepta mint with no entry in the state drops nothingmise exec -- make checkexits 0: env-test, key-audit-test and key-mint-test all pass, and validate printsSuccess! The configuration is valid.make fmtleavesgit status --porcelainempty.make store-planonmainreadsPlan: 0 to add, 2 to change, 0 to destroyon the twotofu-deploy-state-tracker-*addresses. Nothing else changes.Not in this PR: the live fix for those two entries (state backup,
state rmandimportof both, thenmake store-planto No changes,make key-audit, and both deploy pairs checked against their record and the two records they must be refused on). That needs the Operator's go-ahead and runs after review. Its results go on SL-23.Merge Danger
Door: two-way. A revert restores the old import logic; no state or store is touched by the merge.
Blast Radius:
make key-mint.The Target can now run
tofu state rmon its own. It does so only when the store says it has no key under the supplied access key while the state still has the address. A transientinfofailure would also take that path. The create then fails too, and the re-run imports the key again. The merge itself changes nothing on PROD:key-mintis the Operator's Target and runs only when called.Review started (round 1/5) on
cf535f59ac— reading the diff now.repo olympus/infra-silo · PR #24 · head
cf535f59ac· round 1/5 (the thread carries no earlier review; the dispatch also said 1/5) · verdict: mergeRecommendation: merge
Spec source. The PR body (it names SL-23). I tried to read the ticket itself:
fetch-vikunja-task.sh 7 23answeredlist http=401—missing, malformed, expired or otherwise invalid token provided— so the SL-23 acceptance criteria were not read. The body's stated behaviour is the contract here:make key-mintdrops a removed key's state entry before the mint, imports after, printsre-adopted, and runbook 0003 §7 gains the by-hand commands. Its live-fix half is declared out of this PR.Standards source.
AGENTS.md(§Code comments, §Toolchain, §Pull requests, §Docs),docs/agents/workflow.md. Org ADRs inolympus/workshopwere not needed: nothing here touches who approves, credentials, or protectedmain.Delta: the whole PR,
f8b529e..cf535f5(3 files, +78/-27); base is currentmain.Standards
No BLOCKER, no ADVISORY.
AGENTS.md): the body namesSL-23. Met.mise exec -- make checkat head exits 0 (env-test, key-audit-test, key-mint-test, fmt-check, validate: "Success! The configuration is valid."). Forge CI run oncf535f5: success.expect_orderreplaces a hand-rolled create/import order check and is reused for the new case, so it removes duplication rather than adding it.Spec
1. ADVISORY —
scripts/key-mint.sh:119-134: the state entry is dropped on an inferred "removed", never read.The
elsebranch runs on any non-zeroinfo(stderr is sent to/dev/nullat :119), and the drop at :132-134 tests only that the address is in the state. The comment at :129 and the runbook (docs/runbooks/0003-the-state-in-the-store.md:449-459) both say the entry belongs to "a key the store no longer holds"; the code never looks at the entry's own access key. I drove it: stub store where the key is live and in the state,infotimes out. Result:state rmran,accesskey createwas refused ("key already exists"), exit 1, and the state no longer held the address. The error line says nothing about the dropped entry. The re-run (store answering) went throughexists→importand restored the entry (rc=0 held=yes). So it is recoverable and the PR body discloses the transient-infopath — hence not a blocker.Smallest improvement: tell a "no such key" answer from any other
infofailure before thestate rm, or print a line when a run that dropped an entry then fails. Read from the code, not driven: the same inference covers a run with a different access key than the entry holds — the entry for the still-live old key would be dropped and the new key imported in its place.Confirmed against the claims (all reproduced by my hand, scripts and outputs in
cache/scratch/silo-24-r1/):make key-mint-testpasses at headevery case passed(84 ok lines)make checkexits 0key-mint.sh+ head test fails 5 checkskey-mint-test: 5 case(s) failed— the five the body lists (nostate rm, no import, nore-adopted, both order checks)recreatedcase can failstate rm→ 4 reds;state rmmoved after the create → 1 red (the order check);state rmunconditional → 1 red (a mint with no entry in the state drops nothing);state rmbefore theinfocheck → 3 reds (an entry for a key the store holds is keptamong them); drop there-adoptedprint → 1 red; delete the import → 6 reds. No mutant survived.init/state rmnow run before the create (:131-135vs:138), so a failinginitaborts before anything is minted; onmainthe onlyinitsat after the createan entry for a key the store holds is kept(mutantrm-always-firstturns it red); the recovery re-run above also ends inexistsrmstatesilo/store/variables.tfdeclarestfstatewithversioning = truekey-mint.sh:116/ :157Named, not charged
make store-planreading2 to changeonmain: the body declares it out of this PR; not reproduced (needs the store's credential).secret_key_wo_version; an import sets it null") is the body's own measurement on SL-23, which I could not read; it is consistent with the comment atsilo/store/state-keys.tf("an imported key sends nothing"). Unverified by me.scripts/key-mint.sh:129-130is within the file's existing comment density;AGENTS.md§Code comments asks for a minimum, and I did not count it.Summary
info, not read from the entry (scripts/key-mint.sh:119-134)0 BLOCKER, 1 ADVISORY. State follows blockers only: APPROVED; label
review/merge-ready. Merge-time danger the body already names (the Target can nowstate rmby itself) is two-way and bounded by the re-run recovery I drove above.cf535f59ac62e6a508e8New commits pushed, approval review dismissed automatically according to repository settings
Review started (round 1/5) on
62e6a508e8— reading the diff now.repo olympus/infra-silo · PR #24 · head
62e6a508e8· round 2/5 by the thread (one review posted, round=1/5 atcf535f5; the dispatch said 1/5, its counter restarted when the label moved) · verdict: mergeRecommendation: merge
One reviewer held both axes (no sub-agent runner); the sections are kept apart and not reranked.
What this round is. A rebase, nothing else. The prior head
cf535f5is not an ancestor of62e6a50(history rewritten ontomain58818b3, where !25 / SC-16 had merged).git range-diff f8b529e..cf535f5 58818b3..62e6a50answers=for both commits, so the patch is identical. Blob ids at the two heads:scripts/key-mint.sh7740173=7740173,scripts/tests/key-mint.test.sh743122b=743122b. The runbook blob differs (8c34d7fvs331ef5b) only because !25 edited that page; its addition is the same 21 lines (git diff --stat 58818b3 62e6a50and the round-1 stat agree). The fixed point iscf535f5; the round's own delta is empty, and the base's files (README, runbooks 0001/0003, three deploy-state policy files,silo/store/variables.tf) are !25's to answer for. Currency: the PR'sbase.shaequalsgit ls-remote origin refs/heads/main(58818b3);git merge-tree --write-tree origin/main <head>exits 0.Prior findings. Round 1 had 0 BLOCKER and 1 ADVISORY. The advisory stands unchanged (Spec §1 below). Round 1's
could not verifyline, that the SL-23 ticket could not be read, is retired:fetch-vikunja-task.sh 7 23answerstask id=302 http=200this time (the profile key still gets 401; the shared key gets 200), and the ticket and its two comments were read.Spec source. SL-23 (Vikunja task 302), read live, plus the PR body. Its acceptance criteria against this PR, which carries the code and runbook half only:
secret_key_wo_version = 1, the 19 imported keys null).make store-planreads No changesmake key-auditstill 0 failingdocs/runbooks/0003-the-state-in-the-store.md:457onward, under## 7, withstate rm,import,store-plan.Standards source.
AGENTS.mdat the head worktree (§Code comments, §Toolchain, §Pull requests, §Docs),docs/agents/workflow.md. Org ADRs inolympus/workshop: not needed, the change touches no approval rule, credential path or protected-mainrule.Standards
No BLOCKER, no ADVISORY.
mise exec -- make checkat the head worktree exits 0 (84oklines inkey-mint-test:key-mint-test: every case passed). Forge CIpr-checks / check (pull_request)issuccesson62e6a50.SL-23. Met.expect_order(scripts/tests/key-mint.test.sh:53) replaces a hand-rolled create/import order check and is reused at :283, :392 and :393.Spec
1. ADVISORY (carried from round 1, unchanged by this delta) —
scripts/key-mint.sh:119-134: the state entry is dropped on an inferred "removed", never read.The
elsebranch at :128 runs on any non-zeroinfo(stderr is discarded at :119), and :132-134 tests only that the address is in the state. The comment at :129 and the runbook (docs/runbooks/0003-the-state-in-the-store.md:457-466) both call the entry a removed key's; the code never checks the entry's own access key. Re-driven at this head (cache/scratch/silo-24-r2/wave2.sh): stub store with the key live and in the state,infotiming out. Result:state rmran,accesskey createwas refused ("key already exists"),rc=1 held=no, and the error line does not mention the dropped entry. The re-run with the store answering went throughexists→importand endedrc=0 held=yes. It is recoverable, and the body's Merge Danger section discloses the transient-infopath, so it is not a blocker.Smallest improvement: tell a "no such key" answer from any other
infofailure before thestate rm, or print a line when a run that dropped an entry then fails.Confirmed at this head, by my hand (scripts and outputs in
cache/scratch/silo-24-r2/):make key-mint-testpassesevery case passed(84 ok lines)make checkexits 0key-mint.sh(origin/main) with the head test failskey-mint-test: 5 case(s) failed, matching the body's fivemain's test passesrecreatedcase can failstate rm→ 4 reds;state rmafter the create → 1 red (order);state rmunconditional → 1 red (a mint with no entry in the state drops nothing);state rmbefore theinfocheck → 3 reds; drop there-adoptedprint → 1 red; delete the import → 6 reds. No mutant survived. One mutant (import before create) was VOID, its sed missed, as in round 1; the order check is covered by thestate rmafter-create mutant and the import-deleted mutant.scripts/key-mint.sh:116, :157).Named, not charged
make store-planreading2 to changeonmain. SL-23's second comment says the livestate rmandimportalready ran on the Operator's go-ahead, and that a fullmake store-planwaited on SC-16 (now merged). No code or page moves; it is the record the ticket carries now. Not counted.key-mint.shitself is beyond the ticket's "What to build", which asks only for the runbook paragraph where the cause is procedural. The title and body disclose it and the ticket's own comment calls the PR approved. Not charged.secret_key_wo_version; an import leaves it null) is the ticket's recorded measurement (provider v3.45.0minioReadServiceAccount). I read the ticket's account of it, not the provider source.scripts/key-mint.sh:129-130is within the file's existing density;AGENTS.md§Code comments asks for a minimum. Byte-identical to round 1.Summary
info, not read from the entry (scripts/key-mint.sh:119-134)0 BLOCKER, 1 counted ADVISORY, so state
APPROVED,Recommendation: merge, labelreview/merge-ready. The count is under three; the volume rule does not fire.