Skip to content

First run starts with a debate - #82

Merged
Programcode merged 3 commits into
mainfrom
feat/first-run-debate
Oct 1, 2026
Merged

Programcode merged 3 commits into
mainfrom
feat/first-run-debate

Conversation

@Programcode

@Programcode Programcode commented Oct 1, 2026 •

Copy link
Copy Markdown
Owner

Item 13 of plans/2026-10-01-next-15.md: the first run now starts with a debate.

What changes

Tour. It opens on the Current Debate card with its own Start debate button, then shows Library and Generate. The old tour covered every tool and skipped Current Debate. The tour now has four steps. It pauses while the create dialog is open and continues on Library once the debate exists. Targets scroll clear of the sticky header; before this, the card ended up under the two-row header on mobile.

No Current Debate. A tool used to answer a submitted motion with the three-way "Which debate is this for?" dialog. Now it offers "Start a debate with this motion?" with Start debate or "Not now, use it once". If an existing debate has the same motion, the offer can still switch to it. The offer comes before the request because one-off results are never recorded. Offering afterwards would leave the first result outside the debate. Users who do have a Current Debate still get the mismatch dialog.

Language on first sign-in. The sign-up trigger creates user_settings with language = 'en', and the first hydrate applied it. A student who picked Hungarian before signing up was switched to English, which made the Hungarian journey impossible. Only the client writes feature_configs, so a row where it is {} has never been saved. For that row the client keeps its local language and output language and writes them back. Theme still comes from the server row as before; this PR leaves it alone.

UI review. Fable reviewed screenshots on desktop and mobile, light and dark, in English and Hungarian. Changes from that review:

  • step 1 has one primary action;
  • the tooltip is wider and left-aligned;
  • the Hungarian progress label is shorter ("Következő (1/4)"), so the footer fits on one line;
  • the typed motion is set as a quote in the offer.

Tour copy for the dropped steps is removed from all three locales.

Tests

  • Unit: the offer, declining it, switching to an existing match, and fresh-row language handling (debate-gates.test.tsx, settings-store.test.ts).
  • e2e/first-run.spec.ts: a credential-free fresh account in English and Hungarian, on desktop and mobile Chromium, with Supabase REST stubbed. This proves the client flow only.
  • e2e/full-stack/first-run.spec.ts: the same journeys against real Auth, RLS and Edge Functions with a fresh demo-code account. It asserts the debate row, the current pointer, user_settings.language, and that the generated case is saved into the new debate.
  • chooseForMotion in e2e/full-stack/stack.ts accepts the new offer, so the six existing full-stack specs that used the old dialog keep working.

Verification

Local runs on dc02f3b. These are not CI results.

  • docs:check, lint, typecheck: pass.
  • Unit with coverage: 1112 passed. The first run timed out on two unrelated tests (route preloading, Flowchart) while the machine's load average was 23; both pass alone and in the rerun.
  • test:collaboration 30 passed, test:edge 270 passed, build, test:sw: pass.
  • Credential-free Playwright, desktop and mobile Chromium: the full run found e2e/sparring.spec.ts still clicking the old no-debate button. It is fixed in dc02f3b, and the sparring, Factoids (flaky in that run) and first-run specs then passed, 96 of 96. The other 229 tests passed in the full run.
  • Database and full-stack gate (./.superset/db-gate.sh), local: pgTAP 345 PASS; Playwright 63 passed, 1 skipped. All eight first-run journeys (EN/HU × tour/offer × desktop/mobile) passed. Two earlier local attempts failed because another process on the shared VPS removed the debatelab-fake-openrouter container mid-run; that is not related to this change.
  • WebKit was not run.

CI on dc02f3b: quality, database-tests (the same full-stack gate on a clean runner, 15 minutes) and browser-tests pass. live-e2e fails: five of its live-provider tests fail the same way on main (scheduled run at 10:07 UTC). Here Factoids also failed with a live provider status error. None of the live specs go through the motion dialog.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features
    • The onboarding tour now starts with Current Debate, followed by Library and Generate, with updated guidance on how debates organize related content.
    • When using a motion-bearing tool without an active debate, you can start a debate with that motion or continue once without saving it to a debate.
  • Improvements
    • Language, output-language, and theme choices made before your first sign-in are retained when your settings are first loaded.

Programcode and others added 2 commits October 1, 2026 09:14
The tour now opens on the Current Debate card with a Start debate
button, pauses while the create dialog is open, then points at Library
and Generate. It scrolls targets clear of the sticky header.

With no Current Debate, a motion-bearing tool no longer shows the
switch dialog. It offers to start a debate from the typed motion, or to
run it once.

A brand-new account kept the server's default English after its first
sign-in, even when the student had picked Hungarian. A settings row the
client never saved now keeps the local language and stores it.

Playwright covers the first run for a fresh account in English and
Hungarian, credential-free and in the full-stack gate.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Copilot AI balanced review requested due to automatic review settings October 1, 2026 09:34
@vercel

vercel Bot commented Oct 1, 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 1, 2026 5:31pm 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 1, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Free

Run ID: 1724e708-4ab9-47f1-9b44-1374dbbb154e

📥 Commits

Reviewing files that changed from the base of the PR and between fe6100a and dc02f3b.

📒 Files selected for processing (16)
  • docs/architecture.md
  • docs/testing.md
  • e2e/first-run.spec.ts
  • e2e/full-stack/first-run.spec.ts
  • e2e/full-stack/stack.ts
  • e2e/home-navigation.spec.ts
  • e2e/sparring.spec.ts
  • src/components/features/debate/DebateMotionGate.tsx
  • src/components/features/onboarding/OnboardingTour.tsx
  • src/lib/stores/settings-store.ts
  • src/locales/en.json
  • src/locales/es.json
  • src/locales/hu.json
  • src/pages/HomePage.tsx
  • src/test/debate/debate-gates.test.tsx
  • src/test/stores/settings-store.test.ts

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

The first-run experience now includes settings preservation, a Current Debate onboarding step, and an offer to create a debate from a typed motion when no debate is current. English, Spanish, and Hungarian copy and tests cover these changes.

Changes

First-run experience

Layer / File(s) Summary
Preserve pre-sign-in settings
src/lib/stores/settings-store.ts, src/test/stores/settings-store.test.ts, e2e/full-stack/first-run.spec.ts
When server settings have empty feature configurations, hydration retains local language, output language, and theme choices and persists them. Tests cover default and saved server settings.
Current Debate onboarding tour
src/components/features/onboarding/OnboardingTour.tsx, src/pages/HomePage.tsx, src/locales/*.json, e2e/home-navigation.spec.ts, e2e/first-run.spec.ts, e2e/full-stack/first-run.spec.ts, docs/testing.md
The tour begins at Current Debate, then covers Library and Generate. Tour progression, debate creation from the first step, and localized first-run flows are tested.
Offer a debate for the typed motion
src/components/features/debate/DebateMotionGate.tsx, src/locales/*.json, src/test/debate/debate-gates.test.tsx, e2e/first-run.spec.ts, e2e/full-stack/first-run.spec.ts, e2e/full-stack/stack.ts, e2e/sparring.spec.ts, docs/architecture.md, docs/testing.md
When no debate is current, the gate offers to start one using the typed motion or use the motion once. Tests cover creating and selecting the debate, and associating the tool request with its ID.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Sequence Diagram(s)

sequenceDiagram
  actor User
  participant useDebateMotionGate
  participant Supabase
  participant AIRequest
  User->>useDebateMotionGate: Submit typed motion
  useDebateMotionGate->>User: Offer to start a debate
  User->>useDebateMotionGate: Accept the offer
  useDebateMotionGate->>Supabase: Create debate for the motion
  useDebateMotionGate->>AIRequest: Submit request with debate ID
Loading

Architecture Summary

Architecture risk: 🔵 Low · up to dc02f

The change affects 3 systems.

Changed systems: src, e2e, docs

Architecture concerns
No architecture-level concerns identified.

Review details

Systems and components

  • observed — src (service) was modified; 9 changed files map to changed impact.
  • observed — e2e (service) was modified; 5 changed files map to changed impact.
  • observed — docs (service) was modified; 2 changed files map to changed impact.

Before / after behavior

  • observed — Modified behavior in docs/architecture.md: The documentation adds that when a motion-bearing tool has no Current Debate, it offers to start one from the typed motion; the existing mismatch confirmation and inactivity-block rules are unchanged.
  • observed — Modified behavior in docs/testing.md: Adds documentation for e2e/first-run.spec.ts, which exercises the first run in English and Hungarian against stubbed Supabase routes and is limited to proving the client flow.
  • observed — Modified behavior in docs/testing.md: Adds a full-stack journey covering a fresh account’s first run in both languages, including tour startup, persistence of the pre-sign-up language choice through first sign-in, and a tool offering a debate from typed motion when no debate is current.
  • observed — Modified behavior in e2e/first-run.spec.ts: Adds localized test copy and a fresh-account backend mock that creates and lists debates, tracks the current debate, returns empty-table responses for other PostgREST routes, records AI request debate IDs, and responds to AI requests with 503.
  • 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 full review

@coderabbitai

coderabbitai Bot commented Oct 1, 2026 •

Copy link
Copy Markdown
⚠️ Action not completed

Review rate limited.


Your included review limit is currently reached under our Fair Usage Limits Policy. This review may still proceed through usage-based billing if eligible. Your next included review will be available in 58 minutes.

@Programcode

Copy link
Copy Markdown
Owner Author

@coderabbitai full review

@coderabbitai

coderabbitai Bot commented Oct 1, 2026 •

Copy link
Copy Markdown
⚠️ Action not completed

Review rate limited.


Your included review limit is currently reached under our Fair Usage Limits Policy. This review may still proceed through usage-based billing if eligible. Your next included review will be available in 58 minutes.

@Programcode

Copy link
Copy Markdown
Owner Author

@coderabbitai full review

@coderabbitai

coderabbitai Bot commented Oct 1, 2026 •

Copy link
Copy Markdown
✅ Action performed

Full review finished.

@Programcode
Programcode merged commit db32ae0 into main Oct 1, 2026
8 checks passed
Programcode added a commit that referenced this pull request Oct 1, 2026
Brings in #79 to #83 and #85.

Conflict in .superset/db-gate.sh: both sides added a function to the
readiness loop. The loop now waits for both `voice` and `account`.

#82 replaced the "Which debate is this for?" dialog with the first-debate
offer when no debate is current. e2e/voice-rounds.spec.ts still clicked
the old button in two places, so it answers the new offer the way
e2e/sparring.spec.ts does.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

This branch was successfully deployed

1 active deployment
Preview — 8d5c8cb4 Deployed Oct 1, 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