Skip to content

fix(init): remove JSON minification that breaks edit-based codemods#719

Merged
betegon merged 1 commit intomainfrom
fix/remove-json-minification
Apr 13, 2026
Merged

fix(init): remove JSON minification that breaks edit-based codemods#719
betegon merged 1 commit intomainfrom
fix/remove-json-minification

Conversation

@betegon
Copy link
Copy Markdown
Member

@betegon betegon commented Apr 13, 2026

Summary

Removes JSON minification (JSON.stringify(JSON.parse())) from readSingleFile and preReadCommonFiles. This was causing all package.json edit-based codemods to fail.

Root cause

The server's codemod-planner agent saw minified JSON (all whitespace stripped) and generated oldString/newString edits based on it. But applyEdits reads the actual file from disk (pretty-printed with indentation). The fuzzy replacer chain can't bridge minified vs pretty-printed JSON — it's structurally too different.

Evidence

All three reference projects (opencode, gemini-cli, cline) read files raw without any content transformation. The model always sees exactly what's on disk. Our minification was an outlier that broke when we switched from full-content replacement to edit-based codemods.

Fixes failures on node-express and remix test projects:

Applying changes failed after 4 attempts: Edit #1 failed on "package.json":
Could not find oldString in the file.

Test plan

  • All 68 local-ops tests pass
  • Typecheck clean
  • Lint clean

Made with Cursor

readSingleFile and preReadCommonFiles minified JSON files before
sending them to the server. The server's codemod-planner saw minified
content and generated edits based on it, but applyEdits reads the
actual file from disk (pretty-printed). The oldString from minified
JSON never matched the pretty-printed file, causing all package.json
edits to fail.

All reference projects (opencode, gemini-cli, cline) read files raw
without transformation — the model sees exactly what's on disk.

Made-with: Cursor
@github-actions
Copy link
Copy Markdown
Contributor

Semver Impact of This PR

🟢 Patch (bug fixes)

📋 Changelog Preview

This is how your changes will appear in the changelog.
Entries from this PR are highlighted with a left border (blockquote style).


Bug Fixes 🐛

  • (init) Remove JSON minification that breaks edit-based codemods by betegon in #719

Internal Changes 🔧

  • Regenerate skill files by github-actions[bot] in ca16b2ff

🤖 This preview updates automatically when you update the PR.

@github-actions
Copy link
Copy Markdown
Contributor

PR Preview Action v1.8.1

QR code for preview link

🚀 View preview at
https://cli.sentry.dev/_preview/pr-719/

Built to branch gh-pages at 2026-04-13 08:19 UTC.
Preview will be ready when the GitHub Pages deployment is complete.

@betegon betegon marked this pull request as ready for review April 13, 2026 08:20
@betegon betegon enabled auto-merge (squash) April 13, 2026 08:20
@github-actions
Copy link
Copy Markdown
Contributor

Codecov Results 📊

134 passed | Total: 134 | Pass Rate: 100% | Execution Time: 0ms

📊 Comparison with Base Branch

Metric Change
Total Tests
Passed Tests
Failed Tests
Skipped Tests

✨ No test changes detected

All tests are passing successfully.

✅ Patch coverage is 100.00%. Project has 1592 uncovered lines.
❌ Project coverage is 95.31%. Comparing base (base) to head (head).

Coverage diff
@@            Coverage Diff             @@
##          main       #PR       +/-##
==========================================
- Coverage    95.32%    95.31%    -0.01%
==========================================
  Files          232       232         —
  Lines        33951     33949        -2
  Branches         0         0         —
==========================================
+ Hits         32361     32357        -4
- Misses        1590      1592        +2
- Partials         0         0         —

Generated by Codecov Action

@betegon betegon merged commit 4bcaab9 into main Apr 13, 2026
24 checks passed
@betegon betegon deleted the fix/remove-json-minification branch April 13, 2026 08:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant