Skip to content

feat(roadmap): stage requires workflow contract tests for workflow changes #4083

Closed

Description

@dan-petty

Problem or Motivation

The stage planning job permits a task group to change a workflow file under .github/workflows/ without requiring a workflow contract test in tests/invariants/test_workflow_contracts.py.

In issue #2163 (pull request #4031), the stage planner placed the .github/workflows/ci.yml edit in Group 2 with the verification command uv run devops ci --check --only actionlint,zizmor, and deferred the contract test to Group 3.
This design has two defects:

  1. It breaks the test-first rule of AGENTS.md (Rule 4: "Test new behavior first"): Group 2 modified behavior without an executable test proving the change.
  2. The verification command uv run devops ci --check --only actionlint,zizmor is vacuous for validating the added step because it passes on the base before the change and only verifies syntax, not step configuration or existence.

Proposed Solution & Architectural Design

  1. Extend path_problems in src/devops_cli/roadmap/stage/stage_paths.py:
    • When a task group lists a workflow file (.github/workflows/*.yml) in changes, require that the same group (or change) lists tests/invariants/test_workflow_contracts.py in changes.
  2. Update the stage planner prompt (src/devops_cli/ai/tasks/roadmap_stage_change.md) to instruct the model that workflow changes require an invariant contract test in the same group.
  3. This prevents vacuous verification commands on workflow modifications and ensures test-driven implementation for CI automation.

Target Subsystem

AI & Agentic Review Pipeline

Existing Tool Considered

path_problems in src/devops_cli/roadmap/stage/stage_paths.py. The change extends existing path validation rules: approximately 8,000 tokens to build and test.

Standards Compliance

  • I confirm this proposal aligns with AGENTS.md engineering principles (cyclomatic complexity <= 10, nesting <= 5, zero bare exceptions, tests that cover the changed lines).
  • I am willing to submit a pull request implementing this feature with accompanying tests.

Source: #4031

Proposed design

Problem statement

The stage planner lets a task group change a workflow under .github/workflows/ without a workflow contract test. The group can then pass actionlint and zizmor while it adds no executable test for the change. The change adds a path rule and a prompt instruction that require the contract test in the same group.

Acceptance criteria

Requirement: Workflow change requires contract test

The stage path check SHALL report a problem when a task group changes a workflow file and does not list the workflow contract test in the same group.

Scenario: Workflow change without contract test

  • WHEN A task group lists .github/workflows/ci.yml in changes and does not list tests/invariants/test_workflow_contracts.py in changes.
  • THEN path_problems returns a problem that names .github/workflows/ci.yml and tests/invariants/test_workflow_contracts.py.

Requirement: Workflow change with contract test passes

The stage path check MUST accept a task group that changes a workflow file and lists the workflow contract test in the same group.

Scenario: Workflow change with contract test

  • WHEN A task group lists .github/workflows/ci.yml and tests/invariants/test_workflow_contracts.py in changes.
  • THEN path_problems returns no problem for the workflow contract rule.

Requirement: No workflow change needs no contract test

The stage path check MUST not require the workflow contract test from a task group that changes no workflow file.

Scenario: Source change only

  • WHEN A task group reads .github/workflows/ci.yml and changes only src/devops_cli/roadmap/stage/stage_paths.py.
  • THEN path_problems returns no problem for the workflow contract rule.

Requirement: Every workflow file is covered

The stage path check SHALL apply the contract-test rule to every file under .github/workflows/ with the suffix .yml.

Scenario: Each workflow file

  • WHEN A task group lists any .github/workflows/*.yml file in changes and omits tests/invariants/test_workflow_contracts.py.
  • THEN path_problems returns a problem for that workflow file.

Requirement: Prompt states the rule

The stage planner prompt SHALL instruct the model to list the workflow contract test in the same group as a workflow change.

Scenario: Prompt instruction

  • WHEN The stage planner prompt src/devops_cli/ai/tasks/roadmap_stage_change.md is read.
  • THEN It holds an instruction that a group changing a file under .github/workflows/ also lists tests/invariants/test_workflow_contracts.py in changes.

Existing Tool Considered

No alternatives check has run. The need is a repository-specific path rule, and no open, maintained tool covers it. The change extends the existing path_problems in src/devops_cli/roadmap/stage/stage_paths.py, which lacks the workflow contract-test rule; build, keep and fix cost is about 8,000 tokens and about 2 hours.

Key questions

  • Which group must list the workflow contract test when it changes a workflow file?: The same group that changes the workflow file must list tests/invariants/test_workflow_contracts.py in changes. (best practice) [sources: AGENTS.md, tests/invariants/test_workflow_contracts.py]
    • Chosen: Same group. AGENTS.md Rule 4 requires a test with the behavior change, and the group's verification command can run that test.
    • Rejected: Any later group. A later group leaves the workflow change with no executable test in the group that makes it.
    • Rejected: No contract test requirement. The current rule permits actionlint and zizmor to pass without a test of the added step.
  • Which workflow paths must trigger the new rule?: Every .github/workflows/*.yml path in a group's changes list must trigger the rule. (best practice) [sources: .github/workflows/ci.yml, tests/invariants/test_workflow_contracts.py]
    • Chosen: Every .yml workflow under .github/workflows/. The issue names *.yml, and every workflow file in this repository has that suffix.
    • Rejected: Only ci.yml. The defect applies to every workflow file, not only ci.yml.
    • Rejected: Every file under .github/workflows/, including .yaml. The issue and the repository use .yml; broadening the rule adds no covered file.
  • Where does the new rule live?: The new rule lives in path_problems in src/devops_cli/roadmap/stage/stage_paths.py, beside the existing path checks. (best practice) [sources: src/devops_cli/roadmap/stage/stage_paths.py, src/devops_cli/roadmap/stage/stage_change.py]
    • Chosen: Extend path_problems. The function already receives every group and the staged tree, and the stage job calls it.
    • Rejected: Add a separate check in stage_change.py. It repeats the group loop and the problem text of path_problems.
    • Rejected: Rely on the prompt only. A prompt instruction is not a deterministic check.
  • What must the stage planner prompt say about a workflow change?: The prompt must say that a group that changes a file under .github/workflows/ also lists tests/invariants/test_workflow_contracts.py in changes. (best practice) [sources: src/devops_cli/ai/tasks/roadmap_stage_change.md, AGENTS.md]
    • Chosen: Add an explicit instruction. The model reads the prompt before it writes a group, and the path check enforces the rule.
    • Rejected: Change only path_problems. The model can avoid the problem only when the prompt states the rule.
    • Rejected: Change only the prompt. The prompt is not a check, and a model can ignore it.

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

None.

Alternatives check of 2026-11-10: none.
Tool: none found.

Activity

  1. added
    source/agent
    type/feature
    scope/roadmap
    status/new
    value/medium
    effort/low
    on Nov 7, 2026
  2. dan-petty commented on Nov 7, 2026

    @dan-petty
    OwnerAuthor

    Intake placed this item to the backlog: intake puts every new item in the backlog. A person plans the milestones.

    • Type: type/feature. The feat prefix of the title gives the type.
    • Scope: scope/roadmap. The (roadmap) scope of the title gives the scope.
    • Priority: P2-Medium. It closes a gap in stage validation but does not block a release or fix a user-facing defect.
    • Value: Medium. It prevents one class of vacuous workflow verifications in the roadmap pipeline.
    • Effort: Low. It extends an existing path_problems rule and a prompt file; the body estimates about 8,000 tokens of work.
    • Related: fix(roadmap): stage includes perimeter tests for network policies #3972, which asks for a different change. Both extend path_problems to require a specific test file in the changes list when a specific file type is changed; #3972 targets network policy files, the candidate targets workflow files.
  3. added
    priority/p2-medium
    on Nov 7, 2026
  4. added
    status/ready
    and removed
    status/new
    on Nov 8, 2026
  5. devops-cli-service commented on Nov 8, 2026

    @devops-cli-service
    Contributor

    Status set to Ready at fe1d00b (see proposed design in issue body).

  6. devops-cli-service commented on Nov 10, 2026

    @devops-cli-service
    Contributor

    Alternatives check: none

    Reason: Searches for a maintained tool that requires a test to accompany a GitHub Actions workflow change returned only unrelated pages, and no tool works on the roadmap stage planner's per-group changes lists. The need is a repository-specific rule in path_problems plus a prompt line; the workflow checkers the repository already uses (actionlint, zizmor) only validate syntax and security, not that tests/invariants/test_workflow_contracts.py is in the same group, so no open tool covers it.

    Tool: none found

    Lacks:

    • No tool validates a roadmap stage plan's per-group changes lists
    • actionlint and zizmor check workflow syntax and security, not that a contract test accompanies a workflow edit
    • No tool requires the same group to list tests/invariants/test_workflow_contracts.py
    • The rule and the roadmap_stage_change.md instruction are specific to this repository's stage planner

    Searches run:

    • Danger JS rule "if a file changed require another file changed" pull request, results: 5
    • tool that requires tests to be updated when a GitHub Actions workflow file changes, results: 5
    • "workflow contract" tests GitHub Actions workflow files enforce test accompanies change, results: 5
    • danger.systems DSL warn fail when file changed also require test file changed, results: 5
    • danger danger-js github repository, results: 5
    • lint rule require tests when source file modified CI enforcement tool, results: 5
    • open source linter validates plan task groups include tests for changed files, results: 5

    Sources:

    Checked on 2026-11-10. A person decides what this means for the item. The check changes no label and closes no issue.

  7. added
    status/in-progress
    and removed
    status/ready
    on Nov 15, 2026
  8. added
    status/in-review
    and removed
    status/in-progress
    on Nov 15, 2026
  9. removed
    status/in-review
    on Nov 15, 2026
  10. devops-cli-service commented on Nov 15, 2026

    @devops-cli-service
    Contributor

    Live since 2026-11-15 23:51 UTC

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    effort/lowpriority/p2-mediumscope/roadmapsource/agenttype/featurevalue/medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions