Skip to content

fix(workflow): bind deciding on plan approval and bound step approval cards (#20853) - #21104

Merged
mrveiss merged 3 commits into
mainfrom
issue-20853-plan-deciding
Nov 8, 2026
Merged

mrveiss merged 3 commits into
mainfrom
issue-20853-plan-deciding

Conversation

@mrveiss

@mrveiss mrveiss commented Nov 8, 2026

Copy link
Copy Markdown
Owner

Thinking Path

The plan-approval envelope never received deciding, and neither handler tracked an in-flight request, so both buttons stayed live and a second click sent a second decision. The guard lives in a small composable (usePlanDecision) rather than in the view, because WorkflowBuilderView.vue is at its file-size ceiling; the ceiling is lowered, not raised. The M3 items of #21033 ride along: clearer failure copy, a bounded scroll region for the step approval cards, and two missing spec assertions. useWorkflowBuilder.ts and its tests are left to the M4 items of #21033.

What Changed

  • autobot-frontend/src/composables/usePlanDecision.ts (new): deciding is true from the first click until the request settles; a decision made while one is in flight is not sent. Approve/reject handlers moved here from the view.
  • autobot-frontend/src/views/WorkflowBuilderView.vue: binds :deciding on the plan ApprovalEnvelope; renders the step cards through StepApprovalList. 2166 -> 2157 lines; ceiling in scripts/frontend_file_size_known_large.py lowered to 2157.
  • autobot-frontend/src/components/workflow/StepApprovalList.vue (new): the cards in a max-h-96 overflow-y-auto region (the repo's shared scroll utilities, no new CSS), rendered outside the loading/error/content switch so it applies in every state.
  • autobot-frontend/src/i18n/locales/en.json: stepApproveFailed / stepSkipFailed now say the outcome is unconfirmed and to check the workflow status before retrying. Only en.json carries these keys (checked all 11 locales).
  • Tests: WorkflowBuilderView.approval.spec.ts (deciding binding, no second decision, copy), StepApprovalCard.spec.ts (skip spy not called in the double-click test), WorkflowRunner.stepApproval.spec.ts (waiting_approval with requires_confirmation: false).

Verification

  • vitest on the three changed specs: 3 files, 19 tests passed.
  • vue-tsc -p tsconfig.app.json: no errors in the touched files.
  • repo_tests/frontend_fragmentation_ratchet_test.py: 53 passed (a first push was blocked by this ratchet because of new scoped CSS; fixed by using the shared utilities).
  • Pre-push fast guards and reach floors passed.

Closes #20853
Refs #21033 (M3 items only; the useWorkflowBuilder items stay open for M4)

Model Used

Claude Sonnet 5.5

@coderabbitai

coderabbitai Bot commented Nov 8, 2026 •

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 16 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 26dd86d and e7eeeba.

Files selected for processing: 10

  • autobot-frontend/src/components/workflow/StepApprovalList.vue
  • autobot-frontend/src/components/workflow/__tests__/StepApprovalCard.spec.ts
  • autobot-frontend/src/components/workflow/__tests__/StepApprovalList.spec.ts
  • autobot-frontend/src/components/workflow/__tests__/WorkflowRunner.stepApproval.spec.ts
  • autobot-frontend/src/composables/__tests__/usePlanDecision.spec.ts
  • autobot-frontend/src/composables/usePlanDecision.ts
  • autobot-frontend/src/i18n/locales/en.json
  • autobot-frontend/src/views/WorkflowBuilderView.vue
  • autobot-frontend/src/views/__tests__/WorkflowBuilderView.approval.spec.ts
  • scripts/frontend_file_size_known_large.py
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@mrveiss mrveiss added bug Something isn't working frontend phase:M3.7 Company OS, Automation and BI screens labels Nov 8, 2026
@mrveiss mrveiss added this to the M3 - Refined GUI complete milestone Nov 8, 2026
@github-actions

github-actions Bot commented Nov 8, 2026

Copy link
Copy Markdown
Contributor

Notice: 29 open PRs — past the runaway threshold (25)

This is not a request to defer this PR. There is no cap on open PRs (#19397) -- nothing blocks opening or pushing a PR.

This notice only means the count is high enough to be worth a glance for a runaway — something opening PRs in a loop, or a merge pipeline that has stalled so nothing is draining.

Currently open:

If the queue is draining normally, ignore this. Otherwise:

  1. Check whether CI is dispatching at all — see the ci-dispatch-watchdog status on these PRs
  2. Approved PRs land through the merge train the coordinator sequences (merge commits, never squash) -- check the open chore(merge-train) PR is moving, not each PR on its own
  3. Look for a loop opening near-identical PRs

Warn-only runaway detector — .github/workflows/pr-queue-gate.yml. It never blocks a merge.

@mrveiss

mrveiss commented Nov 8, 2026

Copy link
Copy Markdown
Owner Author

Code review (code-reviewer pass) follow-up at 1236178

AC Evidence
#20853: deciding bound on the plan envelope, true from first click until settle autobot-frontend/src/views/WorkflowBuilderView.vue :deciding="deciding" on ApprovalEnvelope; autobot-frontend/src/composables/usePlanDecision.ts deciding set before the request, cleared in finally
#20853: second decision in flight not sent; component test usePlanDecision.decide returns early when deciding.value; test "binds deciding from the first click until the request settles and sends no second decision" in autobot-frontend/src/views/__tests__/WorkflowBuilderView.approval.spec.ts
#21033 (a): unconfirmed-outcome copy autobot-frontend/src/i18n/locales/en.json workflow.builder.stepApproveFailed / stepSkipFailed; no other locale carries the keys
#21033 (b): bounded scroll region, all states autobot-frontend/src/components/workflow/StepApprovalList.vue (max-h-96 overflow-y-auto), mounted in WorkflowBuilderView.vue outside the loading/error/content switch
#21033 (c): skip not called in double-click test autobot-frontend/src/components/workflow/__tests__/StepApprovalCard.spec.ts expect(skip).not.toHaveBeenCalled()
#21033 (d): waiting_approval with requires_confirmation: false autobot-frontend/src/components/workflow/__tests__/WorkflowRunner.stepApproval.spec.ts "still asks for a decision when the waiting step does not require confirmation"

Not touched: useWorkflowBuilder.ts and its tests (M4 items of #21033 stay open). No fetch added. File-size ceiling for the view lowered 2166 -> 2157, not raised.

@mrveiss

mrveiss commented Nov 8, 2026

Copy link
Copy Markdown
Owner Author

Code review (code-reviewer pass) follow-up at 1236178

Verdict: APPROVE-equivalent. No blocking findings; the items below are non-blocking.

Checked against the code (three-dot diff): both #20853 ACs and the four M3 items of #21033 are delivered; useWorkflowBuilder.ts is untouched; the generated client is used and there is no raw fetch; the new functions are all under 30 lines; deciding is bound on ApprovalEnvelope, which disables both buttons on it; decide() resets deciding in finally, so it resets on success and on failure, and a decision made while one is in flight returns null and is not sent; the KNOWN_LARGE ceiling went 2166 to 2157, matching the 2157-line file, so it is lowered.

Severity File:line Finding Fix
Low autobot-frontend/src/components/workflow/StepApprovalList.vue (new file) The bounded scroll region (max-h-96 overflow-y-auto, rendered outside the loading / error / content switch) has no test. The #21033 item "in every state" is only structural. Add a small spec mounting the list and asserting the step-approval-list testid carries the bound class and renders nothing for an empty steps.
Low autobot-frontend/src/composables/usePlanDecision.ts:26-34 The in-flight guard in decide() has no direct unit test. The view test passes through the disabled envelope buttons, and VTU does not fire clicks on disabled buttons, so it would still pass if the deciding.value guard were removed. The deciding prop binding is covered, because without it props('deciding') stays false and the test fails. Add a composable spec calling handleApprovePlan() twice without awaiting and asserting approvePlan was called once.
Low autobot-frontend/src/components/workflow/__tests__/WorkflowRunner.stepApproval.spec.ts:40-51 The requires_confirmation:false test would also pass without this PR, since the runner keys on status === 'waiting_approval'. It is a regression pin, not a fail-without-fix test. That is acceptable for this item, but it should be named as such. Optionally say in the test name or a comment that it pins existing behaviour.
Low autobot-frontend/src/composables/usePlanDecision.ts:40-45 A rejected send rethrows from finally-wrapped decide with no toast, so the user gets no feedback on a thrown error. Reject failure (success === false) also gives no error toast. Both are carried over from the old handlers, not new. Optionally catch in decide, notify with the error key and return false. File an issue if you defer it.
Info usePlanDecision.ts:17, WorkflowBuilderView.vue notify takes a dynamic i18n key and the view calls t(key). This is valid, but a static key extractor or unused-key lint can miss those keys. Confirm the i18n key-usage check still passes in CI.
Info scripts/frontend_file_size_known_large.py:150 The trailing comment trail does not mention #20853 for the 2166 to 2157 change. Optional: prepend #20853: 2166 -> 2157;.

No hardcoded strings were found in the changed code. The only styling is Tailwind utilities, with no new ad-hoc CSS.

@mrveiss

mrveiss commented Nov 8, 2026

Copy link
Copy Markdown
Owner Author

Code review (code-reviewer pass) follow-up at e7eeeba

All findings addressed in commit e7eeeba.

Finding Where Resolution
In-flight guard untested (Low) composables/__tests__/usePlanDecision.spec.ts (new), usePlanDecision.ts:decide Direct spec: a second approve and a reject while the first is pending are not sent (approve spy called once, reject spy not called); deciding is true while pending and false after success and after failure. With `
Scroll region untested (Low) components/workflow/__tests__/StepApprovalList.spec.ts (new) Mounted inside a parent in loading, error and content states: step-approval-list carries max-h-96 and overflow-y-auto and wraps both cards; an empty steps renders nothing.
Rejected request / reject=false give no toast (Low) usePlanDecision.ts:decide, handleRejectPlan; i18n/locales/en.json workflow.builder.planRejectFailed (new key; no existing key fit) decide catches a thrown request and returns false; approve failure toasts planApproveFailed, reject failure toasts planRejectFailed. Covered by the spec.
Size-ceiling comment trail (Info) scripts/frontend_file_size_known_large.py # #20853: 2166 -> 2157 added above the entry (the inline trail would have exceeded the 120-column flake8 limit).
requires_confirmation:false test is a regression pin (Low, optional) not changed Left as is, as the review marked it optional.
Dynamic i18n key (Info) not changed planRejectFailed is used through the same notify path; the i18n usage check is left to CI.

Verification (scratch copy): vitest on the two new specs, WorkflowRunner.stepApproval.spec.ts and src/views passed (60 files, 445 tests); vue-tsc --noEmit -p tsconfig.app.json over the whole project exited 0.

@mrveiss

mrveiss commented Nov 8, 2026

Copy link
Copy Markdown
Owner Author

Code review (code-reviewer pass) at e7eeeba

Verdict: APPROVE. 10 files changed, 0 commits behind main.

# Check Result
1 Closes #20853 vs ACs Both met: deciding is bound on the plan envelope (WorkflowBuilderView.vue, :deciding="deciding") and ApprovalEnvelope disables both buttons on it. decide() returns early when deciding.value is set, and usePlanDecision.spec.ts covers it (approve called once, reject never called).
2 Refs #21033 Delivered: stepApproveFailed / stepSkipFailed copy, bounded scroll region (StepApprovalList, max-h-96 overflow-y-auto), skip spy assertion, requires_confirmation:false runner test. Not touched: the three useWorkflowBuilder items (answerStep refresh, post-reload card restore, socketNotices test). Refs is correct and #21033 must stay open.
3 useWorkflowBuilder.ts untouched Confirmed (0 matching files in the three-dot diff).
4 decide() catches a thrown request Confirmed. Approve failure toasts planApproveFailed, reject failure toasts planRejectFailed; both keys exist in en.json. Spec covers throw and false for both.
5 Guard spec fails without the guard In-flight test asserts on spy call counts while the first promise is pending, so it does fail without the guard. The author's run showed 1 failed, 4 passed; I did not re-run it.
6 Scroll region in loading/error/content StepApprovalList sits before the loading/error/content switch in the view, so it applies in every state. The spec mounts a synthetic parent in the three states, so it proves the component's classes, not the real view's placement. Fine as is.
7 Ceiling comment # #20853: 2166 -> 2157 present; the view is exactly 2157 lines, equal to the ceiling and below the previous 2166.
8 Size / function length / sleeps / line-number comments New files are all under 100 lines, every function is under 30 lines, there are no fixed sleeps and no line-number comments.
9 Design system and i18n Uses ApprovalEnvelope and the shared utility classes; no new CSS. Strings go through i18n keys.
10 Double submission None: the guard sits in the composable and the buttons are disabled while deciding.
11 Low: dynamic i18n key notify calls t(key) with a variable key. If the i18n unused-key check cannot see these, planRejectFailed could be flagged; CI is the arbiter. No change needed.
12 Threads No unresolved review threads and no inline comments, so nothing to resolve. The earlier self-review items are addressed by the follow-up comment.
13 CI At this head: 6 success, 1 neutral, 10 skipped, 13 cancelled. The cancelled runs need a rerun before merge; I did not investigate their cause.

@mrveiss

mrveiss commented Nov 8, 2026

Copy link
Copy Markdown
Owner Author

Code review (code-reviewer pass) follow-up at e7eeeba

All findings addressed in commit e7eeeba.

Finding Where Resolution
In-flight guard untested (Low) composables/__tests__/usePlanDecision.spec.ts (new), usePlanDecision.ts:decide Direct spec: a second approve and a reject while the first is pending are not sent (approve spy called once, reject spy not called); deciding is true while pending and false after success and after failure. With `
Scroll region untested (Low) components/workflow/__tests__/StepApprovalList.spec.ts (new) Mounted inside a parent in loading, error and content states: step-approval-list carries max-h-96 and overflow-y-auto and wraps both cards; an empty steps renders nothing.
Rejected request / reject=false give no toast (Low) usePlanDecision.ts:decide, handleRejectPlan; i18n/locales/en.json workflow.builder.planRejectFailed (new key; no existing key fit) decide catches a thrown request and returns false; approve failure toasts planApproveFailed, reject failure toasts planRejectFailed. Covered by the spec.
Size-ceiling comment trail (Info) scripts/frontend_file_size_known_large.py # #20853: 2166 -> 2157 added above the entry (the inline trail would have exceeded the 120-column flake8 limit).
requires_confirmation:false test is a regression pin (Low, optional) not changed Left as is, as the review marked it optional.
Dynamic i18n key (Info) not changed planRejectFailed is used through the same notify path; the i18n usage check is left to CI.

Verification (scratch copy): vitest on the two new specs, WorkflowRunner.stepApproval.spec.ts and src/views passed (60 files, 445 tests); vue-tsc --noEmit -p tsconfig.app.json over the whole project exited 0.

@mrveiss

mrveiss commented Nov 8, 2026

Copy link
Copy Markdown
Owner Author

Landed on main via merge train #21125 (T95), merge commit 77eaa31. Frozen head e7eeeba is an ancestor of that merge commit (git merge-base --is-ancestor e7eeeba033 77eaa315ef exits 0). Closes #20853; Refs #21033 stays open.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working frontend phase:M3.7 Company OS, Automation and BI screens

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(frontend): the workflow plan approval can be decided twice while the first request is in flight

1 participant