Repository navigation
feat: Fence and journal each Device at the site - #180
Conversation
kevwilliams
left a comment
There was a problem hiding this comment.
Hold: a same-fence redelivery can act on the BMC after the first worker stored its result.
Runner.RunchecksResults.Getonly beforeacquire; a copy at the same fence that waits on the lock resumes from the journal once worker 1 ends (e.g. OutcomeUnknown) and sends more steps. A temporary test showedruns=2 sends=2.- Fix: re-check
Results.Getafter taking the lock, or end same-fence waiters whenstopped == fence. - Test: a same-fence copy that waits through the first worker's failure.
5d142ae to
370d02b
Compare
Identify walks the Systems collection and verifies the enrolled System with reads only, and records what it offers without requiring it. Discover is Identify followed by the install and cleanup capability checks, so the existing executor behaves as before. A kind that needs no network boot, such as power, can then verify identity alone. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Add the site framework for Device operations. Each Device has a durable fence store and journal on the site's retained volume. A newer fence stops the older worker before the newer one starts, and the site records that confirmation for the coordinator. The journal records each step and its payload before sending it, refuses steps below the stored fence, and replays a step after a crash by observing it. Before anything is sent, the framework checks the inputs' digest, the site's enrollment against the admitted snapshot, the per-Device credential, the approved TLS pin, and the server's identity. Workers stop at their deadline, and results carry the fence and typed evidence. The coordinator records an undeclared worker reason as UndeclaredReason. It is inert: nothing delivers an assignment to it until the cutover. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Port the Redfish executor's install and wipe phases to the site framework. Power-on is journaled and sent once, and observed after a crash. Boot admissions are served only at the Device's stored fence, so a superseded operation can never boot the server. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Mark Increment B implemented and inert, record where a site stores fences and its journal, and describe the worker contract. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A worker that finds the same assignment already holding the run lock now stores nothing and leaves the result to that worker. Any other refusal is Failed only when the journal holds nothing for the operation. A stored result is final, and a redelivery returns it. A worker stopped from outside stores no result, so its replacement resumes from the journal. The fence is checked again just before each send. The Redfish workers journal each verified phase and skip it on resume, so a worker interrupted in the disk phase continues. Power-off is bounded at five minutes again, and the receipt wait after power-off is 30 seconds, as in the old executor. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A worker stopped from outside while it waits for the run lock now stores no result, like one stopped during its checks or its steps. A resumed phase keeps the time it was first verified. Add tests for each shutdown stage, a lost lock with journaled steps, a fence raised between journal and send, and the power-off bound's reason and timing. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
370d02b to
e4ec436
Compare
|
This branch is rebased onto #178 at 9cf6d32, which closes six admission gaps the power kind found in #179. The head is now e4ec436. B's own commits are unchanged. The one conflict kept B's declared Redfish worker reasons together with #178's new evidence validator, which now receives the operation it checks. A worker result whose reason its kind never declared is still recorded as UndeclaredReason, alongside #178's new rule that a kind can require evidence for a success. The rereviewer approved this exact head. The site, custody, Redfish and discovery tests pass with the race detector. |
kevwilliams
left a comment
There was a problem hiding this comment.
Hold: a same-fence copy that wins the lock after worker 1 ends still acts; Results.Get runs only before acquire.
- At e4ec436,
Runner.Runstill checksResults.Getonce, beforer.acquire; when worker 1 finishes while the copy waits,acquiresucceeds and the copy resumes and sends. TestARedeliveryWhileTheSameOperationRunsStoresNothingcovers a copy that times out while worker 1 still runs, not one that gets the lock after worker 1 stores its result.- Fix: re-check
Results.Getafter acquire, with a test where worker 1 fails mid-wait.
ecv
left a comment
There was a problem hiding this comment.
Request changes.
Agree with kevwilliams's hold, and I reproduced it at e4ec436: a same-fence redelivery that waits for the run lock can act on the BMC after worker 1 has already stored its result.
internal/site/runner.goRunner.RunreadsResults.Getonce, beforer.acquire. With a copy waiting on the lock, worker 1 ending OutcomeUnknown (its first send failed) releases the lock, the copy acquires it, resumes from the journal and runs the kind again. My temporary test with anIdempotentfirst step gaveruns=2 sends=3, and the second run sent a BMC action after the result was recorded.TestARedeliveryWhileTheSameOperationRunsStoresNothingonly covers a copy that times out while worker 1 still runs.- Fix: re-check
Results.Getafteracquireand return the stored result, releasing the lock first. Add a test where worker 1 fails while a same-fence copy waits. - Tamper results (go test ./internal/site/...): dropping the fence re-check before send fails
TestAFenceRaisedBetweenJournalAndSendStopsTheStep; dropping the approved-pin == admitted-key check failsTestPinMismatchSendsNothing; resending a replayed non-idempotent step failsTestAReplayedStepIsObservedNotSentAgain. Those three guards are covered. The post-acquire result check is the one that is not. - Fencing otherwise holds:
Store.IntendWithPayloadandDonerefuse a fence below the stored one under the per-Device lock,Stepre-reads the fence after journaling and beforeSend, andwatchcancels the worker on a newer fence. A step journaled but not done is observed, not resent, unless the kind marks itIdempotent. - Credentials: looked up per Device from labelled Secrets in the site namespace, pin required and equal to the admitted key, and
sanitizekeeps BMC bodies and endpoints out of results. No Secret RBAC is added here. - Stack: base is
feat/device-custody-foundation, head contains #178's head 9cf6d32, and the delta is 23 files (+3336/-43). Validate, standalone-smoke and image builds pass; custody, site, redfishwork, bmcdiscovery and redfish tests pass locally with-timeout 10m.
Follow-ups:
- Fence is per-site store state; cross-site exclusion depends on the coordinator seeing every serving site's
Seenbefore raising it. I did not trace that path in #178's coordinator under a partitioned site. - The discovery Role grants
get, list, watchon all Secrets in the namespace (comment inconfig/base/bmc-discovery/rbac.yamlsays so); the site worker reuses that, so keep it in a dedicated namespace.
A same-fence redelivery checked for a stored result only before it waited for the run lock. If the first worker stored its outcome while the copy waited, the copy took the lock, resumed from the journal and could send to the server again, as a step marked safe to repeat did. The copy now checks again once it holds the lock and returns the stored result without running the kind. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
@kevwilliams @ecv thanks for the hold and the reproduction. Fixed at 9885927. After
The test knows the copy is waiting through an unexported hook that fires on each lock retry, so it needs no sleep. The rule and the test are recorded in the device custody development notes. The two follow-ups, tamper tests for the coordinator's fence confirmation and the Seen-above rule, go into the end-to-end increment stacked on #182 rather than #178, so #178's approved head stays as it is. |
ecv
left a comment
There was a problem hiding this comment.
Approve. The hold is fixed.
Runner.Run now reads Results.Get again after acquire, and returns the stored result to a copy that waited for the lock, instead of resuming from the journal. TestACopyWaitingForTheLockReturnsTheStoredResult covers the reproduced case: the first worker's idempotent send fails and stores OutcomeUnknown, then the waiting copy must return that result, with no second run and no second send. The waiting hook is test-only and unexported.
Follow-ups from the earlier review stand: cross-site fence behaviour under a partitioned site, and the namespace-wide Secret read the site worker reuses.
kevwilliams
left a comment
There was a problem hiding this comment.
Verified Run now re-checks Results.Get after acquire, and TestACopyWaitingForTheLockReturnsTheStoredResult pins one run and one send for a copy that waited through worker 1.
Summary
The site that reaches a server will fence and journal each Device on its own, so an older worker can never act after a newer operation is admitted.
This change adds that site framework, with the Redfish install and wipe workers behind one worker contract. Before anything is sent, the framework checks the per-Device credential, the approved TLS key and the server's identity, and it stops each worker at its deadline.
It is inert until the cutover, and the existing executors keep running the current lifecycle with nothing connecting the two paths.
Decisions
Test plan
Related to #174
🤖 Generated with Claude Code