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!

build(web): remove the opt-in TanStack Redact build mode

Amruth Pillai4c0f68c78406
diff --git a/.agents/docs/research/redact.md b/.agents/docs/research/redact.md
index 04f7795c0..21685b921 100644
--- a/.agents/docs/research/redact.md
+++ b/.agents/docs/research/redact.md
@@ -5,17 +5,18 @@ Redact 0.2.0, Vite+ 1.3.0, Node 24.22.1, Chromium 156.0.8078.4. Dependency is pi
## 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.
+**Removed on October 27, 2026; native React is the only runtime.** The gain (13.5% less eager JavaScript, about 6–7%
+faster entry evaluation, small first-paint differences) is not worth carrying a second runtime: an existing
+keyboard-focus browser test fails with Redact, Redact 0.2.1 still doesn't focus `autoFocus` controls on mount, and
+the interaction risks below are unmeasured. The rest of this page records the evaluation as it ran.
-```sh
-pnpm --filter web build --mode redact
-pnpm --filter web dev --mode redact
-```
+The opt-in build mode (`pnpm --filter web build --mode redact`), its resolver test (`apps/web/src/redact.test.ts`) and
+the benchmark script (`tooling/redact/benchmark.mjs`) live in commit `a23bbd068`. Restore them from there to
+re-evaluate, after upstream fixes mount-time focus.
-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.
+In that mode, no application React imports, shared package APIs, mobile runtime, or backend runtime changed. React
+Compiler stayed enabled. Redact's default `full` preset was retained; no optional compatibility features were removed
+to improve results.
## Integration boundaries
@@ -115,6 +116,7 @@ PDF fallback/preview, assistant streaming, drag-and-drop, and Safari/Firefox beh
## Reproduce the benchmark
+Check out commit `a23bbd068` (or restore its files) first; the build mode and script were removed afterwards.
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.
diff --git a/.agents/docs/research/web-performance.md b/.agents/docs/research/web-performance.md
index 776b41f96..39823a1f7 100644
--- a/.agents/docs/research/web-performance.md
+++ b/.agents/docs/research/web-performance.md
@@ -20,7 +20,8 @@ and the request structure more than the absolute milliseconds.
deterministic theme/locale hydration and a CSP for streamed inline scripts. The visible startup delay comes from the
root context waterfall and preview bytes, which Start does not remove. Revisit only if a measured pilot on the
optimized baseline wins (see "Decision rule").
-- **Redact: keep it opt-in.** The autofocus failure is a runtime gap: React DOM calls `.focus()` at commit for a newly
+- **Redact: not worth it now; the opt-in build mode was removed** (evaluation in [redact.md](./redact.md)). The
+ autofocus failure is a runtime gap: React DOM calls `.focus()` at commit for a newly
mounted control with `autoFocus`; Redact only sets the `autofocus` attribute. Redact 0.2.1 (published October 27)
still has it. Its feature flags can cut a further ~5 KB gzip, but two open upstream issues match this app's stack
(Base UI submenus closing before a link click; large rerenders reported ~2× slower). Startup bytes are not
@@ -127,7 +128,8 @@ and the request structure more than the absolute milliseconds.
those pages cut first paint from ~1.7 s to ~0.4–0.6 s locally, but the re-render pushed LCP to 5–7.6 s; hydration
(Router SSR utilities, or a Start pilot limited to marketing) has to come first.
- Common-character CJK subsets for the PDF engine (978 KB vs 8.6 MB per weight).
-- Redact by default, only after the gate in [redact.md](./redact.md) passes on 0.2.1 or later with the autofocus fix.
+- Redact, only after upstream focuses `autoFocus` controls on mount: restore the build mode from commit `a23bbd068`
+ and pass the gate in [redact.md](./redact.md).
### Considered, not worth it
diff --git a/apps/web/package.json b/apps/web/package.json
index 96d759685..57b3e201f 100644
--- a/apps/web/package.json
+++ b/apps/web/package.json
@@ -102,7 +102,6 @@
"@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
deleted file mode 100644
index 671f44310..000000000
--- a/apps/web/src/redact.test.ts
+++ /dev/null
@@ -1,43 +0,0 @@
-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 043c88396..168278266 100644
--- a/apps/web/vite.config.ts
+++ b/apps/web/vite.config.ts
@@ -1,13 +1,11 @@
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";
@@ -19,35 +17,6 @@ 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`;
@@ -163,14 +132,12 @@ const serverProxy = serverPaths.reduce(
{} as Record<string, ProxyOptions>,
);
-export default defineConfig(({ mode }) => ({
+export default defineConfig({
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,
@@ -256,11 +223,9 @@ export default defineConfig(({ mode }) => ({
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 3e239f2fb..5b41127a7 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -224,9 +224,6 @@ 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
@@ -1191,9 +1188,6 @@ importers:
'@tanstack/react-router-devtools':
specifier: ^1.167.2
- '@tanstack/redact':
- specifier: 'catalog:'
'@tanstack/router-plugin':
specifier: ^1.168.48
@@ -2054,9 +2048,6 @@ 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
@@ -6180,23 +6171,6 @@ 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'}
@@ -16161,32 +16135,6 @@ 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 c735a110e..73fa24422 100644
--- a/pnpm-workspace.yaml
+++ b/pnpm-workspace.yaml
@@ -54,7 +54,6 @@ 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 7fdd098e7..a848cfbc9 100644
--- a/tooling/package.json
+++ b/tooling/package.json
@@ -18,7 +18,6 @@
"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
deleted file mode 100644
index 4cb737569..000000000
--- a/tooling/redact/benchmark.mjs
+++ /dev/null
@@ -1,208 +0,0 @@
-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));
-}