feat: BrainDump completion toast — close button + display-duration preference (#109)#119
Conversation
…erence (#109) Add a sonner close (✕) button to the BrainDump completion toast and a persisted, configurable display duration (braindumpToastDurationMs) that controls how long the toast lingers before it auto-dismisses. - New preference braindumpToastDurationMs (default 5000ms, clamped [2000,10000]) mirrors the #108 11-file preference pattern: constant, Zod schema field (.finite().transform(clamp).catch(default)), slice reducer+selector+action, cross-window sync allowlist, BrainDumpAppearance slider, BrainDumpEditor consume. - showCompletionToast helper centralizes toast.success with closeButton:true, duration, action(Undo), and onAutoClose/onDismiss callbacks for both the complete-only (site A) and clear-on-complete (site B) paths. - Site B disambiguates Undo-via-onDismiss from a real dismiss with a wasUndoCalled guard so the restored line survives a close click. - scheduleDeferredClear clamps the effective clear delay to the toast duration (min) so a line never outlives its own Undo toast. - Toaster sets closeButtonAriaLabel: 'Dismiss' (Toaster-level per sonner 2.x). Tests: schema defaults/clamp/NaN-heal, slice reducer+selector, cross-window propagation, appearance slider (track/readout/always-enabled/step), and editor toast (closeButton+duration, description copy, Undo-restore, min clamp). Closes #109
… toast copy Cross-model design-review on #109: the dynamic Undo-window copy read as a system instruction ("Tap Undo within N s to revert.") and rounded the seconds with Math.round, which over-promises the Undo window at half-step slider settings (2500ms -> "3 s" while the toast closes at 2.5s) — the regret-UNSAFE direction, against the feature's own regret-safe framing. - Reword to the DESIGN.md quiet-companion voice: "Undo stays here for N s if you need it." (offer, not command). - Math.round -> Math.floor so the stated window is never longer than the real one (under-promise, never over-promise). - Update the one DAMP assertion that pins the exact copy (8s case).
…t-companion voice Cross-model design-review on #109: the appearance helper ended on an imperative UI command ("Press the ✕ to dismiss it sooner."), which slips out of the DESIGN.md quiet-companion voice the rest of the BrainDump copy holds (the #108 sibling helper reads as a gentle soft-exit). Reword to a calm, declarative line: "The ✕ lets it fade early." — keeps the close affordance explicit without barking an instruction.
…tion (#109) The existing copy spec used 8000ms where floor==round, so FINDING-001's regret-safe floor (never over-promise the Undo window) was untested at the discriminating input. The slider's 500ms step makes 2500ms reachable; this asserts it reads "2 s" (floor), never "3 s" (round).
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (12)
📝 WalkthroughWalkthroughBrainDump adds a configurable completion-toast duration preference, persists and syncs it, exposes it in appearance settings, and uses it in completion-toast rendering and deferred clearing. ChangesBrainDump completion toast duration
Sequence Diagram(s)sequenceDiagram
participant BrainDumpEditor
participant showCompletionToast
participant Toaster
participant Sonner
BrainDumpEditor->>showCompletionToast: pass title, durationMs, onUndo, onAutoClose, onDismiss
showCompletionToast->>Toaster: render toastOptions with closeButtonAriaLabel
Toaster->>Sonner: open completion toast
Sonner-->>showCompletionToast: onUndo / onAutoClose / onDismiss
showCompletionToast-->>BrainDumpEditor: undoCompleted or confirmClearedCompletion
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Possibly related issues
Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #119 +/- ##
==========================================
+ Coverage 67.57% 67.81% +0.23%
==========================================
Files 139 139
Lines 4420 4449 +29
Branches 1210 1216 +6
==========================================
+ Hits 2987 3017 +30
+ Misses 1215 1214 -1
Partials 218 218 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Summary
Adds the two things issue #109 asked for on the BrainDump completion toast:
Close button (✕)
closeButton: trueper-toast → top-left placement; Toaster-levelcloseButtonAriaLabel: 'Dismiss').onDismissfrom a real ✕/auto close with awasUndoCalledguard, so a restored line survives a ✕ click.Display-duration preference (ms)
braindumpToastDurationMspreference, expressed in milliseconds, following Users can set how long a completed BrainDump task stays before it clears (delay in ms) #108'sbraindumpClearDelayMs11-file pattern exactly: constant (src/lib/constants/braindump.ts, bounded[2000, 10000]ms, default5000, step500), Zod field, slice state/selector/action, cross-window sync allowlist, and an appearance slider.duration, so the next completion toast stays for the configured time.scheduleDeferredClearclamps the effective clear delay tomin(clearDelayMs, braindumpToastDurationMs)so a cleared line can never outlast its own Undo toast.braindump*field.Design refinements folded in (FINDING-001 regret-safe
Math.floorUndo-window copy + quiet-companion voice; FINDING-002 softened helper copy). The spec's open question — whether to offer an infinite "stay until I close it" duration — was resolved by autoplan as no: a bounded slider, deliberately (the ✕ already covers manual dismissal).Commits (
git log origin/main..HEAD):06c453afeat: BrainDump completion toast close button + display-duration preference (BrainDump completion toast: add a close button + a setting for how long it stays #109)f9baa10style(design): FINDING-001 — regret-safe, quiet-companion Undo-window toast copy23f65eestyle(design): FINDING-002 — soften the toast-duration helper to quiet-companion voicefc556d9test: cover regret-safe Math.floor Undo-window copy at half-step duration (BrainDump completion toast: add a close button + a setting for how long it stays #109)Test Coverage
All six acceptance criteria are unit-covered;
pnpm validategreen on CI Node 24.13.0 — 709 passed | 33 skipped, build/typecheck/lint exit 0.closeButton: true+closeButtonAriaLabel: 'Dismiss'; Undo-survives-✕ guarded by thewasUndoCalledtest.Math.floorhalf-step branch (reachable via the 500 ms slider step) was previously untested;fc556d9adds a discriminating2500 ms → "2 s"(never "3 s") regression test.Live UI note: BrainDumpEditor/BrainDumpAppearance are
isBrainDumpEnvironment()-gated and the slider sits behind auth, so the interactive path is auth + Electron-gated and not locally drivable; CI E2E is the regression gate and the renderer ships via Vercel on merge (same precedent as #92/#95/#104).Pre-Landing Review
/review(Standards + Spec, parallel sub-agents, fixed pointorigin/main...HEAD) — clean on both axes at HEAD. Noany, functional components,@/imports, constants asSCREAMING_SNAKE_CASEwith_MSsuffix, JSDoc present; spec ACs 1-6 all satisfied; the bounded-range resolution of the infinite-duration open question confirmed as deliberate, not a missing requirement. React Compiler is enabled, so manual-memo findings were correctly treated as false positives.Design Review
/design-reviewran (cross-model Codex + web-designer lens): 2 findings, both auto-fixed, clean after. FINDING-001 (regret-safeMath.floorso the Undo-window copy never over-promises remaining time + warmer copy) and FINDING-002 (softened the duration-helper voice to DESIGN.md's quiet self-affirmation register). No AI-slop; copy uses curly quotes and the quiet-companion voice.Adversarial Review
Cross-model Codex adversarial pass raised 2 High findings; both were verified against primary source and judged non-blocking, pre-existing, and non-data-loss:
braindumpToastDurationMsblob bypasses the Zod clamp on the localStorage hydrate path (it feeds the sonnerduration/copy/timer). Pre-existing & deliberate:store.ts:52-62documents thedeepMerge-not-Zod-reparse design ("preserve beats reject"), and Users can set how long a completed BrainDump task stays before it clears (delay in ms) #108's shippedselectBraindumpClearDelayMsuses the identical?? DEFAULTno-clamp read — this property applies to all numeric prefs equally, is corrupt-blob-only (normal writes always go through the clamping setter), and is cosmetic, not data-loss. BrainDump completion toast: add a close button + a setting for how long it stays #109'smin(clearDelayMs, braindumpToastDurationMs)actually caps the clear timer more tightly than Users can set how long a completed BrainDump task stays before it clears (delay in ms) #108, and the new ✕ improves the stuck-toast case. Recorded as a follow-up candidate, not changed here — clamping Users can set how long a completed BrainDump task stays before it clears (delay in ms) #108's shipped read path is out of BrainDump completion toast: add a close button + a setting for how long it stays #109's scope.Plan Completion
Plan:
~/.gstack/projects/laststance-corelive/feat-109-braindump-toast-controls-plan.md— 12 DONE, 1 CHANGED (design copy refinement, intentional), 1 DEFERRED (E1 infinite-duration — plan-blessed: bounded slider chosen), 2 UNVERIFIABLE locally (CI E2E gate, native QA). Scope check: CLEAN — no #108 clear-delay behavior change, no AI/auto-label work.Closes #109
TODOS
No TODO items completed in this PR.
Test plan
pnpm validategreen on CI Node 24.13.0 — 709 passed | 33 skipped; build, typecheck, lint exit 0fc556d9)/reviewStandards + Spec clean;/design-reviewclean (2 findings auto-fixed); Codex adversarial findings verified pre-existing/non-blocking🤖 Generated with Claude Code
Summary by CodeRabbit
New Features
Bug Fixes