Skip to content

ci(test): a pull request that only adds a plan runs the invariant tests, not the full suite #2860

Closed

Description

@dan-petty

What happened

A pull request that only adds a plan under openspec/changes/<issue>-<slug>/ runs the full test suite. The stage job opens one such pull request for each Ready P0 and P1 bug. On 2026-10-31 the three plan pull requests ran the job Tests & Coverage for 361 s (#2857), 371 s (#2858) and 297 s (#2859). They hold no source or test change. AGENTS.md rule 5 treats a check that averages more than 5 minutes as a P0 bug.

ci.yml already scopes work by what changed: the job Docs Site Build uses dorny/paths-filter, always runs, gates its steps and reports success; the image jobs skip when no image content changed.

A few tests read the change folders and must still run for a plan: tests/invariants/test_change_folders.py (names and forms), tests/invariants/test_committed_addresses.py (private addresses in committed files, which matters because a model writes the plan text), tests/invariants/test_pull_request_template.py and tests/invariants/test_architectural_invariants.py.

What should happen

In the job test of .github/workflows/ci.yml:

  • A paths-filter step finds a plan-only pull request: every changed file is under openspec/changes/ and none is under openspec/changes/archive/, openspec/specs/, openspec/config.yaml or .github/.
  • A plan-only pull request runs tests/invariants and nothing more of the test suite. Every other pull request, every push to main and every schedule run the full suite as today.
  • The job keeps its name and reports success, so the required check Tests & Coverage is met. The step for changed-line coverage passes when no Python line changed.
  • No escape: the filter is a path rule, not a label or a title rule. A pull request that implements an item archives its change folder with its code, so it runs everything.
  • Do not extend the rule to docs/** or the README. Tests read those files (the docs inventory, the AGENTS.md claims, links). That needs its own issue.

Evidence

Acceptance criteria

  • A test of ci.yml (the existing workflow contract tests) fails when the filter is missing, or when a path outside openspec/changes/<new folder>/ counts as plan-only.
  • A plan-only pull request shows Tests & Coverage as success with a run time under 150 s (measured on the pull request).
  • A pull request that changes a source, test, spec or workflow file still runs the full suite.
  • The CI section of CONTRIBUTING.md or docs/SDLC.md names the rule.
  • uv run devops ci passes.

Proposed design

Problem statement

A pull request that only adds a plan under openspec/changes/-/ runs the full test suite. The stage job opens one such pull request for each Ready P0 and P1 bug. On 2026-10-31 three plan pull requests ran Tests & Coverage for 361 s, 371 s, and 297 s. They hold no source or test change. AGENTS.md rule 5 treats a check that averages more than 5 minutes as a P0 bug. The test job in ci.yml needs a path-based filter that runs only tests/invariants for a plan-only pull request, and the full suite for every other pull request, push, and schedule run.

Acceptance criteria

Requirement: Plan-only detection

The test job SHALL detect a plan-only pull request when every changed file is under openspec/changes/ and none is under openspec/changes/archive/, openspec/specs/, openspec/config.yaml, or .github/.

Scenario: A pull request adds only a plan folder

  • WHEN A pull request changes only files under openspec/changes/-/
  • THEN The detection step sets the output plan_only to true

Requirement: Invariants-only test run

A plan-only pull request SHALL run only the tests/invariants tests and report the job as success.

Scenario: A plan-only pull request runs invariants

  • WHEN The detection step sets plan_only to true
  • THEN The test step runs tests/invariants and the job reports success

Requirement: Full suite for non-plan pull requests

A pull request that changes a source, test, spec, or workflow file SHALL run the full test suite.

Scenario: A pull request changes a source file

  • WHEN A pull request changes a file under src/
  • THEN The test step runs devops ci --check --no-cache --only test

Requirement: Workflow contract test

A test of ci.yml SHALL fail when the plan-only filter is missing or when a path outside openspec/changes// counts as plan-only.

Scenario: The filter is missing

  • WHEN The ci.yml test job has no plan-only detection step
  • THEN The workflow contract test fails

Requirement: Documentation names the rule

The CI section of CONTRIBUTING.md or docs/SDLC.md SHALL name the plan-only test scoping rule.

Scenario: The documentation describes the rule

  • WHEN A reader reads the CI section of CONTRIBUTING.md
  • THEN The section states that a plan-only pull request runs only tests/invariants

Requirement: Changed-line coverage passes for plan-only

The changed-line coverage step SHALL pass when no Python line changed.

Scenario: A plan-only pull request has no Python changes

  • WHEN A plan-only pull request changes no .py files
  • THEN The changed-line coverage step exits with status 0

Existing Tool Considered

No alternatives check has run. The repo already uses the shell-based git diff --name-only path detection in the image jobs, changed-tests, and rule-pack jobs of .github/workflows/ci.yml. The dorny/paths-filter action (v4.0.3) is also a dependency. The change reuses the existing shell pattern; no new external tool is needed.

Key questions

  • Which method detects a plan-only pull request?: The shell-based git diff --name-only pattern, already used in the image jobs, changed-tests, and rule-pack jobs of the same workflow. (best practice) [sources: .github/workflows/ci.yml]
    • Chosen: shell git diff --name-only. Already in the repo in four jobs. Handles the "all files must match and none match exclusions" logic naturally in a shell loop.
    • Rejected: dorny/paths-filter. Its "any file matches" semantics do not express "all files must match and none match exclusions." It would need a second filter for the exclusions and a comparison of the two outputs.
  • What is the set of paths that makes a pull request plan-only?: Every changed file is under openspec/changes/ and none is under openspec/changes/archive/, openspec/specs/, openspec/config.yaml, or .github/. [sources: openspec/config.yaml]
  • Which tests run for a plan-only pull request?: The tests/invariants directory: test_change_folders.py, test_committed_addresses.py, test_pull_request_template.py, and test_architectural_invariants.py. [sources: tests/invariants/test_change_folders.py, tests/invariants/test_committed_addresses.py, tests/invariants/test_pull_request_template.py, tests/invariants/test_architectural_invariants.py]
  • How does the changed-line coverage step behave for a plan-only pull request?: The step runs as today. It passes because no Python line changed, so diff-cover has no changed lines to measure. (best practice) [sources: .github/workflows/ci.yml]
    • Chosen: Keep the step; it passes. No Python lines changed means diff-cover has nothing to measure and exits 0. No conditional branch needed.
    • Rejected: Skip the step for plan-only. Adds a conditional branch for no benefit. The step already passes.
  • Where does the documentation name the rule?: The CI section of CONTRIBUTING.md, section 3. (best practice) [sources: CONTRIBUTING.md]
    • Chosen: CONTRIBUTING.md. It is the primary contributing guide and already describes the CI checks and the devops ci command.
    • Rejected: docs/SDLC.md. It is the enterprise SDLC framework. The rule is a CI detail, not a lifecycle phase.

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

None.

Activity

  1. added
    source/agent
    type/infra
    status/new
    value/medium
    effort/medium
    on Oct 31, 2026
  2. dan-petty commented on Oct 31, 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/infra. The ci prefix of the title gives the type.
    • Scope: none. The title has the scope test, and .github/labels.yml declares no scope/test label. Add the label to the file to give the scope to this item.
    • Priority: P1-High. AGENTS.md rule 5 classifies a check over 5 minutes as a P0 bug, and three runs exceeded that threshold.
    • Value: Medium. It saves CI minutes on plan-only pull requests but does not change user-facing behaviour.
    • Effort: Medium. The filter logic has a precedent in the same workflow, but contract tests and the invariant-test subset need care.
    • Related: ci(gate): checks of committed files and tool configuration run as devops ci rows, not as pytest tests that start the tool #2164, which asks for a different change. Both reduce unnecessary test execution in CI, but 2164 moves specific checks out of pytest while the candidate skips the full suite for plan-only PRs via a paths-filter.
  3. added
    priority/p1-high
    on Oct 31, 2026
  4. added
    status/ready
    and removed
    status/new
    on Oct 31, 2026
  5. devops-cli-service commented on Oct 31, 2026

    @devops-cli-service
    Contributor

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

  6. added
    status/in-progress
    and removed
    status/ready
    on Oct 31, 2026
  7. removed
    status/in-progress
    on Oct 31, 2026
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/mediumpriority/p1-highsource/agenttype/infravalue/medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions