Skip to content

Conversation

@yehorkardash
Copy link
Contributor

Summary

This PR introduces a new jsonrepair dependency that replaces unstable regex based repair logic

Related Linear tickets, Github issues, and Community forum posts

https://linear.app/n8n/issue/NODE-1773/community-issue-json-is-being-modified-incorrectly-invalidated-in-edit

closes #10972

Review / Merge checklist

  • PR title and summary are descriptive. (conventions)
  • Docs updated or follow-up ticket created.
  • Tests included.
  • PR Labeled with release/backport (if the PR is an urgent fix that needs to be backported)

@bundlemon
Copy link

bundlemon bot commented Nov 20, 2025

BundleMon

Unchanged files (2)
Status Path Size Limits
WASM Dependencies
tree-sitter-bash.wasm
181.26KB -
WASM Dependencies
tree-sitter.wasm
74.47KB -

No change in files bundle size

Groups updated (2)
Status Path Size Limits
**/*.js
11.38MB (+91.49KB +0.79%) -
**/*.css
231.46KB (+10.68KB +4.84%) -

Final result: ✅

View report in BundleMon website ➡️


Current branch size history | Target branch size history

Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

3 issues found across 8 files

Prompt for AI agents (all 3 issues)

Understand the root cause of the following 3 issues and fix them.


<file name="packages/workflow/test/utils.test.ts">

<violation number="1" location="packages/workflow/test/utils.test.ts:194">
The apostrophe contraction test asserts `{ key: &#39;it&quot;s a test&#39; }`, forcing the parser to corrupt the original string instead of preserving `it&#39;s a test`; the expectation should keep the apostrophe so JSON repair fixes syntax without altering data.</violation>
</file>

<file name="packages/workflow/package.json">

<violation number="1" location="packages/workflow/package.json:51">
jsonrepair is declared as a devDependency even though src/utils.ts imports it at runtime, so downstream consumers of n8n-workflow will miss this module and `import { jsonrepair } from &#39;jsonrepair&#39;` will throw. Declare jsonrepair under dependencies instead of devDependencies.</violation>
</file>

<file name="packages/workflow/src/utils.ts">

<violation number="1" location="packages/workflow/src/utils.ts:144">
Rule violated: **Prefer Typeguards over Type casting**

Avoid asserting the repaired JSON result to `T`. There is no runtime verification that the repaired string matches the caller-specified type, so this cast hides type errors; let TypeScript accept the `any` result or introduce a guard before narrowing.</violation>
</file>

Reply to cubic to teach it or ask questions. Re-run a review with @cubic-dev-ai review this PR

@n8n-assistant n8n-assistant bot added core Enhancement outside /nodes-base and /editor-ui n8n team Authored by the n8n team node/improvement New feature or request labels Nov 20, 2025
@codecov
Copy link

codecov bot commented Nov 20, 2025

Codecov Report

❌ Patch coverage is 66.66667% with 4 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
...des-langchain/nodes/tools/ToolHttpRequest/utils.ts 0.00% 2 Missing ⚠️
packages/workflow/src/utils.ts 75.00% 2 Missing ⚠️

📢 Thoughts on this report? Let us know!

@blacksmith-sh

This comment has been minimized.

Copy link
Contributor

@RomanDavydchuk RomanDavydchuk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works like a charm

Left one comment. In general, we try to be careful with adding new dependencies to the project, and avoid it, if it's possible. IMO this package is the best solution for this issue, so it's probably ok to add it, but did you discuss this with anyone else?

@yehorkardash
Copy link
Contributor Author

yehorkardash commented Nov 24, 2025

but did you discuss this with anyone else

Mentioned that on the daily, didn't hear objections

@currents-bot
Copy link

currents-bot bot commented Nov 24, 2025

E2E Tests: n8n tests passed after 9m 13.7s

🟢 588 · 🔴 0 · ⚪️ 12 · 🟣 1

View Run Details

Run Details

  • Project: n8n

  • Groups: 2

  • Framework: Playwright

  • Run Status: Passed

  • Commit: 21faede

  • Spec files: 96

  • Overall tests: 600

  • Duration: 9m 13.7s

  • Parallelization: 9

Groups

GroupId Results Spec Files Progress
ui 🟢 539 · 🔴 0 · ⚪️ 12 · 🟣 1 90 / 90
ui:isolated 🟢 49 · 🔴 0 · ⚪️ 0 6 / 6


This message was posted automatically by currents.dev | Integration Settings

Copy link
Contributor

@RomanDavydchuk RomanDavydchuk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@RomanDavydchuk RomanDavydchuk merged commit 60a9cbf into master Nov 24, 2025
36 checks passed
@RomanDavydchuk RomanDavydchuk deleted the node-1773-community-issue-json-is-being-modified-incorrectly branch November 24, 2025 12:02
@github-actions github-actions bot mentioned this pull request Nov 24, 2025
@n8n-assistant
Copy link

n8n-assistant bot commented Nov 25, 2025

Got released with [email protected]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core Enhancement outside /nodes-base and /editor-ui n8n team Authored by the n8n team node/improvement New feature or request Released

Projects

None yet

Development

Successfully merging this pull request may close these issues.

JSON is being modified incorrectly / invalidated in Edit Fields Node

3 participants