Skip to content

fix(workflows): fan-in validate() rejects non-mapping output#3349

Merged
mnriem merged 1 commit into
github:mainfrom
jawwad-ali:fix/fan-in-validate-output-mapping
Jul 7, 2026
Merged

fix(workflows): fan-in validate() rejects non-mapping output#3349
mnriem merged 1 commit into
github:mainfrom
jawwad-ali:fix/fan-in-validate-output-mapping

Conversation

@jawwad-ali

Copy link
Copy Markdown
Contributor

Description

FanInStep.validate() only validates wait_for — it never checks output. But execute() does:

output_config = config.get("output") or {}
if not isinstance(output_config, dict):
    output_config = {}   # silent

So a non-mapping output (a YAML list or scalar) validates clean, then the author's declared aggregation keys are silently discarded at run time — the step returns COMPLETED with an empty aggregation and no diagnostic. Reproduced on main @ bba473c: validate({'id':'j','wait_for':['a'],'output':['{{ x }}']}) returns [].

Fix

Reject a non-mapping output at validation, mirroring the command-step (#3262) non-mapping input/options fix. execute()'s defensive coercion is intentionally left in place for callers that skip validation.

Testing

  • test_validate_rejects_non_mapping_output parametrized over a list, a string, and an int → all report 'output' must be a mapping. Fails before (validate returns [] — verified by source-stash), passes after.
  • test_validate_accepts_mapping_or_absent_output: a mapping and an omitted output return [].
  • Full TestFanInStep: 9 passed. uvx ruff check clean.

AI Disclosure

  • I did use AI assistance (describe below)

Found and fixed with Claude Code (Claude Fable 5) under my direction. AI flagged fan-in as the remaining step with a validate-vs-execute shape gap; I reproduced the silent key-drop, verified fail-before/pass-after, and reviewed the diff.

FanInStep.validate() only checked wait_for, so a non-mapping 'output'
(a list or scalar) validated clean; execute() then silently coerces it
to {}, so the author's declared aggregation keys vanish with COMPLETED
status and no diagnostic. Reject a non-mapping output at validation,
mirroring the command-step (github#3262) non-mapping fix. execute()'s
defensive coercion is left in place for unvalidated callers.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request closes a validation/execute contract gap in the workflow fan-in step by ensuring FanInStep.validate() rejects a non-mapping output configuration (which execute() would otherwise silently coerce to {} and drop user-declared aggregation keys).

Changes:

  • Add FanInStep.validate() check to require output be a mapping when present, with a clear type-specific error message.
  • Add unit tests covering rejection of non-mapping output values and acceptance of mapping/absent output.
Show a summary per file
File Description
src/specify_cli/workflows/steps/fan_in/__init__.py Adds validation to reject non-dict output configs, preventing silent loss of aggregation configuration.
tests/test_workflows.py Adds regression tests ensuring invalid output shapes are rejected and valid/absent output is accepted.

Review details

Tip

Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

  • Files reviewed: 2/2 changed files
  • Comments generated: 0
  • Review effort level: Low

@mnriem mnriem merged commit 220e6fc into github:main Jul 7, 2026
12 checks passed
@mnriem

mnriem commented Jul 7, 2026

Copy link
Copy Markdown
Collaborator

Thank you!

kanfil added a commit to tikalk/agentic-sdlc-spec-kit that referenced this pull request Jul 8, 2026
Upstream commits merged (9):

- 0151d23 agy honors SPECKIT_INTEGRATION_AGY_EXTRA_ARGS (github#3347)

- fb796c2 shell step validate() rejects non-string run (github#3348)

- 220e6fc fan-in validate() rejects non-mapping output (github#3349)

- 12faf7b workflow run/resume errors to stderr under --json (github#3352)

- d5ba062 bundle update uninstalls dropped components (github#3353)

- f1a8d8f release 0.12.7, begin 0.12.8.dev0 (github#3398)

- 10d4bca guard _sha256 against unreadable managed files (github#3376)

- a307894 return None on malformed GHES port (github#3379)

- 882e1e9 exit cleanly on malformed IPv6 URLs in add commands (github#3369)

Conflict: presets/_commands.py — combined IPv6 try/except + _esc()

with fork accent() theming.

Assisted-by: OpenCode (model: glm-5.2, autonomous)
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.

3 participants