mirror of
https://github.com/simstudioai/sim.git
synced 2026-10-30 19:32:46 +08:00
sanitizeForCopilot builds the workflow JSON the model reads before editing. For a loop it emits `iterations` from `block.data.count`, which is right: the loop write contract (components/blocks/loop.json) declares `iterations`, and the edit path reads `params.inputs.iterations` back into `data.count`. The parallel branch copied that line without renaming the field. But the parallel write contract (components/blocks/parallel.json) declares `count`, and the edit path reads `params.inputs.count` — so the model was shown a branch count under a name its own write contract does not define. Echoing it back drops the value silently: neither addSubflowConfig nor the update path looks for `iterations` on a parallel. Scoped to the copilot read/edit round-trip. sanitizeForExport is unaffected — it preserves state.blocks wholesale, so JSON export and folder backup/restore always carried the real data.count. The sanitizer had zero parallelType coverage, which is how this drifted. Adds three cases pinning both contracts and the collection variant; the parallel one fails against the old code.