Repository navigation
fix(scaffolder): post-create refresh + existing-root gate (#7974) - #10272
Conversation
Design Review (Fable 5) — ✅ PASSDesign-level review of Design-Verdict: PASS Re-derives the preview from the scan endpoint (the existing source of truth) instead of hand-patching client state — root-cause fix, failure path handled and tested. [DESIGN-REVIEWED] 615290c |
GPT 5.6 Review — ✅ no blocking findingsGPT 5.6 completed its review of This comment is updated in place on each push. Review detailsNo findings. False positive or not applicable? A repository writer can comment: |
First Principles Review (Fable 5) — 🟡 CONCERNSPremise-level review of All mechanical checks done. Findings summary before the verdict: the two fixes (post-create refresh, existing-root gating) are well-grounded — the re-scan approach follows the recorded decision in First-Principles-Verdict: CONCERNS Two riders on a two-defect fix: the row redesign replaces a pinned decision on unlinked evidence, and the pill relabel rests on consistency alone. Not justified as shipped
What this change shipsInventory (7 items) — 5 justifiedIntent: stop the scaffolder from inviting a create whose only possible outcome is a no-op, after a create or on an already-scaffolded root. FIX (issue #7974, deferred from the #5890 UX review).
Watch
Subtractions
[FIRST-PRINCIPLES-REVIEWED] 615290c |
UX Review (Fable 5) — 🟡 CONCERNSUX-level review of All evidence is in hand. The blind read ran, all four screenshots plus a recording of the cross-fade are supplied, and the primary controls (Scan, checkboxes, Create) were read correctly and confidently. The remaining findings are copy-coherence problems the blind reader hit directly on the new post-create landing state and the reused empty-state string. UX-Verdict: CONCERNS One string does duty on two screens and is literally false on one of them: "nothing left to create" renders above a still-tickable row. Watch
[UX-REVIEWED] 615290c |
Opus 4.8 Review — ✅ no blocking findingsReviewed Verdict parsed from the review's SHA-scoped output markers for commit False positive or not applicable? A repository writer can comment: |
e53ac84 to
a7d824c
Compare
a7d824c to
0faf0f6
Compare
0faf0f6 to
c16b811
Compare
c16b811 to
ef6873f
Compare
After a successful create, re-scan the created-into root so the just-created rows flip to the "Already set up" badge instead of staying ticked, while a new keepResult flag on the scan mutation keeps the Results card on screen. In the empty-state branch, render the root-existing badge, disable "Create the root folder only", and switch the subtitle when the root folder already exists. Closes #7974
ef6873f to
615290c
Compare
|
|
|
|
|
|
|
|
|
…#7974) (kirodotdev#10272) After a successful create, re-scan the created-into root so the just-created rows flip to the "Already set up" badge instead of staying ticked, while a new keepResult flag on the scan mutation keeps the Results card on screen. In the empty-state branch, render the root-existing badge, disable "Create the root folder only", and switch the subtitle when the root folder already exists. Closes kirodotdev#7974
Problem / Motivation
Two leftovers on the Project Scaffolder page, both deferred from the UX review of PR #5890.
Why it matters
The preview is the page's confirmation step. When it stops matching what is on disk, the user is invited to click a button whose only possible outcome is a no-op result that contradicts what they just did. Both paths waste a request and teach the user to distrust the preview.
What changed (motivation → approach → change)
The scan response already knows the truth (
existingper row,root_existingfor the root). So after a create succeeds, the page now asks for that truth again:createMut.onSuccessre-runs the scan against the root the create actually ran against (scanRootfrom the mutation's own variables, not the live field, which may have drifted).A plain re-scan would wipe the Results card the user is reading —
scanMut.onSuccessclears it. The scan mutation now takes{ path, keepResult }. The post-create refresh setskeepResult: true, which keeps the Results card, keeps the drift baseline (scannedInput), keeps the disclosure open, and keeps the user's hand-tuned selection (intersected with rows still creatable, so a row the user deliberately unticked is not re-armed by the server default). Manual Re-scan and Enter-scan behave exactly as before. A failed refresh renders in the root field's error slot and leaves the Results card alone.The empty-state branch, when
scan.root_existingis true, removes the "Create the root folder only" action entirely and switches the subtitle to a new i18n key (root_already_exists_nothing_to_create, added to all locales) — the subtitle states the outcome, and no control renders that could contradict it (a first iteration shipped a badge plus a disabled button; the UX review of that iteration blocked it because the dimmed button still read as clickable and contradicted the copy). The populated preview's landing state after a refresh is gated the same way: with the root's folder in place and nothing ticked, "Create sidebar folders" is disabled and a one-line reason (the same string) renders beside it.Existing rows changed shape for the same reason, on the same UX evidence: a cold reader took the reduced-opacity disabled checkbox for a tickable control ("I can't tell if they're just unticked or actually locked"). An already-scaffolded row is pure state — it renders a
FolderCheckicon (keeping the row's path as its accessible name) instead of a disabled checkbox, and because a create flipsrow.existingon the very row the user just ticked, the checkbox cross-fades into the icon through one animated slot (framer-motion, the codebase's standard) rather than hard-swapping. The Results card's skipped pill now says "already set up", the same words the row badges use, so the two surfaces stop describing one fact in two vocabularies.flowchart LR subgraph Before A1[create succeeds]:::ctx --> B1[Results card]:::ctx B1 --> C1[preview keeps stale ticks]:::removed end subgraph After A2[create succeeds]:::ctx --> B2[Results card]:::ctx A2 --> D2[re-scan scanRoot, keepResult]:::added D2 --> E2[rows flip to Already set up]:::added end classDef added fill:#DCFCE7,stroke:#16A34A,color:#14532D,stroke-width:2px classDef changed fill:#FEF3C7,stroke:#D97706,color:#78350F,stroke-width:2px classDef removed fill:#FEE2E2,stroke:#DC2626,color:#7F1D1D,stroke-dasharray:4 3 classDef ctx fill:#E0F2FE,stroke:#0284C7,color:#0C4A6E linkStyle 1 stroke:#DC2626,stroke-dasharray:4 3 linkStyle 3,4 stroke:#16A34A,stroke-width:2px🟩 added · 🟥 removed · 🟦 unchanged
Create now refreshes the preview it just outdated; the Results card stays.
Tests
Added to
website/src/test/ProjectScaffolderPage.test.tsx:scanProjectis called a second time with the scanned root; the created rows lose their checkbox and render as read-only "Already set up" state (icon keeps the path as its accessible name) whileresult-createdis still in the document, and the landing state's create button is disabled with a reason line beside itresult-createdand the preview in the documentstatus: 'empty'androot_existing: true, the empty state offers no create action at all and the subtitle explains whystatus: 'empty'androot_existing: false, the button stays enabled (regression guard)Existing create-success tests were extended to queue the refresh response and settle on it.
Manual verification
Drove both flows in a browser against a mocked backend (Vite harness + Playwright): populated preview → create → refreshed preview with kept Results card and disabled no-op button; empty scan with existing root → badge, disabled button, new subtitle. DOM state asserted, screenshots below are from those runs.
npx tsc -b, eslint on touched files, andnpm run i18n:check(withI18N_BASE_REF=main) all pass locally; vitest runs in CI.Screenshots / video
Populated preview after a create — before: rows stay ticked and enabled; after: created rows lose their checkbox and read as "Already set up" state, Results card kept, no-op create disabled.
The create click itself — rows cross-fade from ticked checkboxes to the done state while the Results card stays:
create-transition.webm
Empty scan with an existing root — before: enabled button with no explanation; after: no action is offered and the subtitle states there is nothing left to create.
Related Issues
Closes #7974
Pattern harvest
Rule candidate: review-prompt
Pattern: a mutation's success handler updates the outcome surface but leaves the source preview stale, inviting a no-op retry — after a state-changing mutation, re-derive every dependent view or gate the action it feeds.
Checklist
feat|fix|docs|refactor|perf|test|chore|ci|build|revert: ...)