Skip to content

Fix Seer billing when natal chart context is missing - #64

Draft
cursor[bot] wants to merge 1 commit into
mainfrom
cursor/critical-bug-investigation-49a6
Draft

cursor[bot] wants to merge 1 commit into
mainfrom
cursor/critical-bug-investigation-49a6

Conversation

@cursor

@cursor cursor Bot commented Aug 31, 2026

Copy link
Copy Markdown

What changed

  • Vedic and Western Ask the Seer no longer debit PAYG credits (or consume the free tool-seer instance) when the natal chart payload is missing.
  • The shared tool Seer gate now accepts missingContextError and returns 400 before rate-limit and consumeBillingAction.
  • Added a unit test that a real question with no chart returns 400 and does not call billing.

Why this change is safe

  • Root cause: enforceToolSeerGate billed first; /api/ask-vedic-seer and /api/ask-western-seer then 400’d for missing vedicChartData / westernChartData.
  • Trigger: Signed-in PAYG user opens Ask the Vedic Seer before a chart exists (the tab is shown whenever the user is signed in), submits a real question. UI already mapped that 400 to “Generate your Vedic chart with birth time…” after the debit.
  • Scope is the gate plus those two natal routes. Other tool Seers are unchanged. Complementary to open PR Fix Seer billing for empty questions #59 (empty-question debit), not a duplicate.
  • Auth still runs first (401 before missing-context 400).

Verification

  • pnpm exec eslint on touched files (0 errors)
  • pnpm test — 69 suites / 382 tests passed
  • pnpm run lint:security passed
  • Playwright smoke not required (API billing gate only; no UI/routing change)

Regression prevention

  • tests/unit/enforceToolSeerGate.test.ts — missing chart context → 400 and consumeBillingAction not called; valid questions still bill; injection blocks still skip debit.
  • Existing empty-question pass-through behavior in the gate is unchanged (still covered by open Fix Seer billing for empty questions #59).

Release checklist (solo-friendly)

  • CI is green
  • Ready to merge to main
  • Post-merge: ask Vedic Seer before generating a chart — should 400 with no credit change
Open in Web View Automation 

PAYG users could be charged for Vedic/Western Ask the Seer when the UI
allowed a real question before the chart existed. Reject missing chart
payloads in the tool Seer gate before rate-limit and consumeBillingAction.

Co-authored-by: Andy Oliver Rozario <andyrozario7@gmail.com>
@vercel

vercel Bot commented Aug 31, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
future-seer Ready Ready Preview Aug 31, 2026 11:13am

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