Debugging and Troubleshooting
Debugging and Troubleshooting
How to track down problems with parsing, diffs, rendering, layout, and CI reporting.
General workflow
- Isolate it. Can you reproduce the problem with a minimal flow or fixture?
- Check the JSON. Run with
--jsonand inspect the*.diff.jsonfile. - Look at the render. Open the
.htmlartifact in a browser. - Read the source. Find the relevant module (parser, model, diff, or render).
- Add a fixture. Commit a minimal test case, so the problem stays fixed.
Parse errors
Symptom: “Failed to parse ”
The XML parser hit malformed or unsupported XML.
-
Check the XML is valid.
Terminal window xmllint before.flow-meta.xml # if xmllint is available -
Check for a known parser limit. The vendored parser comes from Google Flow Lens (Apache-2.0). It may not support every Salesforce feature yet. See
src/parser/flow_types.tsfor the supported element types. -
Check the encoding. Salesforce exports UTF-8 with a BOM. The parser uses
xml2js, which handles a BOM, but malformed UTF-8 can still fail. -
Read the error. Parser errors appear in the CLI output. To see the full stack trace, run one flow in file mode:
Terminal window npx tsx src/cli.ts --old before.xml --new after.xml --out out/ -
Consider a new element type. If Salesforce shipped a new element, it may not be in
NodeTypeyet. Add it tosrc/model/graph-model.ts, then to the parser if needed. See Extending node types.
A no-op save shows changes
Symptom: a file with only cosmetic changes (such as moved coordinates) shows as modified
This shouldn’t happen. The canonicalization rules exist to prevent it.
-
See what changed.
Terminal window npx tsx src/cli.ts --old before.xml --new after.xml --json --out out/cat out/*.diff.json | jq '.nodes[] | select(.status == "modified")' -
Identify the property. Look at the
.changesarray of each modified node.- Coordinates (
locationX,locationY) should be stripped. - Connector references should move to edges.
- Array order: check whether the array belongs in
UNORDERED_ARRAY_KEYS.
- Coordinates (
-
Check canonicalization. In
src/model/build-model.ts, look at:TOP_LEVEL_KEYS: is the property stripped?EDGE_KEYS: are connector references removed?UNORDERED_ARRAY_KEYS: is the array sorted?
-
Check the test. The
noop_savefixture is the regression test. Runnpm testand look for its assertion. If it fails, canonicalization is broken. -
Fix canonicalization. To ignore a property, add it to
TOP_LEVEL_KEYSorUNORDERED_ARRAY_KEYS. Update thenoop_savefixture, re-run the tests, and document the change in architecture.md.
Unexpected added, deleted, or modified nodes
Symptom: a node shows as added or deleted when it shouldn’t (or the reverse)
-
Check node identity. Nodes match by
name, not label. A renamed node reads as a delete plus an add. Check the nodeid:Terminal window cat out/*.diff.json | jq '.nodes[] | {id, type, status}' -
Confirm the node exists in both versions.
Terminal window grep '<name>YourNodeName</name>' before.xml after.xml- In
beforeonly: it was really deleted. - In both, but shown as deleted: the name probably changed.
- In
-
Check case and special characters. XML names are case-sensitive, so
MyNodeandmynodediffer. Compare the exact<name>in both files. -
Check git mode. Git mode finds files with
git ls-tree -ron both refs. A file renamed at the git level appears as added plus deleted. Rungit diff --name-statuson the same refs to see what changed.
Wrong or missing property deltas
Symptom: a changed property is missing, or an unchanged one shows as changed
-
Check canonicalization.
deepDiffworks onnode.propertiesafter stripping, so a stripped property can’t diff. SeeTOP_LEVEL_KEYSandEDGE_KEYSinbuild-model.ts. -
Test
deepDiffalone. If it doesn’t return the deltas you expect, the problem is insrc/diff/deep-diff.ts. Look for recursion depth limits or special cases. -
Check for an unordered array. Arrays in
UNORDERED_ARRAY_KEYSare sorted during canonicalization, so an order-only change shows nothing. To track reordering, remove the key from the list. -
Read the raw JSON.
Terminal window cat out/*.diff.json | jq '.nodes[] | select(.id == "MyNodeId")'Check
.changes[]for the property path. Paths use dots and array indexes, likerules[0].conditions[1].value. -
Check the render. The JSON can be right while the HTML hides the change. Click the modified node and check that its section schema shows the property.
HTML rendering issues
Symptom: the artifact won’t open, looks malformed, or the detail panel shows wrong data
-
Check the file exists.
Terminal window ls -lh flow-delta-out/*.htmlA non-trivial flow should be over 100 KB. The timestamp should match your CLI run.
-
Check the browser console. Open the
.html, press F12, and look at the Console for errors. All JS is inline, so network errors are unlikely. -
Check the embedded payload. The HTML embeds the client data as JSON in
<script type="application/json" id="flow-artifact-data">(FlexiPage usesflexipage-artifact-data). It’s separate from the optional neighboring*.diff.json. View the page source, find that script element, and check the JSON is valid. If it’s corrupt, the renderer has nothing to show. -
Try a fixture. Run
npm run render:fixtures, then open:flow-delta-out/fixtures/noop_save.html(should show zero changes)flow-delta-out/fixtures/modify_decision.html(should show decision rule changes)
If the fixtures render correctly, the problem is specific to your flow.
-
Check the detail panel. Click a modified node and check that its properties appear in the expected sections. If some are missing, check the schema in
render/section-schemas.ts.
Symptom: view filters (All / After / Before / Changes only) don’t work
- Check the browser. Filters are client-side JavaScript. Try a current Chrome, Firefox, or Safari.
- Check the baked layouts. The renderer precomputes
union,before, andafterlayouts. Search the HTML source for"union","before", and"after"in the embedded data. All three should be there. - Check the filtered graph.
Changes onlyhides unchanged nodes and edges. If most nodes are unchanged, that view can look sparse or disconnected. This is correct. UseAllfor the full context.
Layout issues
Symptom: nodes overlap, edges tangle, or the graph is unreadable
- Check the ELK setup. The renderer uses ELK (Eclipse Layout Kernel) for a deterministic layout. Its parameters are hardcoded in
src/render/layout.ts. Large graphs (100+ nodes) can be dense. Try zooming out. - Check the graph size. Count the nodes and edges in the
*.diff.jsonexport. The HTML’s embedded data has the same semantic identities, plus geometry and rendered detail HTML. A large flow can have 100+ nodes and 150+ edges, and ELK may overlap positions on complex graphs. This is a known limitation. - Look for disconnected parts. Unreachable nodes (orphaned decision branches, dead code) may cluster apart. Use
Changes onlyto focus. - Accept the limit. The layout is deterministic, and the browser can’t re-run it. If a layout is unusable, open an issue with the graph structure.
CI reporting issues
Symptom: flow-delta-gitlab fails, or the MR comment doesn’t appear
See ci.md for GitLab details. Key checks:
- Token. Does
$FlowDelta_GITLAB_TOKENexist and have theapiscope? Run locally with--tokento test. - diff.json files. The reporter reads
*.diff.jsonfrom the output directory. Are they present and valid? Runflow-deltafirst to create them. - API permissions. The reporter creates and updates notes on the MR. Check that the token’s project or group has API access.
- CI logs. Reporter errors go to stdout. Look for API error codes (401 auth, 404 not found, and so on).
Symptom: flow-delta-github fails, or the PR comment doesn’t appear
See ci.md for the full GitHub flow. Key checks:
- Token and permissions. The job needs
permissions: pull-requests: writefor$GITHUB_TOKEN. On a fork PR, the defaultpull_requesttoken is read-only, so commenting fails there by design. Seeci.mdfor thepull_request_targetcaveat. - PR number. The reporter makes no API calls if it can’t resolve a PR number. For example, the workflow ran on
pushinstead ofpull_request, orGITHUB_EVENT_PATHdoesn’t point at apull_requestpayload. Pass--pr <number>locally to test. - diff.json files. As with GitLab, run
flow-deltafirst. A run with zero changed diffs (including nochangedFlowAttributes) is also a no-op, by design. - Job logs. Errors go to stdout. Look for GitHub API codes (401, 403, 404). When the step is marked
continue-on-error: true, a non-2xx response fails the reporter but not the job.
Performance
Symptom: the CLI is slow or uses a lot of memory
-
Use
--changed-onlyin git mode. It limits the flow list to flows that changed, which saves parsing and diffing time:Terminal window npx tsx src/cli.ts --repo . --from main --to feature --path force-app --changed-only -
Profile the pipeline. Measure parse, diff, and render time separately. A slow flow usually has many nodes and edges.
-
Consider splitting very large flows. A flow with 500+ nodes lays out slowly. That isn’t a bug, and the output is still valid.
-
Check your Node version. Node 24 or later is required. Run
node --version.
Adding a fixture for your issue
Once you’ve isolated the problem, add a fixture so it can’t come back.
-
Save the before and after flows:
Terminal window mkdir -p fixtures/diff/my_issue/cp before.xml fixtures/diff/my_issue/before.flow-meta.xmlcp after.xml fixtures/diff/my_issue/after.flow-meta.xml -
Add a test row in
test/semantic-diff.test.ts:{name: "my_issue",expectedSummary: { addedNodes: ..., removedNodes: ..., ... },assertion: (diff) => {// Assert the specific behavior you're testing}} -
Run
npm test. -
Commit the fixture. Fixtures are part of the test suite.
Asking for help
Open an issue at https://github.com/Syntax-Syllogism/flow-delta/issues. Include:
- minimal before/after flows, or a fixture directory;
- the exact CLI command;
- expected versus actual output;
- the
diff.jsonoutput (run with--json); - your Node version (
node --version) and OS; and - any error messages.