PP-259: frozen TS/TSX rewrite method and exact results
Checked October 1, 2026. Synthetic, small, local fixture; Linux x86_64 and Node 22.23.3. This is a comparison of jscodeshift 17.4.0 and Comby 1.8.1 for one narrow code edit, not a speed or security test.

Goal: change the `legacy` prop to `mode` only on `Card` JSX elements, and direct `renderLegacy(...)` calls to `renderCard(...)`. The four expected changed sites are CardView.tsx lines 4, 6 and 10, and helper.ts line 2. A string, comments, `Other` component, `renderLegacyExtra` call, text docs, vendor file and malformed TSX are near misses. The v2 ZIP contains original files, the exact expected patch, transformed files and the jscodeshift transform. Its files and expected outputs were compared byte for byte after tool runs.

SHA-256 for `src/CardView.tsx`: frozen input ae6bde52cc945f1dd400feb95a00ad8a80ccdb28ac35f7ab7abcaa007bb7744b; expected output 2299372e91a26a67f61c7563a0e9e47874e9707dcb850961ccfb347352d1468c. Both tested tools produced that expected output.
SHA-256 for `src/helper.ts`: frozen input 3e78d2800cc3da9a03e89f5c29422706e2d90b37ad3badbdd669ea81b82fd173; expected output 89da23a8f1739c77601dc6679a3f7db1766f01a81d256d4b2a86337d26a6595a. Both tested tools produced that expected output.
SHA-256 for `expected.patch`: 5e074eebb9f90d1602d7f2708d93d9ff89e090b11f269d899c959c549db930f0.

Raw exit-status summary from fresh-copy replay:
- jscodeshift `--parser=tsx --run-in-band --dry --fail-on-error` on two valid paths: exit 0; `0 errors / 0 unmodified / 0 skipped / 2 ok`; source bytes unchanged.
- jscodeshift same paths without `--dry`: exit 0; `0 errors / 0 unmodified / 0 skipped / 2 ok`; exact expected hashes above.
- jscodeshift `--dry --fail-on-error` on good plus malformed TSX: exit 1; `1 errors / 0 unmodified / 0 skipped / 1 ok`; good file unchanged.
- jscodeshift `--fail-on-error` apply on good plus malformed TSX: exit 1; `1 errors / 0 unmodified / 0 skipped / 1 ok`; good file changed before error. A separate current-file snapshot restored it; full-tree diff against snapshot then exited 0 with no differences. Ordinary apply without `--fail-on-error` had returned exit 0 despite the same partial write in the initial test.
- Comby `-in-place -match-newline-at-toplevel` JSX template: exit 0, no stdout. Call-template `-in-place`: exit 0, no stdout. Final file hashes matched expected values. Without newline matching, the multiline JSX attribute was missed.
- `patch -p1 --dry-run` and apply of `expected.patch` on a fresh fixture copy: exit 0 each. The resulting tree matched both controlled tool outputs with `diff -qr` exit 0.

Exact replay commands, run from the v2 ZIP root. First copy `fixture/` to a separate fresh working tree named `run/`:

  cp -a ./fixture ./run

Install the pinned jscodeshift 17.4.0 and Comby 1.8.1 binaries outside the source tree. Use their exact binary paths in place of `jscodeshift` and `comby` below. Do not run apply commands against the ZIP's frozen input itself.

  jscodeshift -t ./jscodeshift-transform.cjs --parser=tsx --run-in-band --dry --print --fail-on-error ./run/src/CardView.tsx ./run/src/helper.ts
  jscodeshift -t ./jscodeshift-transform.cjs --parser=tsx --run-in-band --fail-on-error ./run/src/CardView.tsx ./run/src/helper.ts

The first command must exit 0 with 0 errors before the second is considered. The malformed dry gate can be repeated on another fresh copy by replacing helper.ts in the first command with broken.tsx; expect exit 1 and no writes. Applying to a good + malformed pair is a failure probe, not a recommended migration step.

The included `replay-comby.sh` uses these literal templates and runs them in order, with `-diff` for preview or `-in-place` for apply:

  comby '<Card:[before]legacy={:[value]}:[after]/>' '<Card:[before]mode={:[value]}:[after]/>' ./run/src/CardView.tsx -diff -match-newline-at-toplevel
  comby 'renderLegacy(:[args])' 'renderCard(:[args])' ./run/src/CardView.tsx ./run/src/helper.ts -diff
  bash ./replay-comby.sh preview ./run
  bash ./replay-comby.sh apply ./run

Use a second fresh `run/` copy for Comby after the jscodeshift replay. On this Linux host, the Comby 1.8.1 release binary needed libev and libpcre runtime libraries extracted locally. We pointed `LD_LIBRARY_PATH` at their task-scoped directories and set `PP259_COMBY_BIN` to that binary path for the script; no system package was installed. Other environments may supply the libraries already. The script does not make writes atomic and requires a current-file copy before apply.

The safe jscodeshift workflow for this tested case is to copy the current exact target files to a separate location, run `--dry --fail-on-error` on those explicit paths, inspect the preview, then apply to those same paths and inspect the final diff. A Git commit alone cannot recover uncommitted edits that predated the codemod. In our malformed apply probe, copying the saved good file back restored the whole fixture exactly. This is a tested manual recovery path, not atomic tool behavior. A file can still change between preview and apply, and an interruption can still leave a partial result.

Neither tool performed symbol resolution or a real repository type check. The test does not establish every TSX shape, concurrent-edit safety, large-repository behavior, performance or security. Run the target project's build/type checks after inspecting its exact patch.

Primary documentation checked October 1, 2026:
https://github.com/facebook/jscodeshift/blob/main/README.md
https://comby.dev/docs/basic-usage
https://comby.dev/docs/advanced-usage
https://github.com/comby-tools/comby/releases/tag/1.8.1
