Skip to content

Commit 3e303fb

Browse files
doquanghuyclaude
andcommitted
fix: use result.output in run-helper assert; document step_data shape
Address Copilot review: - `_run_json` asserted with `result.stdout` in the message, but under `--json` step output is redirected off stdout — the useful diagnostics live on `result.output`. Switch the assertion message to `result.output` (the JSON parse still reads stdout), matching the other CLI tests. - `StepContext.steps` documented a 5-key entry shape; the engine now also persists `type` and `status`. Update the docstring to the canonical 7-key shape so step authors/debuggers see the real record. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 5f60408 commit 3e303fb

2 files changed

Lines changed: 8 additions & 5 deletions

File tree

src/specify_cli/workflows/base.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,10 @@ class StepContext:
4747
#: Resolved workflow inputs (from user prompts / defaults).
4848
inputs: dict[str, Any] = field(default_factory=dict)
4949

50-
#: Accumulated step results keyed by step ID.
51-
#: Each entry is ``{"integration": ..., "model": ..., "options": ...,
52-
#: "input": ..., "output": ...}``.
50+
#: Accumulated step results keyed by step ID. Each entry is the dict the
51+
#: engine persists per step:
52+
#: ``{"type": ..., "integration": ..., "model": ..., "options": ...,
53+
#: "input": ..., "output": ..., "status": ...}``.
5354
steps: dict[str, dict[str, Any]] = field(default_factory=dict)
5455

5556
#: Current fan-out item (set only inside fan-out iterations).

tests/test_workflows.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3984,8 +3984,10 @@ def _run_json(self, tmp_path, monkeypatch, content):
39843984
monkeypatch.chdir(tmp_path)
39853985
result = CliRunner().invoke(app, ["workflow", "run", str(path), "--json"])
39863986
# Assert the CLI succeeded before parsing so a real failure surfaces
3987-
# the actual output instead of an opaque JSON decode error.
3988-
assert result.exit_code == 0, result.stdout
3987+
# the actual output instead of an opaque JSON decode error. Use
3988+
# ``result.output`` for the message: under ``--json`` step output is
3989+
# redirected off stdout, so the useful diagnostics live there.
3990+
assert result.exit_code == 0, result.output
39893991
return _json.loads(result.stdout)
39903992

39913993
def test_gate_pause_carries_gate_block(self, tmp_path, monkeypatch):

0 commit comments

Comments
 (0)