Skip to content

Fix critical blueprint, billing, and milestone regressions#98

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

Fix critical blueprint, billing, and milestone regressions#98
cursor[bot] wants to merge 1 commit into
mainfrom
cursor/critical-bug-investigation-159c

Conversation

@cursor

@cursor cursor Bot commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

Bug and impact

  • Analysis reruns deleted existing blueprints before replacement generation completed, causing permanent blueprint data loss on GitHub/AI/database failure.
  • Scaffold generation trusted an optional body userId, so the main UI path skipped credit billing and deduction failures still returned successful scaffold responses.
  • Milestone PATCH/DELETE only authenticated users, allowing cross-project/cross-user milestone mutation if a milestone UUID was known.
  • Credit balance updates used stale read-modify-write logic, allowing concurrent deductions/grants/refunds to lose writes.
  • The legacy cross-platform scanner could crash on malformed platform cookies or GitHub error payloads.

Root cause

Recent API/query changes relied on route-level authentication without passing project/user scope into milestone mutations, staged destructive blueprint deletion before replacement success, and left billing dependent on client-supplied identity plus non-atomic credit helpers.

Fix

  • Scope milestone updates/deletes by milestone id, route project id, and authenticated user id.
  • Stage analysis blueprint replacement: keep old blueprints through scanning/AI/save failures, clean up partial new rows on insertion failure, and remove old rows only after replacements are saved.
  • Charge scaffold generation to the authenticated user before AI work, return 402 on failed deduction, and refund on generation/parse failure.
  • Make credit grant/renew/deduct/refund mutations atomic SQL update+transaction insert operations.
  • Validate cross-platform scanner cookies and GitHub repo responses before iterating.

Validation

  • pnpm exec tsc --noEmit passed.
  • Targeted ESLint on changed files passed with existing warnings only.
  • Temporary mocked critical regression harness passed for scoped milestone SQL, atomic deduction failure/success, scaffold body-user spoofing + refund path, and analysis rerun preserving old blueprints on scan failure.
Open in Web View Automation 

Co-authored-by: Cole Collins <DealPatrol@users.noreply.github.com>
@vercel

vercel Bot commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

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

Project Deployment Actions Updated (UTC)
repo-app-architect Ready Ready Preview, Comment Jun 19, 2026 11:12am
repofuse Ready Ready Preview, Comment, Open in v0 Jun 19, 2026 11:12am
v0-repo-app-architect Ready Ready Preview, Comment, Open in v0 Jun 19, 2026 11:12am

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