Skip to content

Approve, reject, and review deployments from a Deployments tab - #281

Merged
coryodaniel merged 8 commits into
dashboardfrom
dashboard-deployments
Nov 30, 2026
Merged

coryodaniel merged 8 commits into
dashboardfrom
dashboard-deployments

Conversation

@coryodaniel

Copy link
Copy Markdown
Member

Stacked on #280.

Tab 5, Deployments, is an action desk for the deployments in view.

  • Layout. Deploys awaiting approval come first, with who proposed them, when, and their message. Deploys in flight (pending, approved, running) come next with their elapsed time. Below those, dimmed, are the 20 most recent finished deploys. The selection follows a deployment across refreshes.
  • Keys.
    • enter shows the deploy's environment on the map, and o opens its instance in the web app.
    • f follows the deploy's logs across the whole body.
    • c opens its config: the message, the bundle version, and a diff of its params against the instance's last completed provision before it. Values that look secret are masked. j, k, g, G and page up/down scroll the box.
    • y approves through the confirmation box, which now offers c to look at the config before deciding. The map's approve box offers it too.
    • x rejects, with an optional one-line reason. The API's rejectDeployment has no message argument, so a reason is saved in the deployment's stash under review/rejection before the reject. If saving it fails, the deploy is still rejected and the toast says the reason was not saved.
    • --read-only turns off y and x.
  • Reads. The v2 deployments query has no environment filter, so the tab reads by instance, 100 instances per request, newest first. It reads when the tab opens and on each refresh while it is open, and never otherwise. The existing complexity handling shrinks pages the API refuses.

API gains Deployments, PeekDeployment and RejectDeployment, and Deployer gains RejectDeployment, GetDeployment, CompareDeployments and SetStash. The recorded API used by --playback serves each recorded instance's latest deployment and refuses peeks and rejects.

🤖 Generated with Claude Code

@coryodaniel

Copy link
Copy Markdown
Member Author

@claude please review.

@claude

claude Bot commented Nov 28, 2026 •

Copy link
Copy Markdown

Claude finished @coryodaniel's task in 2m 21s —— View job


Review of #281: Deployments tab

I read the diff against dashboard-plain. go test ./internal/commands/dashboard/ and go vet pass. I did not run make check (lint) or make docs.

The change fits the layering in CLAUDE.md. Logic and tests are in internal/commands/dashboard and cmd/ only has a one-line change. Dependencies are injected through the narrow API and Deployer interfaces. Selection follows the deployment by id across refreshes, and stale deskMsg replies are dropped by seq. The action desk is read-only on --read-only and in --playback. I found no blocking bugs, but there are a few things to consider.

Worth considering

  1. The rejection reason is saved before the reject, so a failed reject leaves it behind. (deployments.go:229-247)

    • If RejectDeployment fails, the review/rejection stash entry is already written and stays on the deployment.
    • This happens when someone else approved it in the meantime, or when you lack permission. Anyone reading the stash later would see a rejection reason on a deployment that was never rejected.
    • If the API allows stash writes on a REJECTED deployment, reject first and save the reason after. That also removes the "saved but rejected nothing" case.
    • If the stash must be written first, the stale entry could be deleted when the reject fails. Either way, a comment saying why the order is what it is would help.
  2. The baseline for the config diff only checks the first page of completed deployments. (deployments.go:175-186)

    • baseline takes the first page of COMPLETED deployments, newest first, and looks for a provision before the target.
    • An instance with a long run of completed non-provision deployments (decommission, rollback, and so on) could push the last provision off that page.
    • The peek would then say "no completed provision before it, so every param is new", which is wrong and also shows no diff. Filtering on action: PROVISION in the query, or paging until one is found, would avoid this.
  3. Secret masking is a heuristic. (deployments.go:561-578)

    • The path regex is broad. It matches auth, cert and key$, so it will mask some non-secrets, which is safe.
    • It can miss secrets under neutral paths, such as a connection_string with an embedded password or a DSN. secretValue only catches a few known token shapes.
    • This seems acceptable for a peek. The helpdoc and tab help say "values that look secret are masked", which is accurate. The key list could also be extended to cover dsn, connection, and url with credentials.
  4. A failed first read of the desk has no retry.

    • If the first deskMsg errors, desk.read stays false. The tab shows "could not read deployments" until the next snapshot refresh or a tab switch.
    • A hint such as "press 5 to retry", or a retry on the next key, would make this clearer. This is minor.

Nits

  • actions.go:303 builds a map[actionKind]string on every render of the confirm box. A small title() method or a switch would match how verb() is written. The case actionDeploy: placeholder is already the repo's pattern for the exhaustive-switch lint.
  • peekSize can go negative on a very narrow terminal: min(m.width-4, 110) - 6 is below 1 when the width is under 11. I did not check that clip and wrap handle widths of 0 or less. A max(…, 1) would be cheap insurance.
  • ReadDeployments reads only the first page of finished deployments per 100-instance chunk, then trims to 20 after merging. The comment explains why, and the result is correct. With many chunks it makes N history requests where one sorted request could do the job, but the API has no cross-instance cap, so this is fine.
  • While the map is replaying history (replay), the tab reads live deployments against a historical graph. If that is intentional, ignore this. If not, the tab could say it shows live data or skip the read.

Tests

The coverage looks good: the board ordering, the reselect behavior, the reject-with-reason and reason-not-saved paths, and the recorded API. Adding a case for item 1 (reject fails after the stash was written) would pin down whichever behavior you pick.
· branch dashboard-deployments

@coryodaniel

Copy link
Copy Markdown
Member Author

Fixed in d138fc6, with #280's latest merged in since:

  • 1: the deploy is rejected first. The reason is written to review/rejection only after the reject succeeds, so a failed reject leaves nothing behind. Tested.
  • 2: the baseline query filters to action: PROVISION, and pages up to five deep for one older than the target. TestPeekBaseline covers page one, page three, and none within five pages.
  • 3: paths with dsn or connection, and values shaped like scheme://user:pass@, are masked. A URL without credentials still shows.
  • 4: a failed read says "· r retries", and r re-reads the tab even when the map's refresh fails.
  • Nits: the confirm title is a switch method, peekSize widths are clamped, and during a replay the tab notes that it lists live deployments.

@claude please review.

@claude

claude Bot commented Nov 28, 2026 •

Copy link
Copy Markdown

Claude finished @coryodaniel's task in 2m 5s —— View job


Re-review of #281: Deployments tab

I re-read the changes since the last review against dashboard-plain, including the merge from #280. go test ./internal/commands/dashboard/ and go vet pass. I did not run make check (lint) or make docs.

All four earlier items and the nits are fixed as you described. I found no blocking bugs. The notes below are small.

Checked

  • Reject, then stash. RejectDeployment (deployments.go:249) rejects first and writes review/rejection only on success. A failed reject leaves nothing behind. TestAPIRejectDeployment covers the refused-reject case.
  • Baseline. The query filters to action: PROVISION. baseline pages up to baselinePages and skips the target itself and anything not older than it. TestPeekBaseline covers page 1, page 3, and none within five pages.
  • Retry. applySnapshot calls refreshDesk after the msg.err == nil block (model.go:556), so a failed map read still re-reads the tab. r goes through reload, which is skipped only while a fetch is in flight, and that fetch then triggers the desk read when its snapshot lands. A first read that fails because the graph is still nil is covered too, since the snapshot refresh reads the tab once the graph exists.
  • Narrow terminals. clip and wrap both return early for widths of 0 or less, so the peekSize clamp is safe.
  • Stale replies. deskMsg replies are dropped by seq, and peekMsg replies are dropped by deployment id.

Worth a look

  1. Check that the API allows a stash write on a REJECTED deployment. Reject-first only works if it does.

    • The fake Deployer can't tell. If the API refuses, every rejection with a reason shows "rejected, but the reason was not saved".
    • A quick manual reject with a reason against a real org would confirm it.
  2. The peek's baseline note is inaccurate when the search gives up. (deployments.go:528)

    • After five pages with no older provision, baseline returns ok == false. The peek then says "no completed provision before it, so every param is new".
    • That is true only when the instance has no earlier provision. On a very busy instance it just means none was found within reach.
    • Wording like "none found in the last N provisions" would be accurate in both cases. TestPeekBaseline could assert it.

Nits

  • Masking is broad. secretPath (deployments.go:579) also hides max_connections, private_subnets and author. That errs on the safe side. If it gets noisy, anchoring connection to connection_string, connection_url or conn… and private to private_key would tighten it.
  • Passwords with / or @ in URLs aren't caught by value. The scheme://user:pass@ pattern excludes those characters from the password, so such a value is masked only when its path matches. Credentials are usually percent-encoded in URLs, so this is probably fine.
  • peekLines is rebuilt several times per key press. handlePeekKey calls it up to three times, and peekBox calls it again to render. It is cheap, but computing it once per update would be tidier.
  • ctrl+c in the reject box cancels instead of quitting. That is sensible while typing a reason. It differs from the peek box, where ctrl+c quits.

Tests

Coverage is good: board ordering, reselect, reject with and without a reason, the refused reject, the baseline paging, and the recorded API. I'd add one case for the narrow-terminal clamp, since it is the only item from the last round without a test.
· branch dashboard-deployments

@coryodaniel

Copy link
Copy Markdown
Member Author

Fixed in b34e417, with #280 merged in: when the baseline search finds nothing, the config box says "no earlier completed provision found" rather than claiming there is none.

Still open: whether the API accepts a stash write on a REJECTED deployment. It needs a real reject with a reason against an org, and that's a write I won't make without the owner's go-ahead. If the API refuses it, the toast says the reason wasn't saved and nothing else breaks.

@claude please review.

@claude

claude Bot commented Nov 28, 2026 •

Copy link
Copy Markdown

Claude finished @coryodaniel's task in 1m 23s —— View job


Re-review of #281: Deployments tab

The only change since the last review is b34e417. It touches deployments.go:528 and the matching case at deployments_test.go:426. go test ./internal/commands/dashboard/ passes. I did not run make check or make docs. The change adds no helpdoc or flag text, so make docs should not produce a diff.

Checked

  • Baseline wording. The config box now says "no earlier completed provision found, so every param shows as new". That is accurate whether the instance has no earlier provision or the search gave up after five pages. It does not claim more than the search knows. The test asserts the new string.

Still open

  • Stash write on a REJECTED deployment. I agree you shouldn't make that write without the owner's go-ahead, and I can't confirm it from the fake Deployer. The failure mode is contained: the toast says the reason wasn't saved, and the reject still happens. Consider confirming it with the API owner or in the API schema docs before merge.

Remaining nits from last round (optional)

  • secretPath also masks max_connections, private_subnets and author. It errs on the safe side.
  • peekLines is rebuilt several times per key press.
  • There is no test for the narrow-terminal peekSize clamp.

I found nothing blocking.
· branch dashboard-deployments

Base automatically changed from dashboard-plain to dashboard November 30, 2026 06:12
@coryodaniel
coryodaniel merged commit cb91661 into dashboard Nov 30, 2026
2 checks passed
@coryodaniel
coryodaniel deleted the dashboard-deployments branch November 30, 2026 06:13
@coryodaniel

Copy link
Copy Markdown
Member Author

Folded into #272.

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