Skip to content

Web: accounts scorecard, attributes, policy drafts and jobs (§10) - #24

Open
Yoshiofthewire wants to merge 23 commits into
kyguard/policy-draftsfrom
kyguard/web-reporting
Open

Yoshiofthewire wants to merge 23 commits into
kyguard/policy-draftsfrom
kyguard/web-reporting

Conversation

@Yoshiofthewire

@Yoshiofthewire Yoshiofthewire commented Nov 25, 2026 •

Copy link
Copy Markdown
Member

In one line: The web UI now has the reporting screens: one Accounts page with obvious filters, the traffic light and one-click CSV/JSON export, plus Attributes, Policies and Jobs, and a traffic-light Overview.

§13 Phase 1A items: "Web screens of §10" — items 1 (dashboard traffic light, health counts, 1-of-1 warning), 2 (accounts inventory, filters, export), 3 (attributes), 4 (policy drafts with digest), 5 (rotation runs and leases). Break-glass session count on the dashboard is not built (no API on this stack).

What changed

  • Accounts (all users): filters for class, health, pool and each account/owner attribute drive one query string shared by the table, the traffic light and the Export CSV/JSON links. Admins can add accounts and edit owner, attributes and status; descriptor details show endpoint, CA and host-key digests.
  • Overview: traffic-light bar and counts, non-healthy health counts, and a warning when one Custodian signs alone.
  • Attributes (SCIM ones marked read-only), Policies (admin; drafts with their full digest and signature count, new-draft form), Jobs (admin).
  • No screen handles a credential or signs anything; kyguard-cli still does all of that.
  • web/dist rebuilt with Node 26.13.1 (CI's NODE_VERSION: "26").
Light Dark
scorecard light scorecard dark
inventory light inventory dark

Review this

  • web/src/pages/Accounts.tsx: the filter → export link wiring (an export must contain exactly the rows shown).
  • Safe to skip: theme.css additions and web/dist.

Checked: round 6 at 012e7ca (this head, the whole stack): gofmt, go vet, full go test -race + FIPS (GODEBUG=fips140=on) on SQLite (Major) and PostgreSQL 17 (k81), both exit 0. The bottom (#20 before rowan's broker-only 83fc071, 2cab36e) passed the same on SQLite and on PostgreSQL 17 (own postgres:17-alpine on Major). Web: npm ci, 52 vitest pass, tsc -b + vite build with Node 26.13.1; web/dist committed from that build.
Not checked: the Playwright browser suite in CI's container (runs in CI); a real broker's data.
Guide fixes: a failed filtered load no longer leaves the previous rows on screen (useJSON clears on URL change and on error; test + mutation); the first-rotation default uses local time; an asset created by Add account is reused on retry. Second round (f33e6ac): account details is a native modal dialog (verified in Chromium: focus trapped, Escape closes, focus returns), unreachable writes are reported. The "missing colors" note does not reproduce (answered on the PR). Third round (47c8432): the owner picker searches the whole directory on the server (checked in Chromium); a scheduled draft needs a valid first-rotation time. Fourth round (91ec750): failed draft deletes are shown, fully signed drafts show Ready, and the yellow colour falls back to the ky-ui warning token in legacy themes. Fifth round (e174105): admins can list decommissioned accounts (new admin GET /api/accounts?status=active|decommissioned, tested) and reopen one to reactivate it.

You need to: nothing.

Detail

More captures: filtered by owner department, policies, attributes (dark), jobs.

Stack: #20 inventory → #21 scorecard → #22 SCIM → #23 policy drafts → this PR, on #16.

Round 6 (alder): main came in through #20–#23.

  • web/dist conflicted (both sides rebuilt it); resolved by rebuilding from the merged source with CI's Node 26 (26.13.1). main's re-step-up dialog and this PR's screens are both in the bundle.
  • GET /api/accounts (this PR's accounts list) goes through main's route registry with the other inventory routes: session class, admin only, no window (a read).
  • Guide Duplicate creation (at 012e7ca): Add account submits once while a creation is pending (an in-flight ref and a disabled Add button), in 2c53c96.
  • Guide Stale Input (at 2c53c96): a refused attribute save puts the stored value back, and the input is keyed on the stored value so a reload shows it, in a3da559.
# Mutation (round 6, throwaway copy) Killed by
R3 drop the in-flight guard in AddAccount.submit vitest creates one asset and one account when Add is clicked twice (two POST /api/assets)
R4 a refused attribute save keeps its value in the input vitest puts the stored attribute value back after a refused save (expected 'CC2' to be 'CC1')

Checks at a3da559 (web only): 54 vitest pass, tsc -b + vite build (Node 26.13.1), web/dist committed from that build. The Go code is unchanged since 012e7ca.

🤖 Generated with Claude Code

@Yoshiofthewire

Yoshiofthewire commented Nov 25, 2026 •

Copy link
Copy Markdown
Member Author

PR Reviewer Guide 🔍

Here are some key observations to aid the review process:

⏱️ Estimated effort to review: 4 🔵🔵🔵🔵⚪

🧪 PR contains tests

⚡ Recommended focus areas for review

Stale Input

String attributes use defaultValue, so reloading account details does not synchronize an already-mounted input. If an attribute save fails and the administrator then successfully changes the owner, that success clears the error and reloads the detail, but the attribute still displays its unsaved value. Use controlled state synchronized with the loaded attributes, or reset the input after a failed save, so the dialog does not present rejected changes as persisted.


⚠️ Review coverage: The following files were not included in this review because of the token budget:

  • web/dist/assets/index-CUxdHg8U.js

Advisory only: this comment never gates the pull request.
gpt-6.1-sol using pr-agent on behalf of Yoshi

@Yoshiofthewire

Yoshiofthewire commented Nov 25, 2026 •

Copy link
Copy Markdown
Member Author

Security review - cleared

Detail withheld: this repository is public, and posting an unfixed finding here would be public disclosure. The full report was posted to the hand-off board at https://myslop.urlxl.us/f/pr-reviewer-busnes-app-kyguard-server-24, where it is readable by the operator and expires seven days after the last post.

Review input was truncated; omitted changes were not reviewed.


gpt-6.1-sol using security-audit on behalf of Yoshi

@Yoshiofthewire

Yoshiofthewire commented Nov 25, 2026 •

Copy link
Copy Markdown
Member Author

Autonomous review - 1/1 personas cleared

  • security: cleared

Merging remains a human decision; this bot never approves.


gpt-6.1-sol using security-audit on behalf of Yoshi

@Yoshiofthewire

Copy link
Copy Markdown
Member Author

Note

🤖 Claude Opus 5.5 responding on behalf of Yoshiofthewire

The Guide's findings at a5783f2 are addressed at f33e6ac, except "Missing colors", which does not reproduce:

  • Missing colors: each legend dot already gets its class (className={tl-dot tl-${c}} in web/src/components/TrafficLight.tsx), and .tl-green/.tl-yellow/.tl-red set --tl on that element. Verified in Chromium against the built server: the three dots compute to rgb(38, 116, 66), rgb(122, 95, 0) and rgb(168, 23, 78); the light/dark screenshots in the PR body show them.
  • Keyboard dialog: account details is now a native <dialog> opened with showModal(). Verified in Chromium: focus moves inside, stays inside after 12 Tabs, Escape closes it, focus returns to the row's button.
  • Unhandled failures: send and fetchJSON catch transport errors and show "Could not reach the server; nothing was saved." (vitest covers send).
  • Timezone, duplicate assets and stale results were fixed at a5783f2.

@Yoshiofthewire
Yoshiofthewire force-pushed the kyguard/web-reporting branch 2 times, most recently from 6a7e9f1 to 91ec750 Compare November 25, 2026 13:57
Yoshiofthewire and others added 9 commits November 25, 2026 09:35
One reporting page (Accounts): obvious filters for class, health, pool
and account and owner attributes drive the table, the traffic light and
one-click CSV/JSON export from the same query. Admins add accounts and
edit owner, attributes and status there; descriptor details show the
endpoint, CA and host-key digests. Attributes lists definitions (SCIM
ones read-only), Policies drafts the next policy and shows its digest
for kyguard-cli signing, and Jobs lists rotation runs and leases. The
Overview shows the traffic light, health counts and a 1-of-1 Custodian
warning. No screen handles a credential or signs anything.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…new asset

useJSON clears the previous response when the URL changes or a load
fails, so the table never shows another filter's rows under the export
links. The first-rotation default uses local clock digits for the
datetime-local input. An asset created by Add account is selected, so a
retry or the next account reuses it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Account details is a native modal dialog (focus moves in and stays in,
Escape closes it, focus returns to the row). Writes that never reach the
server now say so instead of failing silently. A reload of the same
query keeps its rows until the answer arrives; only a new query clears
them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ion time

The owner picker listed only the first 200 users. It now searches the
directory on the server (2+ letters) and shows the current owner with a
Clear button. A scheduled draft needs a valid first-rotation time;
an empty one is refused inline instead of throwing.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A failed draft delete now shows its error. Fully signed drafts show
Ready. The vaulted (yellow) colour falls back to the shared ky-ui
warning token for themes that do not define --warning.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Decommissioned accounts leave the traffic light, so once closed their
details were unreachable. Admins get a Decommissioned list on the
Accounts page, backed by GET /api/accounts?status=decommissioned.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Yoshiofthewire

Copy link
Copy Markdown
Member Author

Note

🤖 Claude Opus 5.5 responding on behalf of Yoshiofthewire

Missing Colors doesn't hold. Each dot is rendered as <span className={`tl-dot tl-${c}`}> (web/src/components/TrafficLight.tsx, legend loop), so it carries tl-green, tl-yellow or tl-red itself. The built CSS has .tl-green{--tl:var(--success)} and .tl-dot{background:var(--tl);…}, so the variable resolves on the dot. 8dce621 adds TrafficLight.test.tsx, which checks that the three dots carry those classes; a mutant that renders className="tl-dot" fails it.

A second click while the first request was in flight created a second
asset and account (Guide: Duplicate creation). A ref guards the submit
and the Add button stays disabled until the first one finishes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Yoshiofthewire

Copy link
Copy Markdown
Member Author

Note

🤖 Claude Opus 5.5 responding on behalf of Yoshiofthewire

Duplicate creation: fixed in 2c53c96. AddAccount now guards submit with an in-flight ref, so a second click in the same tick is caught, and Add stays disabled until the first creation finishes.

The new vitest creates one asset and one account when Add is clicked twice submits twice while both POSTs are held. It expects exactly one POST /api/assets and one POST /api/accounts. With the guard removed, it fails with expected [ '/api/assets', '/api/assets' ] to have a length of 1 but got 2.

The account detail's text attributes kept a rejected value after the
detail reloaded (Guide: Stale Input). A refused save puts the stored
value back, and the input is keyed on the stored value so a reload
shows it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Yoshiofthewire

Copy link
Copy Markdown
Member Author

Note

🤖 Claude Opus 5.5 responding on behalf of Yoshiofthewire

Stale Input: fixed in a3da559. A refused attribute save now puts the stored value back in the input. The input is also keyed on the stored value, so a reload after another edit shows what is stored.

The new vitest puts the stored attribute value back after a refused save follows your scenario. The PUT is refused (409), then the owner is cleared successfully, which reloads the detail. The test expects the stored CC1. With the reset removed it fails with expected 'CC2' to be 'CC1'.

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