Repository navigation
feat: add a Manage menu, modal dialog frame and write-token support - #37
Conversation
pmd_write_token_path turns writes on. The write client sends PUT and PATCH with If-Match or If-None-Match, without redirects or proxy, with bounded bodies and a timeout, and never retries; a timed-out create reads the row first. pmd's errors map to typed results with both tokens scrubbed. The token is stored owner-only (mode 600, or a protected owner-only DACL on Windows). edit.rs holds one row's edit and the shared 409 stale_version flow. Refs #33 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The title bar gets a Manage menu with Projects, Work items, Fleet and Write access. Unbuilt or unauthorized entries stay disabled with a reason. Dialogs trap focus, close on Esc after asking about unsaved edits, return focus to the Manage button and leave F5 working. Write access shows the token's scopes and stores a pasted token. The demo adds a sample dialog for the validation and Changed elsewhere states. Captures also render on macOS through GPUI's Metal headless renderer. Refs #33 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Closes #33 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Refs #33 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ce4835e8ad
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Tightening the DACL after creating the file left a moment in which another process could open it under the folder's inherited entries and keep that handle. CreateFileW now attaches the protected owner-only descriptor at creation, with no sharing. Refs #33 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A token save that landed after its dialog closed could clear a newer Write access dialog's field and its saving state. Each dialog opening now has an id, and every completion checks it before touching dialog state. Refs #33 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
@codex review |
1 similar comment
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 458e16569a
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Saving a token now starts a new access generation, so a whoami still running for the old token can't overwrite the new token's name and scopes. A failed store rechecks the token still in place instead of leaving access at Checking. Refs #33 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
@codex review |
|
Codex Review: Didn't find any major issues. Breezy! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Summary
Adds the shared base for the management dialogs: a Manage menu in the title bar, a reusable modal dialog frame, a pmd write client with its own write token, and the shared
409 stale_version"Changed elsewhere" flow. Projects (#34), Work items (#35) and Fleet (#36) only need to add their content.dashboard-app/src/manage.rs): Projects…, Work items…, Fleet…, Write access…. Entries that can't open stay visible but disabled, with a one-line reason: not built yet (Add a Projects dialog to track, edit and re-prioritize pmd projects #34/Add a Work items dialog to override status, priority and rank #35/Add a Fleet dialog to manage machines, subscriptions and agents #36), writes off, no token, or the missing scope (for example "the token lacks write:work"). Fully keyboard-driven: Enter, Space or Down opens the menu, Up and Down move, Enter activates, and Esc or Tab closes it and returns focus to the button.dashboard-core/src/write.rs):PUTandPATCHwithIf-MatchorIf-None-Match: *, like the read client: no redirects, no proxy, a 64 KB body limit (larger bodies are never sent), a 1 MB response limit and a 40 s timeout (a project create can wait 30 s on GitHub). Writes are never retried. After a create times out, the client reads the row with the read token to say whether it landed. pmd's errors map to typedWriteErrors: every400code with pmd's message,401,403 insufficient_scope,404,409 stale_version/already_exists/item_closed/ other,413,428,429withRetry-After,5xxwith code, timeouts, and network failure. The client is a genericWriteBackend, sowrite:projects(project-manager#50'sPUT /v1/projects/{slug}) fits without changes.dashboard-core/src/edit.rs):Formtracks unsaved edits and the save in flight (a second save while one is running is ignored). It places a400next to the field pmd names, or on the dialog otherwise. Onstale_versionit re-reads the row with the read token and keeps the user's values beside the new ones, with Reapply mine / Discard mine. A successful write reloads pmd data at once.pmd_write_token_path: optional; unset means writes are off. Write access… explains setup when unset. When set, it shows the token file, the name and scopes fromGET /v1/whoami, and which dialogs the scopes allow, and accepts a pasted token in a masked field. Editing the setting while the app runs applies at once.Token storage: mechanism and why
The write token lives in its own file at
pmd_write_token_path, beside the read token, never inconfig.toml,ui-state.jsonor the status cache. The dashboard creates a new file that is owner-only before any byte is written, then renames it over the old one, so the token is never readable by others, even briefly:600(O_CREAT|O_EXCLwith mode 600, then an exactchmod).CreateFileWwith the protected DACLD:P(A;;FA;;;OW)attached at creation (full access for OWNER RIGHTS only, nothing inherited from%APPDATA%) and with no sharing, so no other process can open it under the folder's inherited entries. This goes throughwindows-sys, already in the lock through GPUI. A Windows CI test reads the DACL back.I chose this over the Windows credential store because the token then sits beside the read token, works the same on every OS, is inspectable with
icaclsorls -l, and matches project-manager's own guidance (clients keep tokens in a mode-600 file).The token never appears in logs, panics, error strings, the UI, screenshots or fixtures. Both tokens are scrubbed from every pmd message.
WriteErrorcarries no URL, body or reqwest diagnostic. The client type isn'tDebug. The input is masked and cleared once the token is stored.tokens_never_appear_in_any_errorsends both tokens through 400+ error paths (every status × error code, echoed in codes, messages and headers, plus timeouts, a closed port, malformed URLs and bodies, and token storage) and asserts neither appears in anyDisplay,Debugor form message.Placeholder dialog
With
--demo, the menu adds Sample dialog (demo)…, which edits an in-memory row. It shows the frame with real fields: a priority above 5 shows pmd's kind of field error, and the first save meets a change made "elsewhere". The tests and screenshots use it. It's hidden outside the demo.Validation
Head
701e8703d980d62ad90040737982040e6c1460d8, built and run on air (macOS 26, Apple Silicon). It addresses every Codex finding so far:on
ce4835e: the Windows token file now gets its DACL at creation; dialog work is bound to the dialog that started it (a_token_save_that_lands_after_its_dialog_closed_leaves_a_newer_dialog_alone, which fails without the fix);on
458e165: saving a token starts a new access generation, so a check about the replaced token is dropped (an_access_check_about_the_replaced_token_cannot_overwrite_the_new_one, which fails without the fix); a failed store rechecks the token still in place (a_failed_token_store_says_why_and_rechecks_the_token_still_in_place).cargo fmt --all --check: clean.cargo clippy --workspace --all-targets --locked -- -D warnings: clean. The Windows ACL module also passescargo clippy --target x86_64-pc-windows-msvc -D warningsin isolation; CI'swindows-latestjob builds and runs it in full.cargo test --workspace --locked --no-fail-fast: everydashboard-coresuite passes, including 25 new tests intests/write.rs. The write client runs against a loopback stub for every status above, plus timeouts with no retry, the create read-back, no redirects, body and response limits, path validation, writes-off, owner-only storage and the token-leak test.dashboard-apppasses 80, including 15 new UI tests (manage_tests.rsandediting_pmd_write_token_path_turns_writes_on_and_off): menu open and close by mouse and keyboard, focus return, disabled entries with reasons, writes-off setup, scopes, masked token store, the focus trap, unsaved-edit confirm, table input blocked with F5 still working, the field error, the conflict with reapply and discard, the double-save guard, a late token save leaving a newer dialog alone, a stale access check dropped after a token is replaced, and a failed store. Four existing zoom tests fail on macOS only, identically onmain: zoom bindssecondary-=(Cmd on macOS) while those tests press Ctrl. CI runs Linux and Windows, where they pass.The token strings used by the tests were searched for in the full test log, the capture log, all PNGs and the recording: no match.
Not run here:
cargo run -p dashboard-app -- --demowith mouse and keyboard on a desktop (screenshots are headless by policy; the recording below drives the same keys in the real view), and the check against a localpmd servewith a read-only token (that state is shown below with an in-memory backend returningread, write:work).Screenshots. Rendered headlessly with
CAPTURE_DIR=$PWD/captures cargo test -p dashboard-app captures -- --ignored. That needed a small change so captures also run on macOS: GPUI's Metal headless renderer, with the text system built directly because the Mac platform object can only be created on the main thread. App default size 1100×760; 150% zoom on the right. These were rendered atce4835eand re-rendered at458e165and701e870: every PNG and recording frame is byte-identical, so they show the current head. These are macOS renders. Windows-native screenshots can follow once laptop or home is available.Manage menu open by keyboard, writes off: each entry's reason is visible and the focus ring is on Work items.
Manage menu with a
read, write:worktoken: Work items says only "Not built yet (#35)", while Fleet and Projects also name their missing scope.Write access… with writes off: the setup steps, with Close focused.
Write access… with a token that has scopes: file, name, scopes, allowed dialogs, and a pasted token masked.
Placeholder dialog open, focus in the first field.
Inline validation error: pmd's 400 naming
prioritysits under that field.Unsaved-edit confirm after Esc, with Keep editing focused.
"Changed elsewhere": your values next to pmd's new ones, with Reapply mine focused.
Keyboard recording, one frame per key from the headless view: focus Manage → Enter opens the menu → Down ×3 → Enter opens Write access… (focus in the token field) → Tab ×5 cycles close → field → Cancel → Save token → close, staying inside → Shift+Tab → Esc closes, and the focus ring is back on Manage.
manage-keyboard.mp4
Accessibility basics: controls carry roles (
Button,Menu,MenuItem,Dialog,AlertDialog,Status) and labels, and disabled entries carry their reason as a description. The UI tests look controls up by these labels. No manual screen-reader pass.Closes #33
🤖 Generated with Claude Code