Skip to content

Native iOS app: Prepare tab, Generate, case document, Attack and Export - #130

Merged
Programcode merged 7 commits into
feat/native-iosfrom
native-ios/04a-generate-attack
Oct 9, 2026
Merged

Programcode merged 7 commits into
feat/native-iosfrom
native-ios/04a-generate-attack

Conversation

@Programcode

Copy link
Copy Markdown
Owner

This PR adds the Prepare tab, Generate, the generated case as a document (mock 03), Attack and Export, from plans/2026-10-08-native-ios-app.md. It targets feat/native-ios.

Prepare tab

  • The tab lists the four tools. Generate works now; Brainstorm, Factoids and Flowchart show "on its way" until PRs 4b and 4c.
  • Below the tools are the Current Debate's saved Prepare results, newest first.
  • The Debate tab's tiles and its "Pick up where you left off" rows open the same screens.

Generate

  • The form has the website's fields and defaults: In favor or Against, role, length, audience, tone and a style note. They are native pickers.
  • If you type a different motion, the website's motion gate appears as a native alert: switch to that debate, create one, or use the motion once.
  • Requests go through the helper Ask now shares with Generate and Attack, so they keep the same headers, the 200 s timeout and the abort before the session read.
  • The model settings come from feature_configs for each tool. The debate context includes pins.
  • The output runs through the website's own transform, which this PR moves into @debatelab/core. client.ts imports it back in one line, and its behaviour is unchanged.
  • Saving matches the website:
    • The case is recorded like the website's recordResult.
    • Researched sources go to the debate's Auto-saved folder, and the "..." menu offers the website's "Undo auto-saved sources".
    • In one-off mode nothing is saved, and Save in the menu stores the case outside any debate.

The document

  • The building blocks (framing card, numbered collapsible arguments, evidence quotes with citation chips, pinned actions) are written so 4b can reuse them.
  • The native toolbar has back, share, and "..." with Discuss, Save, Undo auto-saved sources and Delete.
  • Every field the website's GenerateResults shows also appears here. Fields the mock doesn't have go below the arguments in the same style: Case Structure, Predicted Opponent Case, Prepared Counters, Researched sources, and a footer with the model and duration.

Attack

  • "Attack this case" opens Attack with the case text filled in, which is how the website hands a case over. Practice's Attack row also opens it now.
  • Attacks are saved the way the website's AttackPage saves them.
  • The pinned next step is the website's Discuss, which opens Ask with its message.

Export

  • PDF goes through expo-print and the share sheet, using the website's PDF file names.
  • Copy as text copies exactly what the website's Clipboard button copies.
  • Word is left out. docx would have to run under Hermes in Expo Go, and that can't be tested on the VPS.
  • Google Docs is left out. It needs Google sign-in, which comes with the dev build.

Checks

Run locally on Node 22, because GitHub Actions starts no jobs on this account (billing):

  • npm run verify exits 0: 287 Vitest, 30 collaboration and 333 Deno tests, the build, the service-worker check and 30 Chromium smoke tests.
  • Each of the five commits typechecks and lints on its own.
  • The screenshot set has 224 screenshots signed in to staging: iPhone and iPad, light and dark, English and Hungarian. It includes the HTML handed to expo-print and the copied text.

Live on the staging seed Pro account:

  • One Generate (67 s) and one Attack (86 s).
  • The case opened from the Debate tab, exported to PDF HTML and copied as text.
  • Both results were deleted through the app's menu, along with the 10 auto-saved sources the run created. 0 are left.

Not proven

These need Adam's phone:

  • the native toolbar menus, action sheets and share sheet
  • a real PDF file
  • swipe-back

Discuss to Ask did not run live.

🤖 Generated with Claude Code

Programcode and others added 5 commits October 9, 2026 12:31
The app saves generated cases and researched sources the way the website
does, so the pure parts of generateCase and autosaveDiscoveredSources now
live in packages/core and the website imports them back unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Generate and Attack send the same requests as Ask: the same headers, 200 s
timeout, abort before the session read and error kinds. The POST moves to
ai-request.ts, the model reader takes a feature, and the context builder
takes the feature and side the website's requestSide picks.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The Prepare tab lists the tools and the Current Debate's saved Prepare
results. Generate and Attack send the website's requests, keep researched
sources in the Auto-saved folder and save to cases and attacks as the
website does. Results open as documents after mock 03, with collapsible
arguments, citation chips, a share button, a menu with Discuss, Save, the
auto-saved sources undo and Delete, and pinned next steps. Export makes a
PDF with expo-print and copies the result as text. Word and Google Docs
export are not in the app yet.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The pinned buttons share the width equally as in mock 03, with the mock's
tight padding so Attack this case fits, and shorter Spanish and Hungarian
labels. On iPad they stay in the document's centred column. Deleting a
document that has nothing behind it returns to the Debate tab.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The screenshot script answers Generate and Attack with fixed outputs inside
the page and fakes their saves, so it never calls a model or writes to
staging. It renders the HTML handed to expo-print and keeps the copied text
next to the screenshots.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@vercel

vercel Bot commented Oct 9, 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 9, 2026 2:23pm UTC
debatelab-staging Ready Ready Preview Oct 9, 2026 2:23pm UTC

Copilot AI balanced review requested due to automatic review settings October 9, 2026 13:24

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 9, 2026 •

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration
  • Configuration used: Repository YAML (base), Organization UI (inherited)
  • Review profile: CHILL
  • Plan: Free
  • Run ID: 8b1210a5-3714-4896-ad36-cb8ec958bf57

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

Mock 03 against the app's web export (light English, dark Hungarian, iPad):

Case document: mock 03 vs app, light en

Case document: dark hu

Case document: iPad

Forms and open results from one account no longer reach the next: they live
in session memory that the auth provider clears on every account change.
Undo of auto-saved sources only deletes ids read for the Current Debate and
filters the delete by that debate. Cancelling Generate or Attack stops the
source autosave before the next write. Prepare shows only the Current
Debate's saved results, and Ask clears its citations library on a debate
change.

Generate, Attack and Ask's whole answers now save the server's source
rankings to the request's debate and say when the input was shortened, as
the website does. The ranking helpers move to @debatelab/core so both
clients share them. Attack weaknesses are keyed by position.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Prepare's Retry skipped the ownership check, so a late retry for one debate
could replace another debate's loaded results and leave a spinner. Every load
now takes a sequence number and only the newest may write.

Generate, Attack and Ask's whole-answer path pass their request signal to the
source rankings, which stop before using the read and before writing once the
student cancels.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Programcode

Copy link
Copy Markdown
Owner Author

Codex review (gpt-6.1-sol)

  • r1 at 3d689ab: 7 findings. I verified both High ones myself.
    • High: form drafts and the open-results cache survived sign-out.
    • High: Undo auto-saved could delete sources belonging to another debate.
    • Medium: autosave kept running after Cancel.
    • Medium: Prepare showed the previous debate's results.
    • Medium: meta.truncated was dropped, so the shortening notice never showed.
    • Low: sourceAssessments was ignored.
    • Low: model-supplied ids were used as expansion keys.
    • All seven fixed in 7b939df:
      • Session memory is now cleared by the auth provider on every account change.
      • Undo checks that the source belongs to the current debate and filters by debate_id.
      • Autosave gets a cancel signal; results.test.ts fails without the fix.
      • Prepare is keyed by debate.
      • The website's shortening notice now shows.
      • Assessments are written to the debate captured with the request. The website's parser and merge moved to @debatelab/core, line for line.
      • Expansion keys are indexes.
  • r2 at 7b939df: 2 Medium.
    • A late Retry on Prepare could overwrite newer state.
    • Assessment writes went through after Cancel.
    • Both fixed in adb53ae: loads now carry a sequence number, and the assessment write takes a signal. sources.test.ts fails without the fix.
  • r3 at adb53ae: no findings. The r2 scenarios fail on the previous head and pass on this one.

Accepted: if a source moved to another debate, Undo's "Removed N" count can come out too high.

Local checks at adb53ae. GitHub Actions starts no jobs because of billing, so these ran locally:

  • npm run verify exit 0, with 289 Vitest, 333 Deno and 30 Chromium smoke tests.
  • Mobile typecheck, eslint and knip are clean.
  • 224 screenshots pass at 7b939df. adb53ae doesn't change rendering.

Merging into feat/native-ios.

🤖 Generated with Claude Code

@Programcode
Programcode merged commit fb84790 into feat/native-ios Oct 9, 2026
8 of 18 checks passed
@Programcode
Programcode deleted the native-ios/04a-generate-attack branch October 9, 2026 14:34

This branch was successfully deployed

2 active deployments
Preview – debate-navigator — adb53aee Deployed Oct 9, 2026 by vercel[bot]
Preview – debatelab-staging — adb53aee Deployed Oct 9, 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