Skip to content

Fix section regeneration and workspace autosave ordering - #89

Merged
Programcode merged 2 commits into
mainfrom
fix/ultrareview-ui-findings
Oct 2, 2026
Merged

Programcode merged 2 commits into
mainfrom
fix/ultrareview-ui-findings

Conversation

@Programcode

Copy link
Copy Markdown
Owner

Fixes the four findings from the ultrareview of the UI code.

Bugs

Regenerating one Generate section blanked the whole result. handleRegenerateSection set generateLoading, the flag behind the full-page "generating case" screen. So clicking a section's Regenerate button unmounted every section and the Export/Save/Discuss toolbar until the call returned. The page now tracks regeneratingSection on its own. Only that SectionCard shows an overlay (Regenerating <section>…, translated into en/es/hu). The other regenerate buttons and the form's submit button wait for it to finish, because each regeneration merges into the result it started from, and two at once would overwrite each other.

Crossfire and Sparring workspace autosaves could store older progress. Every state change, so every keystroke in Crossfire setup, fired an unordered save_workspace_artifact RPC for the same request ID. The RPC overwrites the row with whatever arrives, so a slower, older save could land last. The new createArtifactSaveQueue (src/lib/workspace/artifact-save-queue.ts) keeps one save in flight and holds only the newest payload per request ID. A finished round's final complete save is kept when the next round starts. A failed save is logged and doesn't stall the queue, and it's no longer an unhandled rejection. The fix is client-only; it needs no migration or Edge Function deploy.

Cleanups

  • OfflineIndicator, SparringSetup, SparringRound and SparringPage now use useOnlineStatus() instead of their own listeners. The hook now reads the event type (as the copies did) and guards a missing navigator. SparringPage keeps its retry-on-reconnect behavior through an effect on isOnline.
  • GenerateForm's five copied Select blocks are now a local OptionSelect helper. The rendered labels and values are unchanged.

Verification (local, on this commit's tree)

  • New failing-first tests: GeneratePage.test.tsx ("keeps the results on screen while one section regenerates"), CrossfirePage.test.tsx (workspace autosave fired 4 concurrent saves before the fix, 1 after), artifact-save-queue.test.ts (ordering, coalescing, per-request flush, failure recovery), and GenerateResultsRegenerate.test.tsx (overlay on the right card, buttons disabled).
  • npm run lint, npm run typecheck, npm run docs:check and npm run build pass. npm test -- --coverage passes: 118 files, 1216 tests.
  • npm run test:e2e (desktop and mobile Chromium): 249 passed, 6 skipped, 1 flaky (navigation-performance cold-route timing on desktop, passed on retry; unrelated to these files).
  • verify-debatelab, fake provider: drive recipes/case-generation passed 14 of 14 on desktop-chromium and mobile-chromium. That includes the new gen-regenerate recipe, which holds the regenerate request and checks that only the Arguments overlay shows while the thesis and toolbar stay visible. I also ran gen-regenerate against the old GeneratePage.tsx, and it failed at the overlay check as expected.
  • Not proven in a browser: the workspace autosave fix. Workspace mode is hidden in production (VITE_COLLABORATION_URL unset) and the verify stack doesn't run it, so the unit and page tests are the evidence. No database gate was run because nothing under supabase/ changed.

🤖 Generated with Claude Code

https://claude.ai/code/session_01CNnE2EyywE54QHAFuAFZr5

Regenerating one Generate section set the full-generation loading flag,
which unmounted every result and the toolbar until the call returned.
It now tracks the regenerating section separately: only that card shows
an overlay, and the other regenerate buttons and the form wait for it,
so two regenerations cannot merge over each other.

Crossfire and Sparring workspace autosaves fired an unordered RPC on
every change. A slower, older save could land last and store shorter
progress. A small queue now keeps one save in flight and sends only the
newest payload per request ID, so a finished round's last save survives
the next round starting.

Also reuses useOnlineStatus in four components that rebuilt it, and
replaces five copied Select blocks in GenerateForm with a local helper.
Adds the gen-regenerate verify recipe.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CNnE2EyywE54QHAFuAFZr5
Copilot AI balanced review requested due to automatic review settings October 2, 2026 11:11
@vercel

vercel Bot commented Oct 2, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
debate-navigator Ready Ready Preview Oct 2, 2026 11:26am UTC

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@coderabbitai

coderabbitai Bot commented Oct 2, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

Next included review available in 34 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

Configuration used: Organization UI

Review profile: CHILL

Plan: Free

Run ID: daaeecd7-a570-4417-b319-f4d0627765f8

📥 Commits

Reviewing files that changed from the base of the PR and between 11c8bf5 and d393781.

📒 Files selected for processing (22)
  • .claude/skills/verify-debatelab/features/README.md
  • .claude/skills/verify-debatelab/features/case-generation.md
  • .claude/skills/verify-debatelab/recipes/case-generation.spec.ts
  • src/components/OfflineIndicator.tsx
  • src/components/features/generate/GenerateForm.tsx
  • src/components/features/generate/GenerateResults.tsx
  • src/components/features/sparring/SparringRound.tsx
  • src/components/features/sparring/SparringSetup.tsx
  • src/components/ui/section-card.tsx
  • src/hooks/use-online-status.ts
  • src/lib/stores/session-store.ts
  • src/lib/workspace/artifact-save-queue.ts
  • src/locales/en.json
  • src/locales/es.json
  • src/locales/hu.json
  • src/pages/CrossfirePage.tsx
  • src/pages/GeneratePage.tsx
  • src/pages/SparringPage.tsx
  • src/test/components/GenerateResultsRegenerate.test.tsx
  • src/test/pages/CrossfirePage.test.tsx
  • src/test/pages/GeneratePage.test.tsx
  • src/test/workspace/artifact-save-queue.test.ts
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Autopilot is currently an internal CodeRabbit preview.


Note

🎁 Summarized by CodeRabbit Free

Your organization is on the Free plan. CodeRabbit will generate a high-level summary and a walkthrough for each pull request. For a comprehensive line-by-line review, please upgrade your subscription to CodeRabbit Essentials by visiting https://app.coderabbit.ai/settings/billing.

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

@Programcode

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Oct 2, 2026 •

Copy link
Copy Markdown
⚠️ Action not completed

Review rate limited.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Codex review found two ways a pending regeneration could overwrite a
newer case. Leaving Generate and coming back reset the page-local
in-flight state, so another generation could start and the older
callback would then replace its result. And Undo, now reachable while a
section regenerates, was reverted when the section came back.

The regenerating section now lives in the session store (not persisted),
so it survives a remount. A regeneration is dropped if the case changed
since it started, and Undo is disabled while one runs.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CNnE2EyywE54QHAFuAFZr5
@Programcode

Copy link
Copy Markdown
Owner Author

CodeRabbit was rate-limited, so this PR was reviewed with Codex (gpt-6.1-sol, high effort, codex review --base origin/main). It raised two P2 findings at 2e6ceaa. Both were real, and both are fixed in d393781:

  • Regeneration state lost on remount (GeneratePage.tsx). Fixed: the regenerating section moved from page state into the session store (excluded from persistence), so leaving Generate and coming back still shows the overlay and blocks a second generation. Test: "keeps a pending regeneration visible after leaving Generate and coming back".
  • Undo during a regeneration got reverted. Fixed: Undo is disabled while a section regenerates. As a second guard, a regeneration is now dropped if the stored case changed after it started, which also covers a new generation. Tests: "drops a regenerated section when the case changed while it was running" and the Undo assertion in GenerateResultsRegenerate.test.tsx.

Rechecked locally at d393781: lint, typecheck and build pass, and the unit suite passes (118 files, 1218 tests). verify.sh drive recipes/case-generation passed 14 of 14 on desktop and mobile Chromium.

@Programcode

Copy link
Copy Markdown
Owner Author

Codex re-review of d393781 (gpt-6.1-sol, high effort): no actionable findings. It ran 94 focused tests, typecheck, lint, docs check and the build, and all passed.

@Programcode
Programcode merged commit cf89554 into main Oct 2, 2026
8 checks passed
@Programcode
Programcode deleted the fix/ultrareview-ui-findings branch October 2, 2026 11:50

This branch was successfully deployed

1 active deployment
Preview — d393781f Deployed Oct 2, 2026 by vercel[bot]
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.

2 participants