Guides
- Pre-commit hook: Biome on staged files + full-monorepo
pnpm typecheck(turbo-cached, cold ~30s). It blocks—fix first. ^buildin turbo: tests + typecheck build deps first; if type errors appear after changing a package, runpnpm build.- Workspace header: frontend sends
x-workspace-idon every tRPC request; missing→user's default workspace. - Master workspace bypass:
scopedFilterskips checks for the master UUID—never use it for user-facing ops. - Next.js: both apps
output: "standalone"(.next/standalonedeploys) +ignoreBuildErrors: true—rely onpnpm typecheck. - Async event dispatch: polling-based (1s)—events aren't processed immediately after a mutation.
- CI:
.github/workflows/ci.ymlruns typecheck + lint + test on PR/push tomainagainstpgvector/pgvector:pg16. No Temporal (activities run as plain TS); no Playwright; deploys manual viadeploy.sh. PRs run only the tests the diff reaches;mainruns all (docs/ci/test-selection.md). - Temporal activities import directly: they run in regular Node (not sandboxed)—lazy
await import()heavy deps like@react-pdf/renderer. - Shared enum:
assetTypeEnumlives inassets.ts, imported byproducts.ts—update in one place. - Report
ORDER BY: report queries cast numeric columns to text at thenum()boundary, and a bareORDER BY aliasbinds to the output column—so ordering by the alias sorts money and counts lexicographically ("8000" outranks "160000", and a capped report keeps the wrong rows). Order by the underlying expression instead; inside aUNION, where an expression is not allowed, give the column a numeric type rather than casting it. - Open-redirect: quote/invoice tracking URLs embed the redirect target inside the signed JWT—never take it from query params.
- Stripe webhook:
POST /api/webhooks/stripehandles quote (payment_intent.*) + invoice (checkout.session.*), routed bysession.metadata.invoiceId. - Automation allowlist:
ActionExecutor.UPDATABLE_FIELDSgates automatable fields—extend it when adding one.RUN_WORKFLOW_ALLOWLISTgatesrun_workflowand is empty on purpose: workflow args are trusted, so a listed workflow must scope to the injectedworkspaceId. - Ask model:
ASK_MODEL_ID(defaultDEFAULT_MODEL_BY_PROVIDER.anthropic,…/ask/model.ts) must exist inMODEL_PRICING(boot-checked); test embedders needcreateTestHybridRetriever.