Skip to content

A one-of-a-kind resume builder that keeps your privacy in mind. Completely secure, customizable, portable, open-source and free forever. Try it out today!

feat(web): add opt-in TanStack Redact build mode

Amruth Pillaia23bbd0687be
diff --git a/.agents/docs/research/redact-results.json b/.agents/docs/research/redact-results.json
new file mode 100644
index 000000000..82563f6aa
--- /dev/null
+++ b/.agents/docs/research/redact-results.json
@@ -0,0 +1,556 @@
+{
+ "date": "2026-10-27T01:36:51.018Z",
+ "node": "v24.22.1",
+ "browser": "156.0.8078.4",
+ "cpuThrottle": 4,
+ "network": "Loopback, gzip, no simulated network latency; public APIs stubbed; external requests blocked",
+ "sizes": {
+ "react": {
+ "eager": {
+ "raw": 1066294,
+ "gzip": 340880,
+ "files": 45
+ },
+ "all": {
+ "raw": 23765623,
+ "gzip": 7266329,
+ "files": 322
+ }
+ },
+ "redact": {
+ "eager": {
+ "raw": 888845,
+ "gzip": 294793,
+ "files": 45
+ },
+ "all": {
+ "raw": 23503047,
+ "gzip": 7216429,
+ "files": 322
+ }
+ }
+ },
+ "summary": [
+ {
+ "path": "/",
+ "react": {
+ "entryEvaluatedMs": 391.0500000715256,
+ "fcpMs": 308,
+ "scriptMs": 379.846
+ },
+ "redact": {
+ "entryEvaluatedMs": 362.25,
+ "fcpMs": 298,
+ "scriptMs": 239.5
+ }
+ },
+ {
+ "path": "/ats-checker",
+ "react": {
+ "entryEvaluatedMs": 241.94999992847443,
+ "fcpMs": 112,
+ "scriptMs": 285.236
+ },
+ "redact": {
+ "entryEvaluatedMs": 226.75000005960464,
+ "fcpMs": 110,
+ "scriptMs": 199.8295
+ }
+ },
+ {
+ "path": "/auth/login",
+ "react": {
+ "entryEvaluatedMs": 233.0999999642372,
+ "fcpMs": 116,
+ "scriptMs": 262.2835
+ },
+ "redact": {
+ "entryEvaluatedMs": 219.44999998807907,
+ "fcpMs": 114,
+ "scriptMs": 224.4445
+ }
+ }
+ ],
+ "samples": [
+ {
+ "name": "react",
+ "path": "/",
+ "round": 0,
+ "entryEvaluatedMs": 383.2000000476837,
+ "fcpMs": 312,
+ "scriptMs": 375.517
+ },
+ {
+ "name": "react",
+ "path": "/ats-checker",
+ "round": 0,
+ "entryEvaluatedMs": 236.19999992847443,
+ "fcpMs": 104,
+ "scriptMs": 279.899
+ },
+ {
+ "name": "react",
+ "path": "/auth/login",
+ "round": 0,
+ "entryEvaluatedMs": 230.79999995231628,
+ "fcpMs": 116,
+ "scriptMs": 255.04700000000003
+ },
+ {
+ "name": "redact",
+ "path": "/",
+ "round": 0,
+ "entryEvaluatedMs": 356.39999997615814,
+ "fcpMs": 296,
+ "scriptMs": 238.309
+ },
+ {
+ "name": "redact",
+ "path": "/ats-checker",
+ "round": 0,
+ "entryEvaluatedMs": 226.70000004768372,
+ "fcpMs": 112,
+ "scriptMs": 203.964
+ },
+ {
+ "name": "redact",
+ "path": "/auth/login",
+ "round": 0,
+ "entryEvaluatedMs": 223.10000002384186,
+ "fcpMs": 116,
+ "scriptMs": 226.016
+ },
+ {
+ "name": "redact",
+ "path": "/",
+ "round": 1,
+ "entryEvaluatedMs": 367,
+ "fcpMs": 304,
+ "scriptMs": 238.364
+ },
+ {
+ "name": "redact",
+ "path": "/ats-checker",
+ "round": 1,
+ "entryEvaluatedMs": 232.40000009536743,
+ "fcpMs": 108,
+ "scriptMs": 200.509
+ },
+ {
+ "name": "redact",
+ "path": "/auth/login",
+ "round": 1,
+ "entryEvaluatedMs": 218.10000002384186,
+ "fcpMs": 112,
+ "scriptMs": 225.48000000000002
+ },
+ {
+ "name": "react",
+ "path": "/",
+ "round": 1,
+ "entryEvaluatedMs": 375.7999999523163,
+ "fcpMs": 304,
+ "scriptMs": 380.627
+ },
+ {
+ "name": "react",
+ "path": "/ats-checker",
+ "round": 1,
+ "entryEvaluatedMs": 244,
+ "fcpMs": 112,
+ "scriptMs": 291.626
+ },
+ {
+ "name": "react",
+ "path": "/auth/login",
+ "round": 1,
+ "entryEvaluatedMs": 231.79999995231628,
+ "fcpMs": 116,
+ "scriptMs": 260
+ },
+ {
+ "name": "react",
+ "path": "/",
+ "round": 2,
+ "entryEvaluatedMs": 382,
+ "fcpMs": 308,
+ "scriptMs": 379.065
+ },
+ {
+ "name": "react",
+ "path": "/ats-checker",
+ "round": 2,
+ "entryEvaluatedMs": 241.69999992847443,
+ "fcpMs": 112,
+ "scriptMs": 285.714
+ },
+ {
+ "name": "react",
+ "path": "/auth/login",
+ "round": 2,
+ "entryEvaluatedMs": 234.60000002384186,
+ "fcpMs": 116,
+ "scriptMs": 262.606
+ },
+ {
+ "name": "redact",
+ "path": "/",
+ "round": 2,
+ "entryEvaluatedMs": 380.89999997615814,
+ "fcpMs": 316,
+ "scriptMs": 245.578
+ },
+ {
+ "name": "redact",
+ "path": "/ats-checker",
+ "round": 2,
+ "entryEvaluatedMs": 223.80000007152557,
+ "fcpMs": 112,
+ "scriptMs": 191.399
+ },
+ {
+ "name": "redact",
+ "path": "/auth/login",
+ "round": 2,
+ "entryEvaluatedMs": 222,
+ "fcpMs": 116,
+ "scriptMs": 223.409
+ },
+ {
+ "name": "redact",
+ "path": "/",
+ "round": 3,
+ "entryEvaluatedMs": 357,
+ "fcpMs": 296,
+ "scriptMs": 238.125
+ },
+ {
+ "name": "redact",
+ "path": "/ats-checker",
+ "round": 3,
+ "entryEvaluatedMs": 226.80000007152557,
+ "fcpMs": 112,
+ "scriptMs": 199.15
+ },
+ {
+ "name": "redact",
+ "path": "/auth/login",
+ "round": 3,
+ "entryEvaluatedMs": 220.69999992847443,
+ "fcpMs": 112,
+ "scriptMs": 238.596
+ },
+ {
+ "name": "react",
+ "path": "/",
+ "round": 3,
+ "entryEvaluatedMs": 426.89999997615814,
+ "fcpMs": 344,
+ "scriptMs": 402.381
+ },
+ {
+ "name": "react",
+ "path": "/ats-checker",
+ "round": 3,
+ "entryEvaluatedMs": 242.70000004768372,
+ "fcpMs": 112,
+ "scriptMs": 284.75800000000004
+ },
+ {
+ "name": "react",
+ "path": "/auth/login",
+ "round": 3,
+ "entryEvaluatedMs": 236.10000002384186,
+ "fcpMs": 116,
+ "scriptMs": 262.44800000000004
+ },
+ {
+ "name": "react",
+ "path": "/",
+ "round": 4,
+ "entryEvaluatedMs": 398.90000009536743,
+ "fcpMs": 308,
+ "scriptMs": 396.482
+ },
+ {
+ "name": "react",
+ "path": "/ats-checker",
+ "round": 4,
+ "entryEvaluatedMs": 242.19999992847443,
+ "fcpMs": 116,
+ "scriptMs": 293.17199999999997
+ },
+ {
+ "name": "react",
+ "path": "/auth/login",
+ "round": 4,
+ "entryEvaluatedMs": 227.10000002384186,
+ "fcpMs": 112,
+ "scriptMs": 253.991
+ },
+ {
+ "name": "redact",
+ "path": "/",
+ "round": 4,
+ "entryEvaluatedMs": 366.2999999523163,
+ "fcpMs": 304,
+ "scriptMs": 244.886
+ },
+ {
+ "name": "redact",
+ "path": "/ats-checker",
+ "round": 4,
+ "entryEvaluatedMs": 242.5,
+ "fcpMs": 132,
+ "scriptMs": 210.238
+ },
+ {
+ "name": "redact",
+ "path": "/auth/login",
+ "round": 4,
+ "entryEvaluatedMs": 213.29999995231628,
+ "fcpMs": 112,
+ "scriptMs": 220.20100000000002
+ },
+ {
+ "name": "redact",
+ "path": "/",
+ "round": 5,
+ "entryEvaluatedMs": 352.40000009536743,
+ "fcpMs": 296,
+ "scriptMs": 241.154
+ },
+ {
+ "name": "redact",
+ "path": "/ats-checker",
+ "round": 5,
+ "entryEvaluatedMs": 225.10000002384186,
+ "fcpMs": 112,
+ "scriptMs": 196.79399999999998
+ },
+ {
+ "name": "redact",
+ "path": "/auth/login",
+ "round": 5,
+ "entryEvaluatedMs": 208.89999997615814,
+ "fcpMs": 108,
+ "scriptMs": 218.272
+ },
+ {
+ "name": "react",
+ "path": "/",
+ "round": 5,
+ "entryEvaluatedMs": 377.7999999523163,
+ "fcpMs": 304,
+ "scriptMs": 372.544
+ },
+ {
+ "name": "react",
+ "path": "/ats-checker",
+ "round": 5,
+ "entryEvaluatedMs": 236.80000007152557,
+ "fcpMs": 112,
+ "scriptMs": 271.18199999999996
+ },
+ {
+ "name": "react",
+ "path": "/auth/login",
+ "round": 5,
+ "entryEvaluatedMs": 225.60000002384186,
+ "fcpMs": 112,
+ "scriptMs": 260.978
+ },
+ {
+ "name": "react",
+ "path": "/",
+ "round": 6,
+ "entryEvaluatedMs": 406.89999997615814,
+ "fcpMs": 304,
+ "scriptMs": 377.5
+ },
+ {
+ "name": "react",
+ "path": "/ats-checker",
+ "round": 6,
+ "entryEvaluatedMs": 238.19999992847443,
+ "fcpMs": 128,
+ "scriptMs": 281.209
+ },
+ {
+ "name": "react",
+ "path": "/auth/login",
+ "round": 6,
+ "entryEvaluatedMs": 235.30000007152557,
+ "fcpMs": 116,
+ "scriptMs": 262.11899999999997
+ },
+ {
+ "name": "redact",
+ "path": "/",
+ "round": 6,
+ "entryEvaluatedMs": 364,
+ "fcpMs": 300,
+ "scriptMs": 240.636
+ },
+ {
+ "name": "redact",
+ "path": "/ats-checker",
+ "round": 6,
+ "entryEvaluatedMs": 224.29999995231628,
+ "fcpMs": 108,
+ "scriptMs": 194.596
+ },
+ {
+ "name": "redact",
+ "path": "/auth/login",
+ "round": 6,
+ "entryEvaluatedMs": 218.20000004768372,
+ "fcpMs": 116,
+ "scriptMs": 218.487
+ },
+ {
+ "name": "redact",
+ "path": "/",
+ "round": 7,
+ "entryEvaluatedMs": 360.5,
+ "fcpMs": 300,
+ "scriptMs": 231.94699999999997
+ },
+ {
+ "name": "redact",
+ "path": "/ats-checker",
+ "round": 7,
+ "entryEvaluatedMs": 226.39999997615814,
+ "fcpMs": 108,
+ "scriptMs": 191.915
+ },
+ {
+ "name": "redact",
+ "path": "/auth/login",
+ "round": 7,
+ "entryEvaluatedMs": 212.5,
+ "fcpMs": 112,
+ "scriptMs": 221.98000000000002
+ },
+ {
+ "name": "react",
+ "path": "/",
+ "round": 7,
+ "entryEvaluatedMs": 372,
+ "fcpMs": 300,
+ "scriptMs": 375.669
+ },
+ {
+ "name": "react",
+ "path": "/ats-checker",
+ "round": 7,
+ "entryEvaluatedMs": 238.10000002384186,
+ "fcpMs": 112,
+ "scriptMs": 281.82099999999997
+ },
+ {
+ "name": "react",
+ "path": "/auth/login",
+ "round": 7,
+ "entryEvaluatedMs": 234.39999997615814,
+ "fcpMs": 120,
+ "scriptMs": 267.317
+ },
+ {
+ "name": "react",
+ "path": "/",
+ "round": 8,
+ "entryEvaluatedMs": 432.7999999523163,
+ "fcpMs": 312,
+ "scriptMs": 396.61899999999997
+ },
+ {
+ "name": "react",
+ "path": "/ats-checker",
+ "round": 8,
+ "entryEvaluatedMs": 258.1999999284744,
+ "fcpMs": 116,
+ "scriptMs": 297.413
+ },
+ {
+ "name": "react",
+ "path": "/auth/login",
+ "round": 8,
+ "entryEvaluatedMs": 223.30000007152557,
+ "fcpMs": 112,
+ "scriptMs": 289.008
+ },
+ {
+ "name": "redact",
+ "path": "/",
+ "round": 8,
+ "entryEvaluatedMs": 350.5,
+ "fcpMs": 296,
+ "scriptMs": 231.838
+ },
+ {
+ "name": "redact",
+ "path": "/ats-checker",
+ "round": 8,
+ "entryEvaluatedMs": 231,
+ "fcpMs": 108,
+ "scriptMs": 213.564
+ },
+ {
+ "name": "redact",
+ "path": "/auth/login",
+ "round": 8,
+ "entryEvaluatedMs": 232.10000002384186,
+ "fcpMs": 124,
+ "scriptMs": 252.639
+ },
+ {
+ "name": "redact",
+ "path": "/",
+ "round": 9,
+ "entryEvaluatedMs": 404.89999997615814,
+ "fcpMs": 292,
+ "scriptMs": 242.971
+ },
+ {
+ "name": "redact",
+ "path": "/ats-checker",
+ "round": 9,
+ "entryEvaluatedMs": 252.80000007152557,
+ "fcpMs": 108,
+ "scriptMs": 231.222
+ },
+ {
+ "name": "redact",
+ "path": "/auth/login",
+ "round": 9,
+ "entryEvaluatedMs": 241.09999990463257,
+ "fcpMs": 124,
+ "scriptMs": 244.67600000000002
+ },
+ {
+ "name": "react",
+ "path": "/",
+ "round": 9,
+ "entryEvaluatedMs": 422.1999999284744,
+ "fcpMs": 312,
+ "scriptMs": 395.98499999999996
+ },
+ {
+ "name": "react",
+ "path": "/ats-checker",
+ "round": 9,
+ "entryEvaluatedMs": 244.30000007152557,
+ "fcpMs": 112,
+ "scriptMs": 301.85699999999997
+ },
+ {
+ "name": "react",
+ "path": "/auth/login",
+ "round": 9,
+ "entryEvaluatedMs": 238.69999992847443,
+ "fcpMs": 120,
+ "scriptMs": 292.03200000000004
+ }
+ ]
+}
diff --git a/.agents/docs/research/redact.md b/.agents/docs/research/redact.md
new file mode 100644
index 000000000..04f7795c0
--- /dev/null
+++ b/.agents/docs/research/redact.md
@@ -0,0 +1,134 @@
+# TanStack Redact evaluation
+
+Measured October 27, 2026 against source `b700ed9d7309dfc9fba0c33e0bf5429811f0b610`, React 19.3.1,
+Redact 0.2.0, Vite+ 1.3.0, Node 24.22.1, Chromium 156.0.8078.4. Dependency is pinned for reproducibility.
+
+## Decision
+
+Redact is implemented as an **opt-in web build mode**. Normal development and production builds retain native React.
+Do not enable Redact for production yet: an existing keyboard-focus browser test fails with Redact and passes with
+native React. The smaller bundle and local startup improvements do not establish compatibility with the whole app.
+
+```sh
+pnpm --filter web build --mode redact
+pnpm --filter web dev --mode redact
+```
+
+No application React imports, shared package APIs, mobile runtime, or backend runtime change. React Compiler remains
+enabled. Redact's default `full` preset is retained; no optional compatibility features are removed to improve results.
+
+## Integration boundaries
+
+- Redact's Vite plugin aliases the web DOM runtime and its server prerenderer.
+- `packages/pdf`, `@formepdf/react`, `react-reconciler`, and React's own internal imports retain native React, JSX,
+ compiler runtime, and scheduler resolution. Our Forme/template renderer uses `react-reconciler`'s private dispatcher;
+ Redact's ordinary React entry does not expose the internals it expects. Aliasing that graph wholesale is unsafe.
+- PDF workers retain their existing native React build. The main-thread PDF fallback and resume web-page preview
+ also reach the native template graph through the importer-based resolver.
+- The same resolver runs in Vite's dependency optimizer. Without it, development prebundles imported native React
+ inside TanStack Router and failed with an invalid-hook-call/null dispatcher, even though production builds worked.
+- Redact-mode prerendering bundles dependencies (`ssr.noExternal: true`). The unmodified plugin integration failed
+ prerendering with `Cannot read properties of undefined (reading '_currentValue')`: external dependencies were
+ still constructing native React contexts while the bundled renderer used Redact.
+- Config tests cover native production defaults and resolution of both runtime graphs, including compiler runtime
+ and scheduler. They are complemented by real browser PDF export coverage; they do not prove every third-party
+ component compatible.
+
+## Measured bundle difference
+
+Sizes are bytes compressed with Node's default gzip, summed **per file**. Decimal KB below means 1,000 bytes.
+Eager JavaScript is the browser entry, HTML module preloads, and recursively followed static JavaScript imports;
+it excludes lazy route imports. All JavaScript includes emitted locale chunks and workers; it is not a page download.
+
+| Output | Native React | Redact | Difference |
+| ------------------------------ | -----------: | ----------: | -------------------: |
+| Eager JavaScript, gzip | 340,880 B | 294,793 B | -46,087 B (-13.52%) |
+| Eager JavaScript, uncompressed | 1,066,294 B | 888,845 B | -177,449 B (-16.64%) |
+| All emitted `.js`, gzip | 7,266,329 B | 7,216,429 B | -49,900 B (-0.69%) |
+
+Both builds emitted 322 `.js` assets, with 45 in the eager graph. `.mjs`, CSS, fonts, images, and WASM are outside
+these JavaScript totals. Keeping native React for custom renderers is included in the Redact result.
+
+## Measured public-page startup
+
+One discarded warm-up per page/runtime, then ten fresh browser contexts per page/runtime, alternating renderer order.
+Three routes, 60 retained samples. Chromium uses 4x CPU throttling, light color scheme, English locale, and reduced
+motion. Both snapshots use the same loopback gzip static server, deterministic signed-out public API fixtures,
+no browser cache, and blocked external requests. No network latency or bandwidth throttling is simulated.
+
+| Route | Entry module evaluated: React / Redact | First contentful paint: React / Redact | Script execution: React / Redact |
+| -------------- | -------------------------------------: | -------------------------------------: | -------------------------------: |
+| `/` | 391.1 / 362.3 ms | 308 / 298 ms | 379.8 / 239.5 ms |
+| `/ats-checker` | 241.9 / 226.8 ms | 112 / 110 ms | 285.2 / 199.8 ms |
+| `/auth/login` | 233.1 / 219.4 ms | 116 / 114 ms | 262.3 / 224.4 ms |
+
+Values are medians, not confidence intervals. Entry evaluation is measured by the entry module script's `load`
+event, including its top-level awaits; it is not time to interactive. Script duration is Chromium's accumulated
+`ScriptDuration`, sampled after a successful theme toggle or login-input fill, not a pure renderer microbenchmark.
+The benchmark asserts those interactions succeed and that no page exceptions or HTTP error responses occur.
+
+Local entry evaluation improved about 6–7%; script execution was lower in this workload. First-paint differences
+were small. These results do not establish field INP, LCP, typing latency, authenticated builder performance,
+hydration performance, mobile-device performance, or behavior on a real network. Marketing HTML is prerendered and
+then replaced with `createRoot`, so the app does not hydrate those pages. Raw samples: [redact-results.json](./redact-results.json).
+
+## Compatibility findings
+
+Sources: [compatibility chart](https://tanstack.com/redact/latest/docs/compatibility),
+[Vite integration](https://tanstack.com/redact/latest/docs/vite-plugin),
+[integration verification](https://tanstack.com/redact/latest/docs/verification),
+[upstream performance evidence](https://tanstack.com/redact/latest/docs/performance).
+The published package source was also inspected; documentation claims are not substitutes for our app's tests.
+
+| Area | Consequence for this app |
+| ------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
+| **Confirmed: autofocus** | `section-editing.spec.ts:16` fails after Add experience: Position exists but is not focused. Same test passes on native React. Redact's DOM setter emits `autofocus` but has no React-style commit-time focus handling; the app clears its one-time focus request in an effect. Do not weaken the accessibility assertion or change app behavior to mask this. |
+| **Confirmed: custom renderer** | Native dispatcher isolation is required for PDF/template rendering. A global React alias is insufficient. Keep isolation when upgrading; retest PDF worker, main-thread fallback, and web-page preview. |
+| **Confirmed: prerendering** | Plain `redact()` failed the existing production prerender build. Bundling SSR dependencies consistently fixes the observed mixed-context failure. This changes the prerender bundle graph and can affect build cost. |
+| Scheduling | Rendering stays synchronous; no time slicing or interruptible renders. `useDeferredValue` in resume checks, application search, and career knowledge search loses React's concurrent scheduling guarantees. Large resumes/lists and slower devices need responsiveness testing. |
+| Suspense and transitions | APIs exist, with different scheduling. Dialogs, lazy editors, PDF.js preview, Query suspense, and router transitions warrant app-level regression tests. Upstream measurements include slower Suspense retries and passive effects; its microbenchmark ratios are not our app's timings. |
+| React Compiler | Compiler entry is implemented and aliased, but upstream explicitly does not validate every compiler output pattern. Existing compiler test passes; that is not exhaustive behavioral proof. |
+| DOM/forms/portals | Upstream reports shared React tests. Our auth, rich-text keyboard controls, guest flow, JSON import/export, sharing, and shaped-script PDF download tests pass in Redact mode. Autofocus is a concrete exception. Drag-and-drop, cropper, virtual lists, all dialogs, and streaming assistant behavior remain outside this focused gate. |
+| Debugging | StrictMode avoids React's double invocation. `<Profiler>` callback is a no-op. Development DevTools support does not restore those diagnostics; no Profiler-based speed claim is made. |
+| SSR/cache | String/static rendering and streams exist, but full Fizz prerender/resume APIs do not. `cache` is an identity wrapper, `cacheSignal` is null, and client cache refresh is a no-op. Our current build-time string prerender works; backend/public resume rendering retains native React. |
+| Animation/browser differences | Redact's native ViewTransition animation feature stays disabled by default. Router use of browser view transitions is separate. Upstream lists unresolved native-animation, hidden-tab/resource/navigation, and Safari/Firefox verification gaps; do not infer unsupported browsers, or claim our app verified in them. |
+| Release maturity | This is a 0.2.0 alternative runtime. React API coverage and upstream test counts do not guarantee compatibility with all current/future dependencies. Keep the pin and native control when evaluating upgrades. |
+
+## Validation
+
+- Both native and Redact production web builds pass; all three marketing pages prerender for the configured locales.
+- Server production build passes; server stays on native React.
+- Web unit suite: 86 files, 370 tests passed. Vitest uses its normal native-React config, so this is a regression
+ check for our source/config changes, **not** a claim that 370 tests ran against Redact.
+- Web and tooling typechecks, repository lint/format checks, and package boundaries pass.
+- Redact production Chromium gate: 6 passed, 1 failed across auth, guest conversion, JSON import/export,
+ section editing, PDF downloads, and sharing. The failure is the focus assertion above.
+- Native production control: all seven tests in the same focused gate passed, including that same focus assertion.
+- Redact development smoke: homepage theme toggle and login-input fill passed without page exceptions, with public
+ APIs stubbed. This verifies the optimizer integration, not authentication or PDF rendering in development.
+- Final native and Redact client output each matched their benchmark snapshot byte for byte. Normal native React
+ build output was restored after evaluation.
+
+No hosted CI, deployment, complete cross-browser suite, or real-device benchmark is claimed. Before enabling by
+default, resolve the upstream focus behavior, repeat the browser gate, and measure large-resume typing/search,
+PDF fallback/preview, assistant streaming, drag-and-drop, and Safari/Firefox behavior.
+
+## Reproduce the benchmark
+
+Run from repository root with installed dependencies and Playwright Chromium available. No database or production
+credentials are used by the benchmark server. Build snapshots are outside the checkout, so later builds do not alter
+the control. Run the browser benchmark after other build/test processes have finished.
+
+```sh
+bench_dir="$(mktemp -d)"
+pnpm --filter web build
+mkdir -p "$bench_dir/react"
+cp -R apps/web/dist apps/web/dist-prerender "$bench_dir/react/"
+pnpm --filter web build --mode redact
+mkdir -p "$bench_dir/redact"
+cp -R apps/web/dist apps/web/dist-prerender "$bench_dir/redact/"
+node tooling/redact/benchmark.mjs "$bench_dir/react" "$bench_dir/redact" "$bench_dir/results.json"
+```
+
+For the real browser compatibility gate, use the disposable-database setup in `tests/e2e/README.md`, build with
+`--mode redact`, build the server, then run the existing specs. Never point those tests at production data.
diff --git a/apps/web/package.json b/apps/web/package.json
index 57b3e201f..96d759685 100644
--- a/apps/web/package.json
+++ b/apps/web/package.json
@@ -102,6 +102,7 @@
"@tanstack/react-devtools": "^0.10.13",
"@tanstack/react-query-devtools": "^5.105.0",
"@tanstack/react-router-devtools": "^1.167.2",
+ "@tanstack/redact": "catalog:",
"@tanstack/router-plugin": "^1.168.48",
"@types/babel__core": "^7.20.5",
"@types/react": "catalog:",
diff --git a/apps/web/src/redact.test.ts b/apps/web/src/redact.test.ts
new file mode 100644
index 000000000..671f44310
--- /dev/null
+++ b/apps/web/src/redact.test.ts
@@ -0,0 +1,43 @@
+import type { Plugin } from "vite-plus";
+import { createRequire } from "node:module";
+import { fileURLToPath } from "node:url";
+import { describe, expect, it } from "vite-plus/test";
+import { loadConfigFromFile } from "vite-plus";
+
+const configFile = fileURLToPath(new URL("../vite.config.ts", import.meta.url));
+const appFile = fileURLToPath(new URL("./main.tsx", import.meta.url));
+const pdfFile = fileURLToPath(new URL("../../../packages/pdf/src/forme/reconciler.ts", import.meta.url));
+
+async function config(mode: string) {
+ const loaded = await loadConfigFromFile({ command: "build", mode }, configFile);
+ if (!loaded) throw new Error("Web Vite configuration did not load");
+ const plugins = loaded.config.plugins?.flat(3).filter((plugin) => plugin && "name" in plugin) as Plugin[];
+ return { config: loaded.config, plugins };
+}
+
+describe("Redact integration", () => {
+ it("keeps normal production builds on native React", async () => {
+ const { config: resolved, plugins } = await config("production");
+ expect(plugins.some((plugin) => plugin.name.startsWith("redact"))).toBe(false);
+ expect(resolved.ssr?.noExternal).toBeUndefined();
+ });
+
+ it("isolates the PDF dispatcher and compiler runtime from the web renderer", async () => {
+ const { config: resolved, plugins } = await config("redact");
+ const plugin = plugins.find((plugin) => plugin.name === "redact-with-native-pdf");
+ expect(typeof plugin?.resolveId).toBe("function");
+ const resolveId = plugin?.resolveId as (source: string, importer: string) => string | undefined;
+ const webRequire = createRequire(appFile);
+ const pdfRequire = createRequire(pdfFile);
+ for (const source of ["react", "react/jsx-runtime", "react/jsx-dev-runtime", "react/compiler-runtime"]) {
+ expect(resolveId(source, appFile)).toBe(webRequire.resolve(source.replace(/^react/, "@tanstack/redact")));
+ expect(resolveId(source, pdfFile)).toBe(pdfRequire.resolve(source));
+ }
+ const reconciler = pdfRequire.resolve("react-reconciler");
+ expect(resolveId("react", reconciler)).toBe(createRequire(reconciler).resolve("react"));
+ expect(resolveId("scheduler", reconciler)).toBe(createRequire(reconciler).resolve("scheduler"));
+ expect(resolveId("scheduler", appFile)).toBe(webRequire.resolve("@tanstack/redact/scheduler"));
+ expect(resolveId("unrelated", appFile)).toBeUndefined();
+ expect(resolved.ssr?.noExternal).toBe(true);
+ });
+});
diff --git a/apps/web/vite.config.ts b/apps/web/vite.config.ts
index 168278266..043c88396 100644
--- a/apps/web/vite.config.ts
+++ b/apps/web/vite.config.ts
@@ -1,11 +1,13 @@
import type { Plugin, ProxyOptions } from "vite-plus";
import { readFileSync } from "node:fs";
import { mkdir, readFile, readdir, rm, writeFile } from "node:fs/promises";
+import { createRequire } from "node:module";
import { fileURLToPath, pathToFileURL } from "node:url";
import { lingui } from "@lingui/vite-plugin";
import babel from "@rolldown/plugin-babel";
import tailwindcss from "@tailwindcss/vite";
import { devtools } from "@tanstack/devtools-vite";
+import { redact } from "@tanstack/redact/vite";
import { tanstackRouter } from "@tanstack/router-plugin/vite";
import viteReact, { reactCompilerPreset } from "@vitejs/plugin-react";
import { defineConfig } from "vite-plus";
@@ -17,6 +19,35 @@ const appVersion = JSON.stringify(rootPackageJson.version ?? "0.0.0");
const workspaceRoot = fileURLToPath(new URL("../..", import.meta.url));
const webRoot = fileURLToPath(new URL(".", import.meta.url));
+const require = createRequire(import.meta.url);
+// The PDF/template renderer uses react-reconciler's private dispatcher; its entire React graph must stay native.
+const nativeRenderer =
+ /[\\/]packages[\\/]pdf[\\/]|[\\/]node_modules[\\/](?:react|react-reconciler|@formepdf[\\/]react)[\\/]/;
+const rendererImports = ["react", "react/jsx-runtime", "react/jsx-dev-runtime", "react/compiler-runtime", "scheduler"];
+const rendererAliases = Object.fromEntries(
+ rendererImports.map((source) => [
+ source,
+ require.resolve(
+ source === "scheduler" ? "@tanstack/redact/scheduler" : source.replace(/^react/, "@tanstack/redact"),
+ ),
+ ]),
+);
+const rendererPlugin = (): Plugin => {
+ const resolveId = (source: string, importer: string | undefined) => {
+ if (!rendererImports.includes(source)) return;
+ return importer && nativeRenderer.test(importer)
+ ? createRequire(importer).resolve(source)
+ : rendererAliases[source];
+ };
+ return {
+ name: "redact-with-native-pdf",
+ enforce: "pre",
+ resolveId,
+ config: () => ({
+ optimizeDeps: { rolldownOptions: { plugins: [{ name: "redact-with-native-pdf", resolveId }] } },
+ }),
+ };
+};
const prerenderBundleDir = `${webRoot}node_modules/.prerender`;
// Outside dist/, so the static server and the CDN never serve these pages at their own addresses.
const prerenderOutDir = `${webRoot}dist-prerender`;
@@ -132,12 +163,14 @@ const serverProxy = serverPaths.reduce(
{} as Record<string, ProxyOptions>,
);
-export default defineConfig({
+export default defineConfig(({ mode }) => ({
envDir: workspaceRoot,
resolve: {
tsconfigPaths: true,
},
+ // Externalized dependencies would import native React alongside the prerenderer's Redact dispatcher.
+ ...(mode === "redact" ? { ssr: { noExternal: true as const } } : {}),
define: {
__APP_VERSION__: appVersion,
@@ -223,9 +256,11 @@ export default defineConfig({
autoCodeSplitting: true,
}),
viteReact(),
+ // Opt-in until the browser compatibility gate passes (see .agents/docs/research/redact.md).
+ ...(mode === "redact" ? [rendererPlugin(), redact({ skip: rendererImports })] : []),
linguiPlugin(),
// Keep @babel/core on 7: under Babel 8, React Compiler 1.0 skips every function with a destructuring default
// (guarded by src/react-compiler.test.ts).
babel({ presets: [reactCompilerPreset()] }),
],
-});
+}));
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 5b41127a7..3e239f2fb 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -224,6 +224,9 @@ catalogs:
'@shadcn/react':
specifier: ^0.3.1
version: 0.3.1
+ '@tanstack/redact':
+ specifier: 0.2.0
+ version: 0.2.0
'@types/node':
specifier: ^26.6.5
version: 26.6.5
@@ -1188,6 +1191,9 @@ importers:
'@tanstack/react-router-devtools':
specifier: ^1.167.2
+ '@tanstack/redact':
+ specifier: 'catalog:'
'@tanstack/router-plugin':
specifier: ^1.168.48
@@ -2048,6 +2054,9 @@ importers:
'@phosphor-icons/react':
specifier: ^2.1.10
+ '@playwright/test':
+ specifier: ^1.64.1
+ version: 1.64.1
'@reactive-resume/config':
specifier: workspace:*
version: link:../packages/config
@@ -6171,6 +6180,23 @@ packages:
react: ^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0
react-dom: ^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0
+ '@tanstack/[email protected]':
+ resolution: {integrity: sha512-shm9huNXu9mtNqPyXeF6PJDSTm7cI4RgjB7K5k6LJzx2U5xfAPOjEA5EtE+RLSwY2nAq2OeaaIoHT6nSPEawJg==}
+ peerDependencies:
+ '@cloudflare/vite-plugin': 1.65.0
+ next: 16.3.8
+ vinext: ~1.3.0
+ vite: '>=5'
+ peerDependenciesMeta:
+ '@cloudflare/vite-plugin':
+ optional: true
+ next:
+ optional: true
+ vinext:
+ optional: true
+ vite:
+ optional: true
+
'@tanstack/[email protected]':
resolution: {integrity: sha512-qUhoJ0meuSUqGYQbHbcJYdASr06YtK+bulbj6vtrhKYFkLgkSsZ6tXmMyym7sFxiSJSPYgasgozrL01LyyR/6A==}
engines: {node: '>=20.19'}
@@ -16135,6 +16161,32 @@ snapshots:
react-dom: 19.3.1([email protected])
use-sync-external-store: 1.7.0([email protected])
+ dependencies:
+ transitivePeerDependencies:
+ - '@arethetypeswrong/core'
+ - '@types/node'
+ - '@typescript/native-preview'
+ - '@vitejs/devtools'
+ - '@volar/typescript'
+ - '@vue/language-core'
+ - esbuild
+ - jiti
+ - less
+ - publint
+ - sass
+ - sass-embedded
+ - stylus
+ - sugarss
+ - terser
+ - tsx
+ - typescript
+ - unplugin-unused
+ - unrun
+ - vue-tsc
+ - yaml
+
'@tanstack/[email protected]':
dependencies:
'@tanstack/history': 1.162.5
diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml
index 73fa24422..c735a110e 100644
--- a/pnpm-workspace.yaml
+++ b/pnpm-workspace.yaml
@@ -54,6 +54,7 @@ catalog:
expo-store-review: ~58.0.2
isbot: ^5.2.2
"@resvg/resvg-wasm": ^2.6.2
+ "@tanstack/redact": 0.2.0
allowBuilds:
esbuild: true
lefthook: true
diff --git a/tooling/package.json b/tooling/package.json
index a848cfbc9..7fdd098e7 100644
--- a/tooling/package.json
+++ b/tooling/package.json
@@ -18,6 +18,7 @@
"devDependencies": {
"@lingui/format-po": "^6.10.1",
"@phosphor-icons/react": "^2.1.10",
+ "@playwright/test": "^1.64.1",
"@reactive-resume/config": "workspace:*",
"@reactive-resume/resume": "workspace:*",
"@types/pg": "catalog:",
diff --git a/tooling/redact/benchmark.mjs b/tooling/redact/benchmark.mjs
new file mode 100644
index 000000000..4cb737569
--- /dev/null
+++ b/tooling/redact/benchmark.mjs
@@ -0,0 +1,208 @@
+import assert from "node:assert/strict";
+import { readFile, readdir, writeFile } from "node:fs/promises";
+import { createServer } from "node:http";
+import { extname, join, resolve, sep } from "node:path";
+import { gzipSync } from "node:zlib";
+import { chromium } from "@playwright/test";
+
+// Usage: node tooling/redact/benchmark.mjs <react snapshot> <redact snapshot> <results.json>
+// Each snapshot contains dist/ and dist-prerender/. Public API fixtures isolate renderer work from backend latency.
+const [reactDir, redactDir, output] = process.argv.slice(2);
+assert(reactDir && redactDir && output, "Expected two build snapshots and an output JSON path");
+const paths = ["/", "/ats-checker", "/auth/login"];
+const mime = { ".js": "text/javascript", ".css": "text/css", ".html": "text/html", ".svg": "image/svg+xml" };
+
+async function sizes(directory) {
+ const dist = join(directory, "dist");
+ const html = await readFile(join(dist, "index.html"), "utf8");
+ const entries = [...html.matchAll(/(?:src|href)="(\/assets\/[^"\s]+\.js)"/g)].map((match) => match[1]);
+ assert(entries.length > 0, "Missing browser JavaScript entries");
+ const eager = new Set();
+ async function visit(file) {
+ if (eager.has(file)) return;
+ eager.add(file);
+ const code = await readFile(join(dist, file), "utf8");
+ for (const match of code.matchAll(/(?:import|export)\s*(?:[^"';]*?\s*from\s*)?["'](\.[^"']+\.js)["']/g)) {
+ await visit(`/assets/${match[1].replace(/^\.\//, "")}`);
+ }
+ }
+ for (const entry of entries) await visit(entry);
+ const all = (await readdir(join(dist, "assets"))).filter((file) => file.endsWith(".js"));
+ const sum = async (files) => {
+ const contents = await Promise.all(files.map((file) => readFile(join(dist, file))));
+ return {
+ raw: contents.reduce((total, bytes) => total + bytes.length, 0),
+ gzip: contents.reduce((total, bytes) => total + gzipSync(bytes).length, 0),
+ files: files.length,
+ };
+ };
+ return { eager: await sum([...eager]), all: await sum(all.map((file) => `/assets/${file}`)) };
+}
+
+async function serve(directory) {
+ const dist = resolve(directory, "dist");
+ const server = createServer(async (request, response) => {
+ try {
+ const url = new URL(request.url, "http://localhost");
+ const { pathname } = url;
+ const fixture = (path) => {
+ if (path === "/api/auth/get-session") return null;
+ if (path === "/api/rpc/auth/providers/list") return { json: [] };
+ if (path === "/api/rpc/statistics/github/getStarCount") return { json: 40000 };
+ if (path === "/api/rpc/statistics/getTotals")
+ return { json: { users: 1000000, resumes: 2000000, cachedAt: null } };
+ if (path !== "/api/rpc/flags/get") throw new Error(`Unmocked API: ${path}`);
+ return {
+ json: {
+ disableSignups: false,
+ disableEmailAuth: false,
+ allowGuestLogin: false,
+ smtpEnabled: false,
+ careerSchedulingEnabled: false,
+ appUrl: `http://${request.headers.host}`,
+ customDomains: false,
+ olacvSuggestion: false,
+ },
+ };
+ };
+ if (pathname.startsWith("/api/")) {
+ const chunks = [];
+ for await (const chunk of request) chunks.push(chunk);
+ const batch = url.searchParams.get("batch") ?? Buffer.concat(chunks).toString();
+ const json = pathname.endsWith("/__batch__")
+ ? JSON.parse(batch).map((item, index) => ({
+ index,
+ status: 200,
+ body: fixture(new URL(item.url).pathname),
+ }))
+ : fixture(pathname);
+ response.writeHead(200, { "content-type": "application/json" });
+ response.end(JSON.stringify(json));
+ return;
+ }
+ const page = pathname === "/" ? "home" : pathname === "/ats-checker" ? "ats-checker" : undefined;
+ const file = page
+ ? resolve(directory, "dist-prerender", page, "en-US.html")
+ : extname(pathname)
+ ? resolve(dist, `.${pathname}`)
+ : join(dist, "index.html");
+ assert(file.startsWith(`${resolve(directory)}${sep}`), "Path outside snapshot");
+ const content = gzipSync(await readFile(file));
+ response.writeHead(200, {
+ "content-type": mime[extname(file)] ?? "application/octet-stream",
+ "content-encoding": "gzip",
+ "content-length": content.length,
+ "cache-control": "no-store",
+ });
+ response.end(content);
+ } catch (error) {
+ console.error(error);
+ response.writeHead(500);
+ response.end(String(error));
+ }
+ });
+ await new Promise((done) => server.listen(0, "127.0.0.1", done));
+ return { server, url: `http://127.0.0.1:${server.address().port}` };
+}
+
+const builds = {};
+const browser = await chromium.launch();
+const samples = [];
+try {
+ for (const [name, directory] of Object.entries({ react: reactDir, redact: redactDir })) {
+ const size = await sizes(directory);
+ builds[name] = { ...(await serve(directory)), sizes: size };
+ }
+ for (let round = -1; round < 10; round++) {
+ // Alternate renderer order; one discarded warm-up per route/runtime, then ten cold-context samples each.
+ for (const name of round % 2 === 0 ? ["react", "redact"] : ["redact", "react"]) {
+ for (const path of paths) {
+ const context = await browser.newContext({ reducedMotion: "reduce", colorScheme: "light", locale: "en-US" });
+ try {
+ const page = await context.newPage();
+ const errors = [];
+ page.on("pageerror", (error) => errors.push(error.message));
+ page.on("response", (response) => {
+ if (response.status() >= 400) errors.push(`${response.status()} ${response.url()}`);
+ });
+ await page.route("**/*", (route) =>
+ route.request().url().startsWith(builds[name].url) ? route.continue() : route.abort(),
+ );
+ await page.addInitScript(() => {
+ document.addEventListener(
+ "load",
+ (event) => {
+ if (event.target instanceof HTMLScriptElement && event.target.type === "module")
+ window.entryEvaluatedMs = performance.now();
+ },
+ true,
+ );
+ });
+ const cdp = await context.newCDPSession(page);
+ await cdp.send("Emulation.setCPUThrottlingRate", { rate: 4 });
+ await cdp.send("Performance.enable");
+ await page.goto(`${builds[name].url}${path}`, { waitUntil: "load" });
+ await page.waitForFunction(() => window.entryEvaluatedMs > 0);
+ assert.deepEqual(errors, [], `${name} ${path}: initial browser errors`);
+ if (path === "/auth/login") {
+ await page.getByLabel("Email address", { exact: true }).fill("[email protected]");
+ } else {
+ await page
+ .getByRole("button", { name: /^Switch to dark (?:theme|mode)$/ })
+ .first()
+ .click();
+ await page.waitForFunction(() => document.documentElement.classList.contains("dark"));
+ }
+ const timing = await page.evaluate(() => ({
+ entryEvaluatedMs: window.entryEvaluatedMs,
+ fcpMs: performance.getEntriesByName("first-contentful-paint")[0]?.startTime ?? null,
+ }));
+ const { metrics } = await cdp.send("Performance.getMetrics");
+ const metric = (key) => metrics.find((item) => item.name === key)?.value;
+ assert.deepEqual(errors, [], `${name} ${path}: browser errors`);
+ assert(timing.entryEvaluatedMs > 0);
+ assert(timing.fcpMs > 0, "Missing first-contentful-paint measurement");
+ assert(Number.isFinite(metric("ScriptDuration")), "Missing script-duration measurement");
+ if (round >= 0) samples.push({ name, path, round, ...timing, scriptMs: metric("ScriptDuration") * 1000 });
+ } finally {
+ await context.close();
+ }
+ }
+ }
+ console.log(`Completed round ${round + 1}/10`);
+ }
+ const median = (values) => {
+ const sorted = values.toSorted((a, b) => a - b);
+ return (sorted[4] + sorted[5]) / 2;
+ };
+ const summary = paths.map((path) => ({
+ path,
+ ...Object.fromEntries(
+ Object.keys(builds).map((name) => {
+ const subset = samples.filter((sample) => sample.name === name && sample.path === path);
+ assert.equal(subset.length, 10);
+ return [
+ name,
+ Object.fromEntries(
+ ["entryEvaluatedMs", "fcpMs", "scriptMs"].map((key) => [key, median(subset.map((sample) => sample[key]))]),
+ ),
+ ];
+ }),
+ ),
+ }));
+ const result = {
+ date: new Date().toISOString(),
+ node: process.version,
+ browser: browser.version(),
+ cpuThrottle: 4,
+ network: "Loopback, gzip, no simulated network latency; public APIs stubbed; external requests blocked",
+ sizes: Object.fromEntries(Object.entries(builds).map(([name, build]) => [name, build.sizes])),
+ summary,
+ samples,
+ };
+ await writeFile(output, `${JSON.stringify(result, null, 2)}\n`);
+ console.log(JSON.stringify({ sizes: result.sizes, summary }, null, 2));
+} finally {
+ await browser.close();
+ for (const { server } of Object.values(builds)) await new Promise((done) => server.close(done));
+}