Skip to content

Fix the 22 Oct QA backend nits (batch C2) - #195

Merged
Programcode merged 3 commits into
mainfrom
cursor/backend-nits-c2-fbc6
Oct 22, 2026
Merged

Programcode merged 3 commits into
mainfrom
cursor/backend-nits-c2-fbc6

Conversation

@Programcode

Copy link
Copy Markdown
Owner

Local follow-up to the 22 Oct 2026 QA report. Eight backend nits only. Not merged, and nothing here was deployed or applied to staging or production.

GitHub Actions minutes are out, so this is a local npm run verify on 558ebfb7, not a CI pass. The run set commit.gpgsign=false for the process because this environment signs every git commit and src/test/scripts/backend-status.test.ts then stalled in git commit (hook timeout, unrelated to this diff). With that set, verify exited 0:

  • docs:check, lint, typecheck: passed
  • npm test: 61 files, 429 tests passed
  • npm run test:collaboration: 5 files, 30 tests passed
  • npm run test:edge: 405 passed
  • npm run build: prerender and check-site passed (47 HTML files, sitemap and llms.txt, no problems)
  • npm run test:sw: upgrade, offline route, recovery, prefetch, logo, and no API cache entries
  • npm run test:e2e:smoke: 43 passed (30.3s), desktop Chromium

The database gate did not run. This machine has no Docker, so the new pgTAP assertions in account_deletion_test.sql and demo_access_codes_rls_test.sql are unexecuted.

Issues

LB-02

URL import now strips style/script/nav and Wikipedia chrome (edit links, TOC, navboxes, language lists, parser-output styles) before taking text, and prefers main, article, #mw-content-text, and .mw-parser-output. A hard cut at 50k characters sets truncated and keeps a truncation note inside the cap. Covered by the Wikipedia fixture and limitImportedText tests.

QB-10

import-source still reserves the import_source slot up front, then calls refund_daily_quota unless the import returns 200 (upstream failure, unsupported type, too-short text, timeout, or exception). A 429 or a rejection before a successful reservation is not refunded. Covered by the 503 refund test and the deadline tests.

DB-02

Playwright starts Vite with VITE_E2E=1. The unpinned production fallback becomes http://e2e.invalid, and the browser refuses any request to the production project origin. playwright.config.ts refuses to start if VITE_SUPABASE_ENV or SUPABASE_URL already points at production. E2E_ALLOW_PROD=1 is the override. The production canary config does not set VITE_E2E. Plain npm run dev still defaults to production. No keys were added.

SC-05

A reserved demo-code use is refunded when account setup fails after consume_demo_access_code. The reservation stays before the session handoff. User lookup is lookup_auth_user_by_email instead of paging listUsers. DEMO_CODE_PEPPER still falls back to the service-role key, and the function logs one warning when the dedicated pepper is missing. One code still shares one Auth user; that design is unchanged.

SC-06

isAdmin and the per-user role lookup use maybeSingle(). The users action takes page (default 1) and perPage (default 50, max 100) and returns hasMore. The admin users tab loads the next page on demand. The subscribers action still calls listUsers() with no page size; that was not this list.

SC-09

shareUrl uses an allowed Origin, then an allowed Referer origin, then optional PUBLIC_WEB_APP_ORIGIN, then https://debate.pi-stack.org. A request with no origin still gets the production URL.

ST-02

export_account_data drops stripe_customer_id, customer_id, daily_limit_override, gifted_trial_2026_05, gifted_trial_gratuity_2026_05, pricing_snapshot_id, and raw_usage from the export document. Format version stays 1. The rows stay in the database.

MD-15

The debrief prompt tells the model to judge each turn from its own words and earlier turns, and not to use a later turn as evidence about an earlier one. concessionsSecured, controlledQuestions, weakOrRepetitiveQuestions, and evasiveOrIncompleteAnswers cite exactly one turn id in the client schema, the server validator, and the provider JSON schema (maxItems: 1). missedFollowUps, betterFollowUpQuestions, and strongestExchange may still cite an exchange.

Needs a deploy before it is live

Not done in this PR:

  • Migrations 20261022210000_redact_account_export_internals.sql and 20261022210100_demo_code_lookup_and_refund.sql (refund and lookup are service-role only; export replace keeps the same signature).
  • Edge functions import-source, demo-code-login, admin, share, and ai (the debrief prompt and validator ship inside ai).

The account function does not need a new deploy for the export redaction; it already calls export_account_data. The Playwright guard and admin load-more button ship with the frontend when this merges to main. Do not merge from here.

Open in Web Open in Cursor 

Strip Wikipedia chrome and flag truncated URL imports, refund a failed import's quota, keep Playwright off the production Supabase project, refund a demo code when account setup fails, page the admin user list, build share links from the request origin, leave billing internals out of account export, and judge each crossfire debrief turn only on its own words.

Co-authored-by: Gáborjáni-Szabó Ádám <Programcode@users.noreply.github.com>
@coderabbitai

coderabbitai Bot commented Oct 22, 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 23 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
📥 Commits

Reviewing files that changed from the base of the PR and between 5770299 and 69c3739.

📒 Files selected for processing: 35
  • docs/testing.md
  • e2e/crossfire.spec.ts
  • packages/core/src/ai/schemas/source-import.ts
  • packages/core/src/crossfire/schemas.ts
  • playwright.config.ts
  • src/lib/supabase/client.ts
  • src/lib/supabase/e2e-guard.ts
  • src/lib/supabase/env.ts
  • src/locales/en.json
  • src/locales/es.json
  • src/locales/hu.json
  • src/pages/AdminPage.tsx
  • src/test/supabase/pinned-env.test.ts
  • src/vite-env.d.ts
  • supabase/README.md
  • supabase/functions/_shared/crossfire-response.test.ts
  • supabase/functions/_shared/crossfire-response.ts
  • supabase/functions/_shared/demo-code.ts
  • supabase/functions/_shared/prompts/crossfire.ts
  • supabase/functions/_shared/research.ts
  • supabase/functions/admin/index.ts
  • supabase/functions/ai/prompt-builder.test.ts
  • supabase/functions/demo-code-login/index.ts
  • supabase/functions/demo-code-login/index_test.ts
  • supabase/functions/import-source/deadline_test.ts
  • supabase/functions/import-source/html-text.ts
  • supabase/functions/import-source/html-text_test.ts
  • supabase/functions/import-source/index.ts
  • supabase/functions/import-source/index_test.ts
  • supabase/functions/share/auth_test.ts
  • supabase/functions/share/index.ts
  • supabase/migrations/20261022210000_redact_account_export_internals.sql
  • supabase/migrations/20261022210100_demo_code_lookup_and_refund.sql
  • supabase/tests/account_deletion_test.sql
  • supabase/tests/demo_access_codes_rls_test.sql

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 and others added 2 commits October 22, 2026 20:49
Refunding every failed import let a user fetch any URL without limit by
pointing it at a page that fails. Refund only when the import fails before
a request leaves for the source.
@Programcode
Programcode marked this pull request as ready for review October 22, 2026 21:06
Copilot AI balanced review requested due to automatic review settings October 22, 2026 21:06
@Programcode
Programcode merged commit c5f3ad1 into main Oct 22, 2026
3 of 14 checks passed

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.

Programcode added a commit that referenced this pull request Oct 22, 2026
…197)

* Match Wikipedia chrome by whole class token so import-source keeps the article

#195 matched chrome names like toc with hyphen boundaries, so the <html> flags vector-toc-available and vector-feature-toc-pinned-* marked the whole page as chrome and every Wikipedia import came back empty. Match exact id/class tokens, never treat <html>/<body> as chrome, and test against a real (gzipped) Wikipedia page.

* test(import-source): assert on Wikipedia chrome that actually leaked before #195
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.

3 participants