cmux-next: page strings tables become build output

Merged
TE
19d ago
+259-78671

The React pages' strings tables are no longer committed. These are webviews/src/**/generated/strings.json, the diff page's per-locale tables and loader, and the home-channels pane table. Each checkout now generates them from its own xcstrings catalogs and settings schema. Part of #21946.

Committed copies caused two problems. Every PR that touched a catalog or the settings schema conflicted with every other one in these files. And the PR autofix could rebuild a table from a stale schema and silently drop another branch's labels: #21746 lost 14 setting labels in 21 locales that way. A table generated from the tree it sits in can't do either.

Where the tables are written

  • bun install: a postinstall runs gen-strings.mjs --best-effort. A half-translated branch, or a sparse checkout without the catalogs, doesn't fail install.
  • The webviews test preload: it rewrites only pages whose catalogs, schema or generator are newer than their tables. The write goes to a temporary file that is then renamed, because test processes run in parallel.
  • Every bundle build, and bun run build: strict, so a missing translation still fails. build-web-bundles.sh used to refuse a stale committed copy. It now generates the tables from the commit's catalogs, which the bundle source key already hashes. A build still ships only what a commit holds (cx-t3e5).
  • regenerate-web-bundles.sh removes the tables from the index when a branch from before this change merges the base. All of these outputs are routed through cmux-generated-v1 and next_batch's WEB_GENERATED, so the catch-up bot and the batch merger handle the modify/delete instead of stopping on it.
  • request-nightly-next.sh: a commit that no longer tracks the tables passes when they generate. Older commits are still checked with --check.

Measured on real open PRs

I ran git merge-tree --write-tree for each of the 235 open PRs into feat-cmux-next, against base a06abe91 and against this branch.

  • Before: 5 PRs conflict in a strings table today. 31 open PRs edit one, so each of them re-conflicts whenever the base's tables move.
  • After: a branch can no longer change these paths. webviews/test/strings-build-output.test.ts fails if any table is tracked or not ignored.
  • One-time cost: against this branch, those 31 PRs each show a single modify/delete conflict on their old table. 30 of them conflict only there. The generated catch-up bot resolves it, or scripts/cmux-next/regenerate-web-bundles.sh on the branch does.

Verification

  • Regression test. It was red on the base: "no strings table gen-strings.mjs writes is tracked" failed and listed the tables. It is green on this branch.
  • Generated output. Generated tables are byte-identical to the committed ones on the base (gen-strings.mjs --check after a fresh bun install).
  • Typecheck. bun run typecheck passes on 1553 files, with bun 1.4.2.
  • Full suite. scripts/ci/run-webviews-tests.sh passed 393 of 396 files:
    • icons/iconPack.test.ts and question/model.test.ts fail on the base too.
    • settings/editors.test.tsx timed out under full-suite load. It passes 19/19 alone, and on the base.
  • Other tests. scripts/cmux-next/tests/web-bundles-readonly-sources.test.sh passes; it now also checks that the build writes fresh, ignored tables. scripts/cmux-next/tests/request-nightly-next.test.sh, tests/test_install_git_hooks.py and tests/test_cmux_next_generated_catch_up.py pass.
  • Not run. tests/test_next_batch.py needs git 2.46 or newer, and this host has 2.43. No Swift or app build is needed, because no Swift changed.
  • Review. A subagent reviewed the change with correctness first. Its three findings are fixed in the last commit: merge rules for the diff/pane outputs, atomic writes, and a best-effort run that tolerates missing inputs.

No workflow files change.

Changelog

none

🤖 Generated with Claude Code


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need.


Summary by cubic

The React pages' strings tables (webviews/src/**/generated/) are no longer committed. Each checkout now generates them from its own xcstrings catalogs and settings schema, so PRs that touch a catalog or schema no longer collide in these files, and an autofix can't rebuild a table from a stale schema and drop another branch's labels (#21746).

Where the tables are written

  • bun install runs a best-effort postinstall so half-translated or sparse checkouts still install.
  • The webviews test preload rewrites only stale pages, through temp-file renames because tests run in parallel.
  • Every bundle build and bun run build regenerate strictly, so a missing translation fails.
  • A regression test fails whenever any table is tracked or not ignored.

Adoption

  • Branches from before this change get a single modify/delete conflict on their old table; the catch-up bot or scripts/cmux-next/regenerate-web-bundles.sh resolves it.
  • Generated tables match the previously committed ones byte-for-byte, and the webviews suite passes.