Skip to content

feat(ui): add toast feedback, payment confirm dialog, and queue auto-triage#21

Merged
chitcommit merged 4 commits intomainfrom
feat/mcp-ui-polish-20260307
Mar 7, 2026
Merged

feat(ui): add toast feedback, payment confirm dialog, and queue auto-triage#21
chitcommit merged 4 commits intomainfrom
feat/mcp-ui-polish-20260307

Conversation

@chitcommit
Copy link
Contributor

@chitcommit chitcommit commented Mar 7, 2026

Summary

Improve dashboard and queue UX by adding structured feedback and safer payment actions.

What Changed

  1. Added a global toast system (ToastProvider, useToast, toast viewport UI).
  2. Added reusable confirmation modal (ConfirmDialog).
  3. Added Dashboard payment confirmation flow before markPaid.
  4. Added success/error/info toast feedback for payment and queue decisions.
  5. Added first-load auto-triage in Action Queue when queue is empty.
  6. Updated payment button labels from “Pay” to “Mark Paid” where relevant.
  7. Added restated adversarial-review planning doc.

Validation

  1. npm run typecheck passed
  2. npm test passed (15/15)
  3. npm run ui:build passed

Notes

  1. UI build reports a chunk-size warning (non-blocking).
  2. Root repo has no lint script configured, so lint was not part of validation.

Summary by CodeRabbit

  • New Features

    • Toast notification system (success/error/info) with actions and dismissals
    • Accessible confirmation dialog component for critical actions
    • Two-step payment flow: request + confirm with contextual feedback
  • Documentation

    • Added adversarial review restatement with verified findings, fixes, and prioritized roadmap
  • Updates

    • Button labels updated for clearer obligation management (e.g., "Mark Paid")

Copilot AI review requested due to automatic review settings March 7, 2026 18:45
@github-actions
Copy link

github-actions bot commented Mar 7, 2026

  1. @coderabbitai review
  2. @copilot review
  3. @codex review
  4. @claude review
    Adversarial review request: evaluate security, policy bypass paths, regression risk, and merge-gating bypass attempts.

@coderabbitai
Copy link

coderabbitai bot commented Mar 7, 2026

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: e0df09c6-c230-4780-b2ac-bd2094757659

📥 Commits

Reviewing files that changed from the base of the PR and between 74493fe and 8bf2e8e.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (11)
  • docs/plans/2026-03-05-adversarial-review-restated.md
  • package.json
  • ui/src/components/dashboard/FocusView.tsx
  • ui/src/components/dashboard/ObligationsWidget.tsx
  • ui/src/components/ui/ActionButton.tsx
  • ui/src/components/ui/ConfirmDialog.tsx
  • ui/src/components/ui/Toast.tsx
  • ui/src/lib/toast.tsx
  • ui/src/main.tsx
  • ui/src/pages/ActionQueue.tsx
  • ui/src/pages/Dashboard.tsx

📝 Walkthrough

Walkthrough

Adds a toast notification system and ConfirmDialog component, integrates toast UX across dashboard and action-queue flows (including auto-triage and payment confirmation), updates obligation button labels to "Mark Paid", and adds an adversarial-review planning document. No public API surface changes beyond UI exports.

Changes

Cohort / File(s) Summary
Documentation & Planning
docs/plans/2026-03-05-adversarial-review-restated.md
Adds a restated adversarial review plan: corrected claims, verified findings, flaws, required fixes, and prioritized roadmap (P0–P4).
Toast System Infrastructure
ui/src/lib/toast.tsx, ui/src/components/ui/Toast.tsx
New toast context/provider and hook plus ToastViewport component: queue (max 4), auto-dismiss timers, dismiss API, convenience helpers (success/error/info), and UI rendering with variant styles and optional action buttons.
Dialog Component
ui/src/components/ui/ConfirmDialog.tsx
New accessible ConfirmDialog: portal rendering, backdrop/click and Escape handling, focus trap/restoration, configurable labels/variant, loading state, and confirm/cancel callbacks.
Button & UI Text Updates
ui/src/components/dashboard/FocusView.tsx, ui/src/components/dashboard/ObligationsWidget.tsx
Renames obligation action labels from "Pay Now"/"Pay" to "Mark Paid" (behavior unchanged).
App Integration
ui/src/main.tsx
Wraps app with ToastProvider at root so toast context is available across the app.
ActionQueue: Triage & Toasts
ui/src/pages/ActionQueue.tsx
Adds auto-triage/runTriage workflow, integrates useToast for success/error/info toasts, auto-trigger on empty queue (one-time guard), improved error handling, and updated pagination/load-more behavior to avoid auto-triage.
Dashboard: Payment Confirmation
ui/src/pages/Dashboard.tsx
Implements requestPayNow → pendingPayment → ConfirmDialog flow; finalizes payments on confirm via API, shows success/error toasts, reloads data, and preserves payingId semantics.
Button API Change
ui/src/components/ui/ActionButton.tsx
Converts ActionButton to forwardRef component, adds type and autoFocus props and forwards ref to underlying button.
Dependency Bump
package.json
Bumps hono dependency version from ^4.4.0 to ^4.12.5.

Sequence Diagram(s)

sequenceDiagram
  participant User
  participant Dashboard as Dashboard UI
  participant API as Server API
  participant Toast as ToastProvider/Viewport
  rect rgba(200,220,255,0.5)
    User->>Dashboard: click "Mark Paid" (requestPayNow)
    Dashboard->>Dashboard: set pendingPayment & open ConfirmDialog
    User->>Dashboard: confirm payment
    Dashboard->>API: POST /pay (mark paid)
    API-->>Dashboard: 200 OK
    Dashboard->>Toast: show success toast
    Dashboard->>Dashboard: reload data, clear pendingPayment
  end
Loading
sequenceDiagram
  participant User
  participant ActionQueue as ActionQueue UI
  participant API as Server API
  participant Toast as ToastProvider/Viewport
  rect rgba(220,255,200,0.5)
    User->>ActionQueue: open queue (empty)
    ActionQueue->>ActionQueue: runTriage(auto)
    ActionQueue->>API: POST /triage/auto
    API-->>ActionQueue: triage results
    ActionQueue->>Toast: show success/info/error toast
    ActionQueue->>ActionQueue: loadQueue(refresh)
  end
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related PRs

Poem

🐰 I hop with toasts that sing and dialogs that shine,
A click marks paid and triage hums in line.
Buttons renamed, confirmations near,
Toasts cheer success and hush each fear.
A nibble of code — a carrot of bright UI. 🥕

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the three main additions: toast feedback system, payment confirmation dialog, and queue auto-triage. It is specific, concise, and directly reflects the primary changes in the changeset.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/mcp-ui-polish-20260307

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

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds shared UI primitives (toasts + confirm dialog) and uses them to improve safety/feedback around payment actions and queue triage behavior in the ChittyCommand UI.

Changes:

  • Introduces a global toast system (ToastProvider, useToast, ToastViewport) and wires it into the app root.
  • Adds a reusable ConfirmDialog and applies it to Dashboard “mark paid” flow (with toast feedback).
  • Adds first-load auto-triage when the Action Queue is empty and adds toast feedback for triage + decisions.

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
ui/src/pages/Dashboard.tsx Adds payment confirmation dialog and success/error toast feedback around markPaid.
ui/src/pages/ActionQueue.tsx Adds auto-triage on empty first load and toast feedback for triage + approve/reject/defer.
ui/src/main.tsx Wraps the app in ToastProvider to enable global toasts.
ui/src/lib/toast.tsx Implements toast state/timers, ToastProvider, and useToast hook.
ui/src/components/ui/Toast.tsx Adds toast viewport UI rendering and interactions.
ui/src/components/ui/ConfirmDialog.tsx Adds reusable confirmation modal for risky actions.
ui/src/components/dashboard/ObligationsWidget.tsx Renames “Pay” button label to “Mark Paid”.
ui/src/components/dashboard/FocusView.tsx Renames “Pay Now” CTA to “Mark Paid”.
docs/plans/2026-03-05-adversarial-review-restated.md Adds a planning/restatement doc capturing verified findings and priority order.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 4

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@ui/src/components/ui/ConfirmDialog.tsx`:
- Around line 28-76: ConfirmDialog lacks focus management: implement focus
trapping, initial focus, aria-describedby, and focus restoration. In the
ConfirmDialog component, add refs for the dialog container and the confirm
ActionButton (e.g., confirmButtonRef and dialogRef), set aria-describedby on the
dialog to the message element id, save document.activeElement on open and
restore it on close, move initial focus to the confirm button when open
(confirmButtonRef.focus()), and implement a focus trap inside the useEffect
(handle Tab/Shift+Tab to cycle focus within dialogRef) or replace the component
with an accessible dialog from a library like Radix UI or Headless UI; ensure
onCancel/onConfirm still respect loading and that event listeners are cleaned up
on unmount.

In `@ui/src/lib/toast.tsx`:
- Around line 66-72: The toast cap currently keeps the last four then appends
nextToast (allowing 5) and never clears timers for evicted toasts; change the
queuing logic so you keep only the last three existing toasts before appending
nextToast (use prev.slice(-3) as the kept list) and compute which toasts were
dropped (prev minus kept) and for each dropped toast id clearTimeout on
timers.current.get(id) and delete the entry from timers.current before calling
setToasts([...kept, nextToast]); ensure you still register the new timeout using
timers.current.set(id, timer) and use existing dismissToast for removal.

In `@ui/src/pages/ActionQueue.tsx`:
- Around line 90-112: handleDecide can be invoked multiple times before the
first async request completes; to prevent duplicate decideQueue() mutations, add
a pending-tracker (e.g., a Set stored on a ref like pendingDecisionsRef) and
check it at the start of handleDecide: if the id is present, return early;
otherwise add id to the set before awaiting api.decideQueue and remove it in a
finally block so the id is cleared on success or failure. Update references in
handleDecide (sessionId, items, setItems, loadStats, toast) accordingly so the
guard prevents duplicate network calls and duplicate toasts while the first
decision is pending.

In `@ui/src/pages/Dashboard.tsx`:
- Around line 30-49: The handler handleConfirmPayNow can be invoked twice before
payingId state updates, causing duplicate api.markPaid calls; fix by adding a
synchronous guard using a ref (e.g., payingIdRef) that is checked and set at the
start of handleConfirmPayNow (alongside setting state via setPayingId) to
prevent re-entry, then clear the ref in the finally block; update references to
use pendingPayment.id and api.markPaid as before and keep setting/clearing the
payingId state for UI, ensuring the ref is the authoritative in-flight marker so
rapid double-clicks cannot trigger duplicate requests (also maintain the
existing error/toast/finally behavior).

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: decd6a0b-cd07-493e-b82c-0e42392b882a

📥 Commits

Reviewing files that changed from the base of the PR and between 74493fe and df1b309.

📒 Files selected for processing (9)
  • docs/plans/2026-03-05-adversarial-review-restated.md
  • ui/src/components/dashboard/FocusView.tsx
  • ui/src/components/dashboard/ObligationsWidget.tsx
  • ui/src/components/ui/ConfirmDialog.tsx
  • ui/src/components/ui/Toast.tsx
  • ui/src/lib/toast.tsx
  • ui/src/main.tsx
  • ui/src/pages/ActionQueue.tsx
  • ui/src/pages/Dashboard.tsx

@chitcommit chitcommit enabled auto-merge (squash) March 7, 2026 18:53
@chitcommit
Copy link
Contributor Author

@codex[agent] open a new pull request to apply changes based on the comments in this thread

@Codex
Copy link
Contributor

Codex AI commented Mar 7, 2026

@chitcommit I've opened a new pull request, #22, to work on those changes. Once the pull request is ready, I'll request review from you.

@chatgpt-codex-connector
Copy link

Summary

Testing

  • npm run typecheck
  • npm test
  • npm run ui:build

View task →

@github-actions
Copy link

github-actions bot commented Mar 7, 2026

  1. @coderabbitai review
  2. @copilot review
  3. @codex review
  4. @claude review
    Adversarial review request: evaluate security, policy bypass paths, regression risk, and merge-gating bypass attempts.

@chitcommit chitcommit merged commit d4d1548 into main Mar 7, 2026
10 of 11 checks passed
@chitcommit chitcommit deleted the feat/mcp-ui-polish-20260307 branch March 7, 2026 19:10
@coderabbitai
Copy link

coderabbitai bot commented Mar 7, 2026

I'll conduct a full adversarial review of this PR, evaluating security, policy bypass paths, regression risk, and merge-gating bypass attempts as requested.

Adversarial review requested. Please evaluate with focus on: (1) security vulnerabilities in the new toast/dialog/payment flows, (2) policy bypass paths (e.g., payment confirmation bypass, auto-triage policy bypasses), (3) regression risk against existing dashboard and queue behavior, and (4) any patterns that could be used to bypass merge-gating checks (e.g., test coverage gaps, suppressed errors, misleading loading states).


🧠 Learnings used
Learnt from: CR
Repo: chittyos/chittycommand PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2026-03-04T04:42:57.380Z
Learning: Resolve must-fix review comments (security, correctness, compliance, merge blockers) before merge
✅ Actions performed

Full review triggered.

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.

3 participants