Skip to content

feat(inventory): authorized staff hardware directory and manager role - #95

Merged
scotwells merged 4 commits into
feat/manual-inventory-recordsfrom
t3/staff-hardware-inventory-ui
Nov 20, 2026
Merged

scotwells merged 4 commits into
feat/manual-inventory-recordsfrom
t3/staff-hardware-inventory-ui

Conversation

@scotwells

Copy link
Copy Markdown
Contributor

Stack and rollout boundary

Targets feat/manual-inventory-records at bebb7eba0af040bd1234a736c8a9c8aeee47b5d8 (PR #94 merged), not main. Head: 0673b82f073ab065327192a14c74d2dc6720b003.

Publication is authorized. Do not merge/deploy until independent adversarial review and CI complete. Parent coordinates rollout: deploy Fleet manager role before approved infra #9753 binding, then import/deploy acceptance separately. This PR performs no import, membership changes or infrastructure modifications.

Changes

  • Hardware-first six-kind browsing with search, descriptive typed relationships, components, historical identity and explicit unknowns; no optional report picker or dominant implementation caveats.
  • Facility/Rack creation and portal-owned display-name edits only. Exact backend SelfSubjectAccessReviews gate controls and are repeated on submit; actual API writes remain server-authorized. No group-name/staff-only authorization.
  • Flux/imported/unknown-writer records remain uneditable. Fresh ownership/UID/resourceVersion checks and atomic JSON Patch tests protect limited edits. No identity, claim, topology, delete/status or operational writes.
  • Calm 401/403/404/transient states, permission-aware categories/direct links, partial denial and stale-data suppression. Rejected submissions retain safe input without false success.
  • Private query clients keyed to authenticated host loader identity; clear inventory on background/session boundaries and revalidate the real host loader before restoration. No reuse of the host's persistent global cache across principals.
  • Integrates the companion fleet.datumapis.com-inventory-manager role (viewer + create/update/patch for six kinds; no delete/status/operational permissions) and exact IAM regression tests. Preserves viewer/editor roles.
  • Corrects obsolete GitOps-only guidance for new/imported records without transferring legacy Flux ownership.

Host evidence and residual gates

Inspected actual staff-portal HEAD b1489125fe5b77ea6fc379ad378c8e1951174de5: protected layouts/milo.layout loader identity, logout/login behavior, global QueryClient, catch-all internal proxy, caller-token/method/body/content-type forwarding, same-origin guard and HTTP/error envelopes. SSAR POST and inventory POST/PATCH use that existing route; no new endpoint is invented.

Source validation is not live authorization proof: staging acceptance must verify deployed host revision/loader shape, upstream SSAR, same-origin configuration, reader/manager/denied cases and session switching. Background/session boundaries intentionally reset open forms. Foreground idle role revocation is observed at the next read/submit, not claimed instantaneously. No continuous sync/provisioning/readiness logic added.

Pencil file structurally inspected and unchanged; native desktop rendering unavailable. Native visual fidelity remains a documented design gap, not an IAM gate. Scope and evidence: docs/development/staff-inventory-ui.md.

Validation

  • pnpm --dir ui/provider test: 98 tests in 11 files pass
  • pnpm --dir ui/provider typecheck and build: pass (existing transitive undici/Zod warnings)
  • go test ./internal/api/inventory/v1alpha1 and go test -race ./internal/api/inventory/v1alpha1: pass
  • kustomize build config/milo, documentation links and whitespace: pass
  • Synthetic browser checks at desktop and 390×844: browsing, denial/expiry, management, revoked submit, host-shaped principal switching, guarded name edit and Flux ownership denial. All API calls intercepted; no live writes.

Review focus

Authorization/cache lifecycle and races, field ownership/preconditions, denial states and exact manager-role grant set. Full management forms for the other four kinds are intentionally out of scope.

@scotwells
scotwells requested a review from a team as a code owner November 20, 2026 22:47

Copy link
Copy Markdown
Contributor Author

Addressed all three blocking findings in 5363687 (base feat/manual-inventory-records remains bebb7eb).

  • Pending create/edit operations now carry form/session generation leases. A synchronous host router subscription invalidates authority on navigation/revalidation/principal changes; blur/pagehide/hidden-document/unmount also revoke it. Every awaited permission/read prerequisite is checked before dispatch. Already-dispatched stale successes/errors remain unknown, with no retry or false success.
  • Opening an edit captures its original UID/resourceVersion snapshot. Prop refresh cannot advance the baseline; concurrent changes conflict and retain input.
  • Focus verification uses generation plus foreground/visibility checks. An obsolete completion cannot reverse a subsequent blur or newer verification.

Preserved the independent suite and original assertions in the repository: reproduced 3 failures/1 pass before fixes; all now pass. Added same-tick router invalidation, imperative create/edit prerequisites, blur/unmount, repeated sessions, Strict Mode lifecycle, unknown dispatched outcomes, and focus ordering regressions.

Validation: 121 tests across 14 files pass; typecheck and production build pass; inventory Go package ordinary/race tests pass; whitespace and documentation links checked. Synthetic desktop/mobile browser checks confirmed zero writes after delayed SSAR/account switch, zero PATCHes for RV1-open/RV2-refreshed edits, retained conflict input, and concealment until fresh focus revalidation. No live API writes were used. Existing role changes remain intact.

Needs NEW independent adversarial review and CI for this head; this is not self-approval. No merge, deployment, imports, membership or infrastructure changes. Residual limits: dispatched requests cannot be recalled (outcome stays unknown); idle foreground role changes are enforced at the next server request; staging auth acceptance remains parent-controlled. Native Pencil visual fidelity remains an explicitly documented design gap.

@scotwells
scotwells merged commit 0b6c897 into feat/manual-inventory-records Nov 20, 2026
11 checks passed
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