Skip to content

fix: align debate prompt contracts and complete control fixtures - #42

Merged
Programcode merged 2 commits into
mainfrom
t3code/system-prompt-improvements
Sep 9, 2026
Merged

Programcode merged 2 commits into
mainfrom
t3code/system-prompt-improvements

Conversation

@Programcode

@Programcode Programcode commented Sep 9, 2026 •

Copy link
Copy Markdown
Owner

Streaming Ask shares coaching identity, explicit language priority, and evidence-honesty rules while retaining Markdown output and rejecting advanced controls. Structured prompts retain required JSON fields. Factoids preserves integer source counts, Generate preserves model evidence warnings, and empty or fully trimmed research cannot advertise unavailable context or inject fallback citations.

The fixture matrix covers Generate roles/lengths, Attack intensity/paradigms/toggles, Brainstorm modes/sides, Factoids retrieval controls, Ask mode/toggle/research combinations, school/LD/PF sparring, and Crossfire styles. The v2 evaluation sheet records a final 36-response before/after comparison plus 18 intermediate samples. Structured schema validity was 8/9 before and 9/9 after; coaching quality remained mixed. needsSource is advisory, not semantic verification of each claim.

Verification:

  • Node 22.23.2/npm and the committed lockfile; installation, documentation, lint, typecheck, Deno checks, and production build passed.
  • Full coverage: 1,001 tests in 101 files; all configured selected-scope thresholds passed.
  • Focused prompt/research/schema/streaming suite: 208 passed. Native Edge tests: 161 passed.
  • Isolated authenticated-fixture desktop/mobile E2E: 90 passed with mocked providers.
  • Current-head CI run 34376662842 passed quality, database, and 134 desktop/mobile browser tests on a1f4fdd. Vercel preview passed.
  • Protected staging E2E: 2 passed with real demo-code authentication, session reload, source creation/read/deletion, and native AI output. Three stale test lines were corrected after observed failures.
  • Authenticated staging streaming: HTTP 200, Spanish output, SSE deltas/final; advanced mode rejected with HTTP 400.
  • Two independent code-review passes found and verified fixes for empty research, explicit language priority, integer counts, valid streaming requests, trimming, and citation fallback. No actionable findings remain.
  • CodeRabbit completed its included run on the final head after the rolling limit expired. Its Free plan provides a summary rather than line-by-line review; the independent reviews supplied the code review. No paid plan was enabled.

Release:

  • Merged as da14bc9. Post-merge build workflow passed, and the Vercel Production deployment for that commit succeeded.
  • Staging brifeyypjauyusmkptkx: ai v15, ai-stream v15. Existing announcements code was deployed as v1 because staging lacked that function; its tables already existed.
  • Production uziwdtkzofptihahfooo: ai v71, ai-stream v9. All downloaded deployed source files match the merged tree. Authenticated gpt-5.4-mini requests returned valid Ask JSON and Spanish SSE output; advanced streaming remained rejected with HTTP 400.
  • Rollback source bundles retain production ai v70/ai-stream v8. No schema migrations, global prompt-record changes, or production secret changes were made.
  • The dedicated staging code was created with explicit authorization and saved privately with limited uses and expiry. Temporary verification sessions were signed out, saved auth state and credential caches removed, local main updated, and the feature branch removed locally/remotely. The T3-managed workspace remains clean and detached at the merged commit.

Limits: GitHub's separate protected-staging workflow remains disabled/skipped; real staging verification ran locally. WebKit was outside the requested browser matrix and was not run. Manual observations do not establish provider-wide quality or factual accuracy.

@vercel

vercel Bot commented Sep 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 Sep 9, 2026 4:26pm UTC

@coderabbitai

coderabbitai Bot commented Sep 9, 2026 •

Copy link
Copy Markdown

Review Change StackReview Change Stack

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Free

Run ID: 39768716-94e9-49c9-b88f-8114fa3b6dbe

📥 Commits

Reviewing files that changed from the base of the PR and between c5abf46 and a1f4fdd.

📒 Files selected for processing (19)
  • e2e/staging/auth.setup.ts
  • e2e/staging/authed-flows.spec.ts
  • package.json
  • plans/prompt-eval-sheet.md
  • plans/system-prompt-improvement.md
  • src/lib/ai/schemas/factoids.ts
  • src/test/schemas.test.ts
  • supabase/functions/_shared/control-enforcement.test.ts
  • supabase/functions/_shared/control-enforcement.ts
  • supabase/functions/_shared/prompts.test.ts
  • supabase/functions/_shared/prompts.ts
  • supabase/functions/_shared/research.test.ts
  • supabase/functions/_shared/research.ts
  • supabase/functions/ai-stream/handler_test.ts
  • supabase/functions/ai-stream/prompt.test.ts
  • supabase/functions/ai/control-matrix.test.ts
  • supabase/functions/ai/generate-honesty_test.ts
  • supabase/functions/ai/handler-research.test.ts
  • supabase/functions/ai/index.ts
💤 Files with no reviewable changes (1)
  • e2e/staging/auth.setup.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • plans/system-prompt-improvement.md

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


📝 Walkthrough

Walkthrough

The change centralizes prompt rules, adds streaming Ask integration, improves research and source handling, expands AI control coverage, validates factoid source counts, and updates verification records and staging tests.

Changes

Prompt behavior and validation

Layer / File(s) Summary
Shared prompt contracts
supabase/functions/_shared/prompts.ts, supabase/functions/_shared/prompts.test.ts
Shared rules define evidence handling, JSON fields, Ask guidance, research availability, language precedence, and feature markers.
AI prompt controls and validation
src/lib/ai/schemas/factoids.ts, supabase/functions/_shared/control-enforcement.ts, supabase/functions/ai/..., src/test/...
Factoid source counts require coerced integers from 3 to 15. Matrix tests cover supported AI controls and output shapes.
Streaming Ask prompt integration
supabase/functions/ai-stream/...
Streaming Ask uses the shared Markdown prompt builder and validates supported modes and toggles before provider work.
Research availability and source honesty
supabase/functions/_shared/research.ts, supabase/functions/ai/index.ts, supabase/functions/ai/*test.ts
Empty or trimmed research is excluded from prompts and sources. Generated content preserves or sets needsSource based on available evidence.
Verification and staging updates
plans/..., package.json, e2e/staging/...
Plans record final evaluations and verification commands. Staging selectors and the edge test environment allowlist are updated.

Estimated code review effort: 4 (Complex) | ~60 minutes


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

Please review the current head c5abf46 for actionable findings. The current status is successful, but the walkthrough says the Free plan provided only a summary. Please make clear whether a code review was actually performed.

@coderabbitai

coderabbitai Bot commented Sep 9, 2026

Copy link
Copy Markdown

The author of this PR is on the CodeRabbit Free Plan. In order to use the Chat feature, please upgrade the PR author to CodeRabbit Essentials by visiting https://app.coderabbit.ai/settings/billing.

@Programcode

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Sep 9, 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.

@Programcode

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Sep 9, 2026 •

Copy link
Copy Markdown
✅ Action performed

Review finished.

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.

@Programcode
Programcode merged commit da14bc9 into main Sep 9, 2026
7 checks passed
@Programcode
Programcode deleted the t3code/system-prompt-improvements branch September 9, 2026 16:58

This branch was successfully deployed

1 active deployment
Preview — a1f4fdd3 Deployed Sep 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.

1 participant