Prior precheck only compared the JSONL payload's ids against the live doc — it didn't detect duplicates within the payload itself. A model emitting the same id twice (two roots sharing an id, a nested child reusing a root id, etc) would still slip past: addNode appends both copies, getNodeById returns the first match for both verifies, and a later rollback removeNode would delete only one of the two duplicates, leaving an orphan with the same id in the doc. Detect internal duplicates during the same id-collection pass: collectIds tracks `treeIds` as a Set and pushes any id seen twice into `internalDuplicates`. If non-empty, return `failed` immediately with the duplicate list — same shape as the existing live-doc collision branch, no doc mutation, no side effects, retry path takes over. |
||
|---|---|---|
| .. | ||
| public | ||
| server | ||
| src | ||
| CLAUDE.md | ||
| components.json | ||
| dev.ts | ||
| package.json | ||
| tsconfig.json | ||
| vite.config.ts | ||