refactor: one definition of what approving or declining a task means
The dashboard and chat both let an operator approve or refuse work, and they had drifted. Declining from the dashboard left the task closed_wont_do; cancelling the same task from chat left it rejected. Two operators looking at one queue saw different states for the same decision, and "rejected" -- which reconcilePRs also uses for a pull request closed without merging -- stopped meaning one thing. internal/gateway deliberately does not import internal/store, so it kept a hand-synced copy of the status strings with a comment asking future editors to keep them aligned. That is the same defect one level down, and it is how the drift happened. internal/taskstate is a leaf package with no dependencies holding the lifecycle vocabulary and the rules for operator actions. gateway, store and the dashboard all import it, so gateway stays decoupled from store without a copy, and CheckApprove/CheckRetry/CheckDecline have one implementation. Declined is named for what it is -- a human said no -- and stays distinct from Rejected, which is something archie observed. Chat cancel now records Declined. That is the behaviour change: same decision, same state, whichever surface the operator used. Rules were preserved rather than tidied while unifying. A parked task still cannot be declined, which both surfaces already refused, even though "not terminal" would have allowed it -- widening a rule under cover of a refactor is how you ship a change nobody reviewed. The comment says where to change it if that is ever wanted. TestDashboardAndChatAgreeOnTerminalStates drives both real surfaces against one store, so this cannot drift apart again without a red test. Also removes a second rule for the dash-top-standalone class: renderSetup already reconciles it from the data at the top of every call, and a later branch cleared it again. Harmless, but it reads as two sources of truth for one bit of layout state.
This commit is contained in:
1 parent
d6e00415fa
commit
1f2e7a42eb
10 files changed
+329
-46
No files matched your search
@@ -213,6 +213,10 @@ export function dashboardPage() {
|
||||
// Unknown setup (endpoint unreachable) or no checklist configured: omit
|
||||
// the panel and let the gate pulse take the full row, so the Health row
|
||||
// never shows an empty half beside the pulse.
|
||||
// One place decides this class, reconciled from the data on every render.
|
||||
// A second rule elsewhere in this function used to clear it again, which
|
||||
// reads as two sources of truth for one bit of layout state even though
|
||||
// the toggle above had already settled it.
|
||||
const omit = !setup?.steps?.length;
|
||||
topRow.classList.toggle("dash-top-standalone", omit);
|
||||
if (omit) return mount(setupSlot);
|
||||
@@ -240,7 +244,6 @@ export function dashboardPage() {
|
||||
}
|
||||
// Every step done: show completion so the row beside the gate pulse is
|
||||
// not an empty hole on an otherwise healthy dashboard.
|
||||
topRow.classList.remove("dash-top-standalone");
|
||||
mount(
|
||||
setupSlot,
|
||||
el(
|
||||
|
||||
Reference in new issue
Block a user