Skip to content

feat(ui): Add staff power control to Device page - #191

Draft
scotwells wants to merge 8 commits into
feat/manual-inventory-recordsfrom
feat/device-power-ui
Draft

scotwells wants to merge 8 commits into
feat/manual-inventory-recordsfrom
feat/device-power-ui

Conversation

@scotwells

@scotwells scotwells commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

Related to #173, stacked on #179.

Staff can power a server on or off, or reset it, from its Device page, with a reason and a confirmation that names the server.

Only power operators see the button, its tooltip says why it is off, and an Operations tab lists past requests with their results.

Real servers show the button off until #181 records reset actions and a site worker runs requests.

Test plan

  • UI typecheck, tests and build pass for both plugins
  • Power tests cover offered actions, the required reason, the reset confirmation, the exact request, hidden and disabled states, and every result including an expired request and a held unknown outcome
  • Fixture screenshots of the header, dialog, Operations tab and a held server have no horizontal overflow at 390 px
  • Doc link and whitespace checks pass

Decisions for a person

  • Who requested it. The page learns the user's name and ID with an identity check through the staff-portal proxy and records them as the requester. This assumes the proxy returns the same identity the API checks on create. If it does not, every request fails as denied and nothing is created. The alternative is for the power API to record the requester itself.
  • Shipping before the worker. The design keeps restart and power cycle off on real hardware until a restart is proven. Once feat(bmc-discovery): Record the reset actions each BMC offers #181 lands, this page offers all four actions; with no site worker, an admitted request ends with an unknown outcome and holds the server. Either land this after the worker, or offer only power on and off for now.
  • Retry under a hold. Any recovery hold disables the button, so staff cannot send the retry the API allows after a retry decision. That needs the recovery page first.

🤖 Generated with Claude Code

@scotwells
scotwells requested review from ecv and kevwilliams November 25, 2026 15:59
@scotwells
scotwells force-pushed the feat/device-power-kind branch from c036142 to f93a539 Compare November 25, 2026 17:44
@scotwells
scotwells force-pushed the feat/device-power-ui branch from 662d262 to 4325eb9 Compare November 25, 2026 18:24
scotwells and others added 5 commits November 25, 2026 18:44
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
scotwells force-pushed the feat/device-power-kind branch from f93a539 to c6dcaa8 Compare November 26, 2026 00:55
scotwells and others added 2 commits November 25, 2026 19:09
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
scotwells force-pushed the feat/device-power-ui branch from 4325eb9 to 1134378 Compare November 26, 2026 01:09
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
scotwells force-pushed the feat/device-power-kind branch 6 times, most recently from 4b0e723 to cf80de8 Compare November 29, 2026 02:26
Base automatically changed from feat/device-power-kind to feat/manual-inventory-records November 29, 2026 03:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant