Skip to content

fix(workflow): fail when run outputs are missing#187

Open
liamnwhite1 wants to merge 7 commits into
refactor/125-workflow-context-stage-handofffrom
fix/139-fix-pytest-examples
Open

fix(workflow): fail when run outputs are missing#187
liamnwhite1 wants to merge 7 commits into
refactor/125-workflow-context-stage-handofffrom
fix/139-fix-pytest-examples

Conversation

@liamnwhite1

Copy link
Copy Markdown
Collaborator

Summary

Make workflow runs fail when an executed step does not produce all expected valid outputs.

Related issues

Details

This fixes a bug where example tests could pass even when a workflow case failed to complete. Component.run_component() previously printed a warning if an execute stage finished but the expected output files were missing or invalid. Because no exception was raised, pytest and CI could still report success.

The fix changes that post-run validation path to raise a RuntimeError after listing the expected output files. A regression test covers an execute stage that returns successfully but leaves its declared output missing.

Impact

Risk level: Low.

This changes failure behavior for workflows with declared output requirements: missing or invalid outputs after execution now fail loudly instead of logging a warning. That should make example tests and CI catch incomplete runs reliably.

Testing strategy

Environment:

  • Local repo .venv
  • Python 3.12.10
  • pytest 9.0.2

Commands run:

  • .venv/bin/python -m pytest tests/test_workflow_context.py
  • .venv/bin/python -m pytest tests/test_workflow_context.py tests/test_component_output_paths.py
  • .venv/bin/python -m pytest
  • git diff --check

Note: uv was not available in this shell, so testing used the repo .venv. External example CI jobs were not run locally because they require the external application/container environment.

Checklist

  • Architecture/docs impact considered. Updated ARCHITECTURE.md, developer docs,
    and/or ADRs where needed.

Remove the workflow-step communication that previously relied on mutable
MYNA_* environment variables between Myna workflow stages.

Changes:
- add explicit `WorkflowContext` support for input file, current step,
  previous step, step class, and step index
- update `MynaApp` to consume explicit workflow context first while preserving
  legacy environment-variable fallback for direct script invocation
- run component configure/execute/postprocess stages in-process instead of
  launching Python wrapper subprocesses
- preserve stage CLI argument behavior by temporarily patching `sys.argv`
  during in-process stage calls
- update `myna run` and `myna sync` to pass workflow state directly to
  components instead of mutating `MYNA_*` variables
- replace affected app/database direct env reads with context-backed accessors
  or app instance attributes
- add regression tests for context propagation, stage argument forwarding, and
  absence of workflow env mutation

Closes #125

Verification:
- `uv run pytest`
- 55 passed, 1 skipped, 11 deselected
Add guardrails so future workflow, component, app, and database architecture changes
are less likely to land without corresponding documentation updates.

Changes:
- add an architecture-impact item to the agent handoff checklist
- add a PR template checkbox requiring architecture/docs impact consideration
- extend `scripts/check_docs_harness.py` to detect architecture-sensitive changed files
  and require updates to architecture/developer/decision docs
- update architecture and documentation guidance to describe the expanded harness check

Validation:
- `python3 scripts/check_docs_harness.py`
- `uv run python scripts/check_docs_harness.py`
- `python3 -m py_compile scripts/check_docs_harness.py`
- `git diff --check`
Update agent PR guidance to require inspecting and completing the repository pull
request template when drafting or opening PRs.

Changes:
- clarify AGENTS.md PR guidance to preserve template headings and checklist
- add docs harness checks for required PR template headings and agent guidance
- document the expanded harness validation in docs/documentation.md

Validation:
- python3 scripts/check_docs_harness.py
- python3 -m py_compile scripts/check_docs_harness.py
- git diff --check
@liamnwhite1 liamnwhite1 force-pushed the refactor/125-workflow-context-stage-handoff branch from 46e8c4b to 2696c7f Compare June 2, 2026 11:32
@liamnwhite1 liamnwhite1 force-pushed the fix/139-fix-pytest-examples branch from 46c7077 to a17d3be Compare June 2, 2026 11:33
@liamnwhite1 liamnwhite1 marked this pull request as ready for review June 2, 2026 11:34
@gknapp1 gknapp1 force-pushed the refactor/125-workflow-context-stage-handoff branch from 2696c7f to e163152 Compare July 1, 2026 14:51
@gknapp1 gknapp1 requested a review from colemanjs as a code owner July 1, 2026 14:51
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.

1 participant