Skip to content

fix(core): keep numeric sanitize diagnostics fail-safe - #615

Open
anton-pascal wants to merge 1 commit into
mainfrom
fix/sentry-MONOREPO-EDITOR-MK
Open

fix(core): keep numeric sanitize diagnostics fail-safe#615
anton-pascal wants to merge 1 commit into
mainfrom
fix/sentry-MONOREPO-EDITOR-MK

Conversation

@anton-pascal

@anton-pascal anton-pascal commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

Sentry issues

  • MONOREPO-EDITOR-MKTypeError: Cannot read properties of undefined (reading 'join')
  • MONOREPO-EDITOR-MJ — related same-second downstream render failure; this change addresses the shared invalid-update path but does not claim a separate MJ fix.

Root cause

An invalid numeric node update correctly entered the sanitizer, but its warning formatter assumed every runtime NumericSanitizeIssue.path was an array and called .join() unconditionally. That made the error reporter throw inside updateNodesAction, masking the original schema-validation failure and aborting the remaining update batch. NumericSanitizeIssue.path is statically required, and all current sanitizeNumericValue call paths start from [] and extend with array spreads, so no reproducible in-source producer of an undefined path was found; the Sentry payload demonstrates the runtime invariant was nevertheless violated.

What changed

  • make numeric issue formatting tolerate null/undefined issue lists and missing/non-array paths, with a final non-throwing fallback
  • isolate both message construction and the warning sink so diagnostics can never interrupt node mutation
  • add regressions for missing paths and for a batched updateNodes call continuing after schema-invalid numeric data even when warning output throws

Verification

  • bun test packages/core/src/store/actions/node-mutation-sanitize.test.ts — PASS: 11 passed, 0 failed
  • bun biome lint packages/core/src/store/actions/node-actions.ts packages/core/src/store/actions/node-mutation-sanitize.test.ts — PASS: checked 2 files, no fixes applied
  • git diff --check — PASS

This is unverified against production traffic and needs review before merge.


Note

Low Risk
Localized to diagnostic logging around existing sanitization; behavior change is fail-safe continuation of mutations with added defensive formatting.

Overview
Hardens numeric sanitization warning formatting so bad diagnostic data cannot abort node create/update batches (fixes Sentry path.join on undefined).

numericSanitizeIssuesToMessage is exported and now accepts null/undefined issue lists, treats missing or non-array path as <unknown>, and falls back to <diagnostic unavailable> instead of throwing.

warnSanitizedNodeMutation wraps both message building and console.warn in try/catch so a broken formatter or logging sink never interrupts mutations.

Adds tests for defensive issue formatting and for updateNodes applying later updates when console.warn throws after an invalid numeric patch.

Reviewed by Cursor Bugbot for commit def7b31. Bugbot is set up for automated code reviews on this repo. Configure here.

@anton-pascal

Copy link
Copy Markdown
Contributor Author

Status note: this is still based on 27adf9a0, which is now 10 commits behind main (34fbae74). The bug this fixes is still present on mainnumericSanitizeIssuesToMessage still calls issue.path.map(String).join('.') with no array guard, so a malformed NumericSanitizeIssue still throws inside the error reporter and aborts updateNodesAction (MONOREPO-EDITOR-MK). GitHub reports this branch mergeable: true / clean, so it can still land, but the downstream app-side bump (pascalorg/private-editor#317) has gone stale: private-editor's submodule pointer moved to f90c7414, which is 7 commits ahead of this branch's head, so that bump would now roll the submodule backwards. I've converted #317 to draft. Cleanest path is to rebase this onto current main, land it, then re-point the submodule forward. Not rebasing unprompted — @Aymericr's call.

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