Skip to content

fix: meaningful error for malformed XML in InFile processing#1212

Merged
scolladon merged 5 commits intomainfrom
fix/meaningful-error-malformed-xml
Feb 15, 2026
Merged

fix: meaningful error for malformed XML in InFile processing#1212
scolladon merged 5 commits intomainfrom
fix/meaningful-error-malformed-xml

Conversation

@scolladon
Copy link
Copy Markdown
Owner

@scolladon scolladon commented Feb 15, 2026

Summary

  • Wraps InFileHandler._collectCompareResult() in a try/catch so that malformed XML files produce a clear warning with the file path and revision references, instead of the opaque Cannot read properties of undefined (reading 'addChild') error from fast-xml-parser
  • Remaining files continue processing normally — the error no longer halts the entire diff
  • Uses MessageService for the warning message, following project conventions
  • Restores README blob links to main branch after postpack
  • Consolidates checkSdrMetadataCoverage and syncInternalRegistry tooling scripts into a single syncInternalRegistryWithSdr script, removing the intermediate JSON file step and updating CI workflow + npm scripts accordingly

Closes #1203

Test plan

  • Unit test verifying that when metadataDiff.compare throws, collect() returns a warning with file path and both revision references
  • All existing tests pass (npm run test:unit)
  • 100% coverage on src/service/inFileHandler.ts
  • CI pre-push hooks pass (lint, build, test, knip)

Wrap _collectCompareResult() in try/catch to produce a clear warning
message including the file path and revision references when XML
parsing fails, instead of letting the opaque fast-xml-parser error
propagate.

Closes #1203
Verify that when metadataDiff.compare throws, collect() returns a
warning with the file path and both revision references instead of
propagating the error.
@codecov
Copy link
Copy Markdown

codecov bot commented Feb 15, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (8244258) to head (231a7d5).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##              main     #1212   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           57        57           
  Lines         1535      1543    +8     
  Branches       201       201           
=========================================
+ Hits          1535      1543    +8     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Replace hard-coded error string with a message key from delta.md,
consistent with the pattern used by FlowHandler and ConfigValidator.
Consolidate checkSdrMetadataCoverage and syncInternalRegistry into
syncInternalRegistryWithSdr, removing the intermediate JSON file step.
@github-actions
Copy link
Copy Markdown

Published under dev-1212 npm channel.

$ sf plugins install sf-git-merge-driver@dev-1212

@scolladon scolladon merged commit 2d5aa20 into main Feb 15, 2026
22 of 24 checks passed
@scolladon scolladon deleted the fix/meaningful-error-malformed-xml branch February 15, 2026 16:24
@github-actions
Copy link
Copy Markdown

Shipped in release v6.32.0.
Version v6.32.0 will be assigned to the latest npm channel soon
Install it using either v6.32.0 or the latest-rc npm channel

$ sf plugins install sfdx-git-delta@latest-rc
# Or
$ sf plugins install sfdx-git-delta@v6.32.0

💡 Enjoying sfdx-git-delta?
Your contribution helps us provide fast support 🚀 and high quality features 🔥
Become a sponsor 💙
Happy incremental deployment!

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.

Throw an exception instead of Warning: Cannot read properties of undefined (reading 'addChild')

1 participant