Skip to content

Fix WRONG_DOCUMENT_ERR in every flow.* operation on a tree-read PRD - #32

Merged
jcombs-pointblue merged 1 commit into
masterfrom
claude/fix-flow-sync-definition
Oct 5, 2026
Merged

jcombs-pointblue merged 1 commit into
masterfrom
claude/fix-flow-sync-definition

Conversation

@jcombs-pointblue

Copy link
Copy Markdown
Contributor

Bug

Every flow.* operation (flow.activity.set, flow.activity.add, flow.link.*, …) failed with

ERROR: WRONG_DOCUMENT_ERR: A node is used in a different document than the one that created it.

on any PRD read from an as-code tree. FlowOps.syncDefinition copies the edited <process> into the definition by serialising and re-parsing it, which yields a node of a brand-new document, and then placed that node in the definition's document directly. A tree read from disk always trips this (process.xml is parsed separately from definition.xml, and the definition has no <process> child); the existing flow tests built their PRD in one document and never did.

Fix

Import the clone into the definition's document before placing it (importNode). One line.

Test

FlowOpsSeparateProcessTest: writes the synthetic driver set, reads it back (asserting the two documents are distinct), runs flow.activity.set --name, reads again and checks the name. Fails on master, passes here. 789 tests green.

Found while building the DirXMLDevWeb PRD editor, which stages these operations.

🤖 Generated with Claude Code

syncDefinition clones the edited process by serialising and re-parsing it,
which yields a node of a new document, then placed it in the definition's
document directly. Import it first. A tree read from disk always trips this
(process.xml is read separately from definition.xml); the existing tests
built their PRD in one document and never did.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@jcombs-pointblue
jcombs-pointblue merged commit eb898d3 into master Oct 5, 2026
4 checks passed
@jcombs-pointblue
jcombs-pointblue deleted the claude/fix-flow-sync-definition branch October 5, 2026 23:01
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