Repository navigation
feat(ui): Add staff power control to Device page - #191
Merged
Merged
Conversation
scotwells
force-pushed
the
feat/device-power-kind
branch
from
November 25, 2026 17:44
c036142 to
f93a539
Compare
scotwells
force-pushed
the
feat/device-power-ui
branch
from
November 25, 2026 18:24
662d262 to
4325eb9
Compare
Power admission reads which ComputerSystem.Reset types each System offers. This adds that field to the observed System in Device status, in the Go type and the CRD schema, so the power kind compiles and its tests can record the field. Nothing writes it here: BMC discovery starts recording it in a separate change. Until then the field is absent and power refuses every action as not offered. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
TestAddingRowsLeavesExistingRowsAlone compared rows with reflect.DeepEqual, which never finds two non-nil functions equal. A row that sets its own Name rule, the per-row naming seam, therefore failed the test even when nothing changed. Compare Name by identity and the rest of the row as before. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Power is the first real kind on the custody foundation. Staff and the Fleet provider for Metal can request one power action, and the coordinator decides whether it may run, without any change to the coordinator itself. The kind registers its inputs and their digest, an 8-minute deadline, and the two power rows of the operations table. Staff rows use the kind's generated names; the provider row names its operations from the allocation and the Machine generation. Only an operation the provider row admits replaces an older pending one for its allocation. Its admission checks refuse a staff request for a Device with no recorded system UUID or a different one, discovery that did not read the current BMC within twice the discovery interval, and an action the BMC does not offer, each with a declared reason. The snapshot records what the reset-type check read. A power success settles only a power hold, after a Retry. A Settle needs discovery read after the operation ended, at the current BMC endpoint, showing On or Off. Result evidence is typed and bounded in the CRD, required for a success, and checked against the action. A staff power operator role creates only power operations and does not read allocations; a power requester role is the provider's. Nothing wires the kind into a root, and no worker runs it. Implements step P1 of #173 on #174's foundation. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The custody guide gains a short power section: what P1 implements and leaves inert, and the decisions behind its inputs, names, rows, checks, replacement, settle rule, evidence and roles. It lists two places where the foundation still does not fit power: a kind check cannot make a queued operation wait, and the evidence hook does not see the result's phase. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The cutover ships the device-operations component in the Milo roots and its CRDs in standalone, so the power kind now ships with them. Each place that names the operation kinds must name power too, or a power operation's creator goes unchecked and the coordinator cannot list the kind it registers. The creator webhook and standalone's creator policy now govern DevicePowerOperation. The standalone and multi-plane coordinators may read, delete and update the status of power operations, and the multi-plane harness reads them with the other custody records. The standalone smoke expects the CRD fresh and refuses consumer access to it. TestEveryOperationKindIsGoverned requires the webhook's resource list, the packaged webhook and the standalone policy to name every operation kind the CRDs define. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
scotwells
force-pushed
the
feat/device-power-kind
branch
from
November 26, 2026 00:55
f93a539 to
c6dcaa8
Compare
Staff can power a Device on or off, or reset it, from its page. The control creates a staff DevicePowerOperation with a generated name, the caller from a SelfSubjectReview as creator, the Device by name and UID, the reason as the service request, and the recorded system UUID. It offers only the actions discovery lists for the System with that UUID, and destructive actions ask again, naming the server. The button is hidden without create permission on devicepoweroperations. It is disabled, with the reason as its tooltip, when the records show the coordinator would refuse: discovery cannot support the request, identity is not matched, the BMC key is unread or shared, or custody shows the Device allocated, held, busy, retired or unverified. A create whose outcome is unknown after sending keeps the control off until the page is reopened, because a second POST would be a second operation. Session, navigation and Device changes close an open request, as in the location editor. The header shows the observed power state and the latest operation's progress. A new Operations tab lists recent power operations with their result, power before and after, creator and reason. Operations and custody are polled, and keep polling after a failed read. Fixture builds carry synthetic custody and history. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
scotwells
force-pushed
the
feat/device-power-ui
branch
from
November 26, 2026 01:09
4325eb9 to
1134378
Compare
The Device custody refactor keeps object UIDs out of every spec. The Device incarnation is now the fleet.datumapis.com/device-uid label on an operation and on custody, and custody names an operation by kind, name and the fence recorded in its status.admission. The power request now sends the Device's UID as that label and the Device by name only; the creator stays the one UID in the spec. The page lists a Device's power operations with a selector on the label instead of reading every operation in the namespace, and keeps custody only when its label is the Device's UID. A recovery hold is shown only on the operation admitted at the hold's fence, so a same-name operation created later is never shown as held. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
scotwells
force-pushed
the
feat/device-power-kind
branch
6 times, most recently
from
November 29, 2026 02:26
4b0e723 to
cf80de8
Compare
Base automatically changed from
feat/device-power-kind
to
feat/manual-inventory-records
November 29, 2026 03:16
scotwells
marked this pull request as ready for review
November 29, 2026 19:32
ecv
approved these changes
Nov 29, 2026
ecv
left a comment
Contributor
There was a problem hiding this comment.
Approve.
The page is a thin client over the coordinator's admission: confirmation, targeting and session handling are sound, and authorization is enforced on staging, not only in the UI. No power action can be sent without the second step except Power on.
- Confirmation: Force off, Force restart and Power cycle take a reason, then a second "Continue", then a danger button that reads " ".
device-power.test.tsxcovers "asks again before %s, naming the server", Back not sending, and a reason being required. Power on sends directly, which fits an action that stops nothing. - Authorization: the control is hidden unless a SelfSubjectAccessReview allows
createondevicepoweroperations. That is a display check only. The enforcement on staging is thepower-operatorrole, which grants only that create, and the creator webhook (creatorwebhook/handler.go:96-97), which denies aspec.creatorthat is not the authenticated caller's username and UID. The page cannot forge a creator. - Wrong device: the request carries the Device name, its UID as the
device-uidlabel, andexpectedSystemUUIDfrom the recorded system UUID. Custody refuses any operation whosedevice-uiddoes not match the current Device, and checksexpectedSystemUUIDfor staff service requests such as this page sends, so a Device recreated under the same name is refused. History is selected by the UID label and re-filtered by name, with tests for another Device of the same name and for an unlabelled operation. An open dialog is closed when the Device's UID or resource version, or the session, changes. - Retry safety: the name is generated, so the page never re-sends after an unconfirmed create; it disables the control until the Device page is reopened, and says "Outcome unknown. Check Operations". A reopened page re-enables it once operations are read, which is a weak guard if the first create is still in flight; the coordinator's custody check is the real one.
Follow-ups:
- The confirmation names the server by
displayName, which is free text and need not be unique. The record name and system UUID appear only in a hover tooltip. Show the record name in the confirmation text for destructive actions. - The
power-requesterrole (the Metal provider's) also grantscreate, so that identity would see the Power button if it opened the page. Gate the control on the staff role alone, or confirm the provider has no UI access. - Dismissing is blocked while sending and the reset on every
resourceVersionchange can close a half-typed dialog on each discovery refresh; consider keying the reset on the fields the request uses. - Provider and allocation power operations are not checked against
expectedSystemUUID(only staff service requests are); only thedevice-uidlabel guards that path.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds staff power requests and an Operations tab to the Device page. The diff against
feat/manual-inventory-recordsis limited to UI, fixtures, tests and documentation; staging's discovery, custody, RBAC, admission and site worker are unchanged.The control offers only explicitly observed reset actions on the matching system, requires a reason, and confirms destructive actions by server name. The request uses the authenticated username plus UID when supplied. A session check holds dispatch; a lost create response is unknown and is never automatically retried. Recovery holds block ordinary requests; this page does not authorize recovery or retries.
Synthetic verification