NAT-284 pre-release audit
Audited main at 722fd46c86bf4675ee124c0df273e9866d497a02 on November 13, 2026. The issue branch changes OTP delivery and adds this report. Other fixes belong to the linked follow-ups.
The current tree is not release-ready. The web production build fails, and live collaboration leaks new source updates to removed collaborators. The audit is complete; closing the audit does not close the release findings.
Changes made in this issue
apps/app/src/lib/auth.ts now sends sign-in, email-verification and password-reset codes through the existing email service. It also handles the installed plugin's email-change variant without enabling that feature. Each email has purpose-specific text and HTML, and the plugin explicitly uses the advertised five-minute lifetime.
apps/app/src/lib/email.ts now lets provider errors reach Better Auth rather than swallowing them. Better Auth intentionally reports OTP callback failures through its logger and returns a generic response. This change does not promise that the public endpoint reveals a delivery failure.
Five tests in auth-otp.test.ts exercise the installed Better Auth plugin with its real memory adapter and a captured mail transport. They cover successful sign-in and verified sessions, existing-account verification, password reset followed by login with the new password, rejection of the old password, invalid codes, consumed codes, expiry, email contents, and delivery callback failures. These tests do not send external email.
Findings that need work before release
| Issue | Finding | Evidence level |
|---|---|---|
| NAT-289 | Restore the web production build and check it in CI | Reproduced |
| NAT-290 | Stop live project streams when a collaborator loses access | Reproduced |
| NAT-291 | Purge collaborative source state when projects and files are deleted | Reproduced |
| NAT-292 | Make newly uploaded binary files compile without reloading | Reproduced at the source/store level |
| NAT-293 | Include shared personal projects in collaborators' dashboards | Reproduced |
| NAT-294 | Allow a deleted project's name to be reused | Reproduced |
| NAT-295 | Reconcile source file names with compiler path validation | Reproduced |
| NAT-296 | Synchronize file-tree metadata across open collaborator sessions | Reproduced at the source/store level |
| NAT-297 | Show login failures and provide a usable OTP retry flow | Source review |
| NAT-298 | Resolve inert project controls and demo collaborator data before v1 | Source review |
| NAT-299 | Replace the privacy placeholder and finish the release terms | Source review |
| NAT-300 | Apply abuse protection consistently to all public auth email endpoints | Reproduced |
| NAT-301 | Honor compilation-ID retries in the authenticated web compile route | Reproduced |
The issues contain reproduction steps, source locations, test gaps and acceptance criteria. NAT-297, NAT-298 and NAT-299 are children of the UI overhaul, NAT-286. Functional backend findings are children of this audit.
Highest-risk findings
- NAT-290: In the real collaboration runtime, removing a collaborator's SQL membership did not stop new source updates reaching their existing socket. Access checks guard incoming messages, but
broadcastdelivers to all tagged sockets. Compile SSE has the same attachment-only authorization concern by source inspection; that SSE case was not separately reproduced. - NAT-291: After saving, deleting a project and collecting its real R2 sources, a nonempty clean Yjs snapshot remained in collaboration SQLite. Only dirty documents reach the flush cleanup path, so clean idle documents lack a purge path.
- NAT-289:
bun run --cwd apps/app buildfails becausestyles.css:5imports@fontsource-variable/geistwithout a manifest or lockfile dependency. CI runs no production build. - NAT-292: Binary upload acknowledgement does not update the editor's source-version map. The next compile fails with
Save image.png before compiling; reopening the project supplies the missing hash. - NAT-300: The production CAPTCHA configuration rejects tokenless sign-in OTP requests but allows the reset-specific endpoint to send email without a token. Better Auth's other rate limits still apply.
Other reproduced integration gaps
- NAT-293: A collaborator can read a personal project by ID, but
getProjectsexcludes it from their dashboard. - NAT-294: A soft-deleted personal project still reserves its owner's project name through an unconditional unique index.
- NAT-295: The web validator accepts
chapter:1.texand a 241-character filename; the compiler rejects the entire project containing either path. Nested full-path lengths are not checked at creation. - NAT-296: File metadata has initial route snapshots and local RPC acknowledgements only. Another open collection never learns about a new file. The text CRDT protocol and build SSE do not carry node metadata.
- NAT-301: The actual authenticated compile handler returns 202 once, then throws a Postgres duplicate-key error on an identical compilation-ID retry. The compiler's idempotency checks sit below this failing boundary.
The binary probe ran the real files store with a captured server acknowledgement and executed the original sourceFiles function extracted from the workspace. The metadata probe ran two real RPC collections with a shared server fixture. Neither was a full rendered-workspace browser test. The compile-route probe used the real handler and Postgres, with fixtures for session identity and the compiler response. The CAPTCHA probe used the production plugin configuration and real Better Auth HTTP handling, with memory storage and a captured sender.
Coverage and what is solid
| Area reviewed | Source and runtime evidence | Assessment |
|---|---|---|
| Authentication and organizations | Auth config, email sender, client/server helpers, login and invitation routes, generated auth schema; existing auth tests and new OTP endpoint tests | Organization recipient verification and owner/admin billing authorization have meaningful tests. OTP delivery is implemented. Live OAuth, Stripe and Turnstile provider behavior remain unverified. |
| Projects and database | All database package source, Drizzle config and template SQL; project/access/node/source server functions and validators; real Postgres suite and targeted probes | Transactions, owner/viewer/editor reads and writes, binary state, uniqueness rollback and source quotas are exercised. Dashboard, deletion-name and path-policy gaps are filed. |
| Authoritative sources | Source functions/routes, content-addressed R2 keys, optimistic conflict checks, garbage collection and compile resync; real Postgres/local R2 suite | Fresh reads, UTF-8 byte sizes, binary uploads, deduplication, conflict rejection, rollback, recursive deletion, orphan collection and concurrent quotas pass. |
| Collaboration | DO, client, protocol, chunked SQLite storage, source persistence and authenticated upgrade route; real Miniflare/Chromium suite plus revocation/deletion probes | Convergence, offline merge/reload, viewers, cursors, local undo, formatting, hibernation, multi-chunk persistence and recovery after quota rejection pass. Revocation, purge and metadata synchronization remain release work. |
| Workspace and editor | Route/provider lifetimes, RPC stores, workspace save/compile/export, tree/upload/generated viewers, CodeMirror integration, analysis/format workers, commands/symbols and settings | Backend and editor primitives have focused tests. Full workspace upload-to-compile and sharing flows are not established by the existing component harness. Inert actions, retry UX and missing management paths are filed. |
| Compiler service | Every compiler source module and Worker adapter, queues, coordinator, usage limits, pool, local runtime/container adapter, manifests, streaming and telemetry | Compiler TypeScript tests and Go race tests pass. Tests cover supersession, serialization, retries/DLQ, quota reservations, source sync, atomic publication and retention. They do not prove deployed Cloudflare scheduling or latency. |
| Go/Tectonic engine | Go engine and tests, Dockerfiles, Rust cache patch/module and verification scripts | Built the current engine image. Real Tectonic checks pass for delta-only recompiles, binary reuse, restart resync, on-disk hash repair, generated sources consumed from out/, multipart output, failure logs and all three starter PNG previews. |
| Templates | All template server/schema/seed helpers, API routes, gallery/detail/publish/review routes and tests | Real Postgres/R2 snapshot, organization access, moderation, quotas and preview-state tests pass. Real starter PDF/PNG generation passes. Product design/seeding/cron behavior remains in NAT-287. |
| Themes, settings and UI support | Theme parser/compiler/bootstrap/provider, syntax mapping, settings storage, app/marketing boundaries and UI wrappers | Existing tests cover theme parsing and hostile input, account-scoped appearance, settings migration, cross-tab storage and storage failures. This audit is not a visual/accessibility sign-off. |
| Docs and delivery | Root/package READMEs, compiler design/measurement docs, SQL, Compose, Turbo tasks, CI, environment examples, Wrangler configuration and generated bindings | Known missing docs/SQL confirmed. Build coverage and current compiler documentation drift were found. Deployment provisioning remains NAT-198. |
Generated route/binding declarations and component wrappers were inspected as integration support. Dependency internals were consulted for the OTP/CAPTCHA contracts. Third-party dependencies were not exhaustively audited. Historical performance reports were read as historical evidence; this audit makes no new speedup or deployed-latency claim.
Existing issue ownership
NAT-285: cleanup and documentation
The following remain in NAT-285, rather than duplicate issues:
- Root README links to missing
docs/database-deployment.md,docs/themes.mdanddocs/compile-telemetry.md. - Web/database READMEs refer to missing
packages/db/sql/20261111_project_sources.sql. - Root design prose/diagram says drafts are browser-only, save submits snapshots, and Mod+S compiles. Current sources persist to R2, Yjs edits are durable in a DO, compile uses deltas and Mod+S saves without compiling.
- Settings UI still says “Save locally and compile” and describes browser-only saved sources.
- Compiler README and cold-start report say the current path does not use spare claims and routes only to
project:<id>;worker.tsnow assigns containers through PoolManager. - Compiler README says 60-second runs and the old 10/minute rate limit. Current policies use 15 seconds for Free, 300 seconds for Pro/Team, Free 2/10 seconds, and rolling fair-use accounting.
- Web README contains starter copy, outdated UIW theme-selection instructions, references to missing demo routes, and incomplete environment guidance. Google/GitLab/Microsoft credentials used by auth.ts are absent from the example.
- The unused legacy
project_node_textpersistence table and old UIW theme package should be evaluated in the cleanup. Current production Yjs writes use DO SQLite; the table is exercised by the old Postgres test. - Top-level web Worker naming remains
tanstack-start-app. Dead fallback routing and unused dependencies need the cleanup pass, without changing release functionality here.
NAT-198: first deployment
NAT-198 retains Neon/Hyperdrive provisioning, cache-disabled production bindings, region placement, the production placeholder ID, resource provisioning, secrets and a reviewed baseline generated from the final release schema. There are no committed Drizzle migrations. The template SQL exists; the referenced source SQL does not. No cloud deployment or provisioning was performed.
NAT-283: pricing and billing
NAT-283 retains the advertised project/editor/storage caps, the empty comparison table, Team seat checkout/shared billing, and the inert pricing CTAs, including Pro. Auth config defines only a Pro Stripe price; compile entitlement derives from user/organization subscriptions. Live checkout, webhooks, seat changes and billing/entitlement consistency need end-to-end verification there.
NAT-287: templates
NAT-287 retains the template rework, original-template Drizzle seeding, local preview progression without scheduled events, Free-tier preview compilation and publication lifecycle choices. The current seed action creates reviewer-owned projects and uses normal publishing quotas. The rework should also account for compiler-side legacy preview/job object retention; current legacy recovery handles pending jobs, not terminal artifact expiry.
Deferred features and release order
- NAT-288 is the next v1 step. Source blobs, local Yjs journals and latest build records do not provide a user-facing document history feature today.
- NAT-266 remains post-v1. No assistant backend, agent billing or assistant panel was found in the current tree. The landing page still mentions agents; NAT-298 tracks aligning launch claims.
- NAT-267 is excluded entirely from the first release. No repository synchronization implementation was found. GitHub/GitLab OAuth sign-in is account authentication and does not constitute git integration.
- The planned v1 sequence remains audit → history → templates → UI → cleanup → pricing. The filed correctness findings must be resolved before shipping, even where their parent audit has finished.
Verification and limits
Commands ran locally against a separate disposable Postgres 18 container/database, isolated Miniflare storage and dedicated compiler containers. Existing application databases and running project containers were not reused.
| Check | Outcome |
|---|---|
| Web unit tests, including OTP/auth, themes/settings, editor commands, source sync and compile recovery | Pass |
| Compiler TypeScript tests and Go race suite | Pass |
| Workspace typecheck | Pass |
| Lint, including Go vet | Pass |
| Formatting and diff whitespace | Pass |
apps/app/test/postgres.ts | Pass |
apps/app/test/source-storage.ts | Pass |
apps/app/test/templates.ts | Pass |
apps/app/test/collaboration.ts | Pass |
| Current engine Docker build | Pass |
apps/compiler/scripts/verify-source-sync.ts with the rebuilt image | Pass |
apps/compiler/scripts/verify-build-output.ts | Pass |
apps/compiler/test/template-preview.integration.ts | Pass |
| Web production build | Fail: missing Geist dependency, NAT-289 |
apps/app/test/template-pages.ts | Not rerun in this audit; server-rendered source reviewed, complete app build is broken |
| External email, OAuth, live Stripe/Turnstile, deployed Cloudflare runtime | Not exercised |
The Bun source/template integration scripts catch failed compiler invalidation/deletion calls because cloudflare:workers is unavailable in that test process. Their passing result proves the tested SQL/R2 behavior, not those compiler side effects. The collaboration harness supplies test identities and a compiler fixture. Most compiler TS tests use SQLite and controlled engines; the separate real-Tectonic checks close the engine-output gap, not the entire authenticated web-to-cloud path.
The local reproduction scripts and raw logs live in ignored .audit/. The Linear findings describe the reproduction steps and distinguish runtime probes from source review. This report is the durable audit summary; temporary fixtures are not shipped application code.
The requested independent Claude Opus 5.5 review did not run: Cursor rejected it because its usage quota was exhausted. There is no external review verdict. The author checked the decision trail against the active transcript, corrected an evidence pointer, and retained the raw logs; that check is not an independent review.