Skip to content

refactor(platform): finalize the V2 architecture - #5

Merged
iamjr15 merged 5 commits into
mainfrom
feat/wire-up-bud-parity
Jul 15, 2026
Merged

refactor(platform): finalize the V2 architecture#5
iamjr15 merged 5 commits into
mainfrom
feat/wire-up-bud-parity

Conversation

@iamjr15

@iamjr15 iamjr15 commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Finalize the V2-only Cloudflare/Vercel architecture and remove the retired V1 surface.
  • Harden run admission, idempotency, sandbox lifecycle, tenancy, BYOK, webhooks, release gates, and observability.
  • Remove token/cost accounting, per-run caps, automations, compatibility paths, dead packages, and product-test harnesses.
  • Align sandbox previews with the existing owned *.trycheatcode.com route; no new domain is required.

Context

plan.md is intentionally deleted because the owner confirmed it is out of sync. This branch has no Linear parent issue. Architecture decisions are recorded here and in package READMEs.

Architecture

  • Vercel serves the Next.js frontend; Cloudflare Workers own gateway, agent, webhooks, and preview proxy responsibilities.
  • Durable Objects own run state, admission, idempotency, quota coordination, and per-user sandbox lifecycle.
  • Postgres access is tenant-scoped through the app worker role; administrative migrations use a separately pinned target.
  • Daytona supplies immutable per-user sandboxes; preview access uses host-bound short-lived capabilities and cookie isolation.
  • R2 stores outputs and audit artifacts; Workers Analytics Engine and structured logs provide native observability.

Decisions

Decision Choice Reason
Frontend hosting Vercel Matches the production deployment model and native Next.js build path.
Preview hostname {sandboxId}--{port}.trycheatcode.com Existing wildcard DNS, TLS, and Worker routing are live; deeper subdomains need extra TLS and add no site isolation.
Usage model Sandbox-hour entitlements only Token billing, token counting, cost accounting, and per-run hard caps are retired product concepts.
Release safety Exact-SHA staged frontend, phased migrations, closed gateway barrier Prevents mixed schema/application versions and partial backend exposure.
Legacy policy Delete instead of compatibility shims The product is V2-only and the owner explicitly rejected backward compatibility.

Migration safety

  • Pre-deploy: Drizzle 0030-0032 schema markers/expansions.
  • Post-deploy: ten reviewed contractions, applied only after Workers and Vercel report the exact release SHA.
  • Migration 0040 maps the 29 production web project modes to canonical app-builder and fails on any unknown value before validating the constraint.
  • The runner validates database host, role, database, and system identifier before every operation.

Validation

  • pnpm lint
  • pnpm typecheck
  • pnpm deadcode
  • pnpm architecture:check
  • pnpm build
  • pre-deploy migration dry run
  • post-deploy migration dry run
  • sandbox image configuration, runtime, and vulnerability scans
  • direct local browser QA for home, settings, pricing, usage, docs, and chat surfaces

Review order

  1. Release and migration gates in .github/workflows/ and scripts/.
  2. Gateway and agent Durable Object boundaries.
  3. Database schema, RLS, and contractions.
  4. Daytona sandbox and preview security.
  5. Vercel frontend composition and product-surface cleanup.

iamjr15 added 4 commits July 15, 2026 16:10
Harden run admission, sandbox lifecycle, tenancy, migrations, and release orchestration.

Tighten auth, observability, and UI boundaries.

Remove V1, token-cost accounting, legacy compatibility, dead packages, and test harnesses.

Align preview routing with the owned production wildcard.
Build the env package and generated skill bundle before Knip runs.

Clean CI checkouts now behave like prepared local worktrees.
@vercel

vercel Bot commented Jul 15, 2026

Copy link
Copy Markdown

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

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
cheatcode Ignored Ignored Jul 15, 2026 11:19am

@iamjr15
iamjr15 merged commit 3336016 into main Jul 15, 2026
8 checks passed
@iamjr15
iamjr15 deleted the feat/wire-up-bud-parity branch July 15, 2026 11:27
iamjr15 added a commit that referenced this pull request Jul 31, 2026
…110)

Phase C of the OSS-ready program.

- **PR-title gate**: Conventional-Commits pattern still enforced for
all; the 72-char ceiling now exempts `dependabot[bot]` (titles are
machine-generated and unshortenable — #76/#78 fail today solely on
length; commitlint's own ceiling is 100).
- **Dependency floors**: `dompurify` → 3.4.12 (closes alert #5);
`body-parser` → 2.3.0 (resolved 2.2.2 was in-range via express + MCP-SDK
paths, closes alert #4).
- **`CLOUDFLARE_ACCOUNT_ID`** now read from secrets (masked in public
run logs; secret created beforehand; the variable is deleted after the
next validated dispatch — historical logs remain unredacted regardless).
- `build-snapshot` environment casing normalized to `Production`;
sandbox Dockerfile comment ties alerts #9/#8 to the existing overlay
mitigation.

## Verification notes

- [x] `pnpm lint` / `pnpm typecheck` / `pnpm turbo build --force` /
`pnpm deadcode` / `pnpm architecture:check` / `pnpm turbo skills:build`
— independent clean-install rerun
- Lockfile diff limited to the two override resolutions; `pnpm why
body-parser` single-resolves 2.3.0.
- Post-merge: rebase #76/#78 (title gate), re-run #96 (expired
quarantine), merge #81 after diff re-check; dispatch deploy to validate
the secret-backed account id; then delete the variable.
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