Skip to content

test: add workflow step replay helper - #1964

Merged
gerchowl merged 5 commits into
devfrom
feature/1963-workflow-step-replay
Oct 29, 2026
Merged

gerchowl merged 5 commits into
devfrom
feature/1963-workflow-step-replay

Conversation

@gerchowl

@gerchowl gerchowl commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

Description

Add a small workflow replay helper so consumer-matrix tests can execute workflow scripts with evaluated env and conditions, isolated shells, and real output/environment propagation.

Type of Change

  • feat -- New feature
  • fix -- Bug fix
  • docs -- Documentation only
  • chore -- Maintenance task
  • refactor -- Code restructuring
  • test -- Adding or updating tests
  • ci -- CI/CD pipeline changes
  • build -- Build system or dependency changes
  • revert -- Reverts a previous commit
  • style -- Code style

Modifiers

  • Breaking change (!)

Changes Made

  • Add tests.workflow_replay.Replay and a JSON CLI with explicit step selection and seeded context for external boundaries.
  • Reuse the expression evaluator for conditions and stringified env/run values; add the authorized steps and env context roots.
  • Run steps in separate bash processes, parse single-line and multiline command files, and expose outputs to later steps. Document supported behavior and refusals in the module docstring.
  • Fetch only tag 1.18.0 before devkit project tests: checkout is shallow, and the real pre-N workflow test intentionally fails if the tag is absent. This step is limited to the pytest suite; consumer workflows and S8 cells are untouched.

Diff map

  • tests/github_expression.py and its tests: accept steps and env roots with the existing case-insensitive lookup and ambiguity checks.
  • tests/workflow_replay.py, _file_values: strict UTF-8 command-file decoding, LF-only parsing, multiline values and malformed-entry errors.
  • Replay.resolve_env / validation: env precedence, literal workspace-relative working directories, and explicit refusals of unsupported step/job fields.
  • Replay.run / execution / result handling: Linux implicit vs explicit bash defaults, isolated scripts, step outputs/outcome/conclusion, replacement of seeded replayed ids, and context-derived default variables.
  • tests/test_workflow_replay.py: behavioral contracts, runner-source citations, real tag env resolution, mutations, byte-level regressions, CLI and failure cases.
  • .github/actions/test-project/action.yml: fetch only the required historical tag before project pytest runs.

Changelog Entry

No changelog needed: internal test infrastructure. The earlier entries in both root and generated devcontainer changelogs have been removed.

Testing

  • Tests pass locally (just test) — full suite delegated to CI per task instructions.
  • Manual testing performed (describe below)

Manual Testing Details

TDD tests committed before implementation. Initial helper RED exited 1. Fix-round RED (commit 956372bc) exited 1: 19 failed, 196 passed. GREEN: uv run --with pytest-xdist pytest tests/test_workflow_replay.py tests/test_github_expression.py -n 4 --basetemp=$HOME/.cache/devkit-pytest/1963-r4b-green — 215 passed, exit 0.

Tests cover both shell-default paths and workflow/job defaults; success/failure/skipped results; replacement of stale seeded outputs; Linux CR and strict UTF-8 handling; rejected job fields and invalid run types; literal/expression working directories; default runner env; and visibility of own step env in its condition. StepsRunner.cs confirms that env evaluation precedes step condition evaluation, which the helper already did correctly.

Hooks run inside nix develop. The targeted CI fetch is configuration, so no separate TDD cycle applies.

CI on 48ea8d5eeb08fe07acd4230c77dcac8236c94f67: all 16 checks passed, including Test Summary. Project Tests ran 3139 tests successfully, including every new regression case. CI run.

Checklist

  • My code follows the project's style guidelines
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have updated the documentation accordingly (module docstring)
  • I have updated CHANGELOG.md — unnecessary for internal test tooling
  • My changes generate no new warnings or errors
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published

Additional Notes

Local composite actions are explicitly refused; S8 currently extracts their run steps directly. Job scheduling and external actions remain unsupported and are refused explicitly. Seeded step context stands in only for external boundaries that are not replayed; replayed ids replace their seeds. Failures stop replay after recording outcome/conclusion in step_context. PR #1958 will adopt the helper separately.

Refs: #1963

@gerchowl
gerchowl requested a review from c-vigo as a code owner October 29, 2026 06:17
@gerchowl
gerchowl force-pushed the feature/1963-workflow-step-replay branch from 175b277 to 48ea8d5 Compare October 29, 2026 08:38
@gerchowl
gerchowl merged commit 9360c63 into dev Oct 29, 2026
16 checks passed
@gerchowl
gerchowl deleted the feature/1963-workflow-step-replay branch October 29, 2026 08:50
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