fix: harden canonical output binding projection

This commit is contained in:
lda
2026-07-23 06:30:48 +07:00 Verified
parent 92b7c6dd77
commit 7cc30b641b
6 changed files with 150 additions and 14 deletions
+8 -5
View File
@@ -371,11 +371,14 @@ For single-field `input.*` and `state.*` sources, the command projects missing
top-level `output_schema` fields from the source schema. More complex or
undeclared paths still rely on `wf draft validate` diagnostics.
By default, `set-input` replaces the complete ordered input-binding list, while
`set-output` and `set-workflow-output` replace their complete maps. Use repeated
flags in one command when you know the complete replacement. Use `--merge` only
for compatibility map edits; they cannot add literals or preserve canonical
ordering and repeated-source fan-out.
By default, `set-input` and `set-output` replace complete ordered canonical
binding lists, while `set-workflow-output` replaces its complete map. Repeated
`set-output --map LOCAL_SOURCE=STATE_TARGET` flags preserve their order and may
repeat a source to fan it out to several state targets. Use
`set-output --bindings-file` for an exported canonical list and `--clear` for an
explicit empty replacement. Use `--merge --map` only for compatibility output
map edits; that path cannot preserve canonical ordering or repeated-source
fan-out.
### Bind A Step Path
+11
View File
@@ -708,6 +708,9 @@ wf draft set-name <workspace_id> --revision <n> --name <name>
wf draft set-route <workspace_id> --revision <n> --step <step_id> --outcome ok --to <target_step_or___end__>
wf draft set-input <workspace_id> --revision <n> --step <step_id> --map input.text=text
wf draft set-output <workspace_id> --revision <n> --step <step_id> --map text=state.text
wf draft set-output <workspace_id> --revision <n> --step <step_id> --bindings-file output-bindings.json
wf draft set-output <workspace_id> --revision <n> --step <step_id> --clear
wf draft set-output <workspace_id> --revision <n> --step <step_id> --merge --map other=state.other
wf draft set-workflow-output <workspace_id> --revision <n> --map state.value=result
wf draft set-workflow-output <workspace_id> --revision <n> --merge --map state.other=other
wf draft branch <workspace_id> --revision <n> --step <step_id> --route ok=__end__ --route error=tool_error
@@ -715,6 +718,14 @@ wf draft handle <workspace_id> --revision <n> --to fail --branch lookup:error --
wf draft compile <workspace_id>
```
`set-output` replaces the step's complete ordered canonical binding list.
Repeat `--map LOCAL_SOURCE=STATE_TARGET` to preserve order and fan one local
source out to multiple state targets, or use `--bindings-file` with the exact
JSON list exported by `draft inspect --include-draft`. `--clear` is the explicit
empty replacement. The legacy `--merge --map` path is compatibility-only and
potentially lossy because a map cannot preserve ordering or repeated-source
fan-out.
Use `draft patch` when these focused commands do not cover the structural edit.
Drafts are not raw workflow plans. Drafts use `steps`, `routes`, and step field