Skip to content

feat(roadmap): validate scoped tests on the base commit before staging #4145

Open

Description

@devops-cli-service

Split from #3993.

Stage cannot run tests. The staging planner has read-only repository tools and no test runner. ADR 0004 keeps test selection advisory and makes the full suite the authoritative gate. This part needs a separate job or an implement step. The rest of the item can proceed without this part. Acceptance criteria: a validation step runs the scoped tests that plan_tests() selects on the base commit; the validation step records each failing test and its output in the item; the validation step does not change the plan Reads: lists; a test uses a fixed base commit and a fixed scoped test list.

Dependencies

Proposed design

Problem statement

Staging cannot run tests because its planner has only read-only repository tools. This item adds a validation step that runs the scoped tests that plan_tests() selects at the base commit before staging. The step records each failing test and its output in the item. It leaves the plan Reads: lists unchanged. ADR 0004 keeps test selection advisory, so a failure does not block staging. The item waits on #6521.

Acceptance criteria

Requirement: Validation before staging

The stage job MUST wait for the validation result of the item before it starts the planner.

Scenario: No validation result

  • WHEN The validation step has no result for the item.
  • THEN The stage job calls no planner for the item.

Requirement: Scoped test selection

The validation job SHALL select the scoped tests for the item with plan_tests().

Scenario: Fixed plan_tests result

  • WHEN A test calls the validation job with a fake plan_tests that returns a fixed scoped test list.
  • THEN The job passes exactly that list and the base commit to the validation step.

Requirement: Failure record

The validation step MUST record each failing test and its captured output in the item.

Scenario: One failing scoped test

  • WHEN A scoped test fails at the base commit.
  • THEN The item comment holds the test identifier and its captured output.

Requirement: Plan reads unchanged

The validation step MUST write no file in the change folder of the item.

Scenario: Failure does not edit the plan

  • WHEN The validation step records a failing scoped test.
  • THEN It writes no file under the change folder and the plan Reads: lists are unchanged.

Requirement: Advisory validation

A failing scoped test MUST NOT block the stage job.

Scenario: Failure is advisory

  • WHEN The validation step reports a failing scoped test.
  • THEN The stage job proceeds to the planner for the item.

Requirement: Fixed inputs

The validation step SHALL take the base commit and the scoped test list as explicit inputs.

Scenario: Offline validation test

  • WHEN A test calls the validation step with a fixed base commit, a fixed scoped test list and a fake test runner.
  • THEN The validation step calls the fake runner with exactly that commit and that list and returns the runner results.

Existing Tool Considered

No alternatives check has run. pytest is the open, maintained test runner. It runs a selected test list and reports each failure with captured output. It lacks the plan_tests() selector call, the item comment report and the stage wait. The change builds those three parts. The written cost is about 20k tokens to build, about 3k tokens per month to keep and fix, and about two days of elapsed time.

Key questions

  • Can the staging planner run tests?: No. The staging planner has read-only repository tools and no test runner. A separate step must run the tests. [sources: CONTEXT.md]
  • Where should the scoped test validation step run?: A separate validation job runs before the stage job. It runs pytest at the base commit and posts one report comment. The stage job waits for the result and then plans. (best practice) [sources: CONTEXT.md, docs/adr/0004-ci-is-the-authoritative-gate.md]
    • Chosen: Separate validation job before the stage job. The planner has no test runner. The job runs before the plan, so a broken base is known before staging.
    • Rejected: Implement step. It runs after staging and cannot validate the base before the plan.
    • Rejected: Test runner inside the staging planner. It breaks the read-only toolset and the token budget of the planner.
  • Does a failing scoped test block staging?: No. Test selection stays advisory. The full suite remains the authoritative gate. (best practice) [sources: docs/adr/0004-ci-is-the-authoritative-gate.md]
    • Chosen: Record the failure and keep staging eligible. ADR 0004 keeps test selection advisory.
    • Rejected: Block staging on a scoped failure. This makes selection a gate and contradicts ADR 0004.
    • Rejected: Ignore scoped failures. The item must record each failing test and its output.
  • How should the validation step record failures in the item?: It writes one comment on the item for each validation run. The comment lists each failing test identifier and its captured output. It writes no file in the change folder. (best practice) [sources: CONTEXT.md]
    • Chosen: One item comment for each validation run. The stage job already reports its run in an item comment, and the comment leaves the plan unchanged.
    • Rejected: Hidden job record block in the issue body. Test output can be large and can conflict with body edits.
    • Rejected: File in the change folder. It changes the plan and its Reads: lists.
  • What base commit should the validation step use?: The default branch head that the stage job reads, captured once at the start of the validation step. (best practice) [sources: CONTEXT.md]
    • Chosen: Default branch head at step start. It matches the base that staging reads and stays fixed for the run.
    • Rejected: Current default branch head for each test. The base can move during the run.
    • Rejected: Pull request base. No pull request exists before staging.

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

#6521

Activity

  1. added
    source/agent
    type/feature
    scope/roadmap
    status/new
    value/medium
    effort/medium
    on Nov 8, 2026
  2. devops-cli-service commented on Nov 8, 2026

    @devops-cli-service
    ContributorAuthor

    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. The part gives early test feedback, but the rest of item 3993 can proceed without it.
    • Value: Medium. The change finds failing scoped tests before staging and saves implement turns and budget.
    • Effort: Medium. The change needs a separate job or implement step and a test with a fixed base commit and test list.
    • Related: feat(roadmap): surface scoped tests in plan reads #3993, which asks for a different change. The candidate is split from item 3993; item 3993 adds scoped tests to the Reads lists, and the candidate runs those tests on the base commit.
  3. devops-cli-service commented on Nov 9, 2026

    @devops-cli-service
    ContributorAuthor

    Refine cannot set this item to Ready at 87e9bd7. A bot opened the item, so a review of the issue and of the proposal must approve it first. The review found the defects below. A person edits the body to answer them. The next refine round looks at the item again only after a body edit.

    • false_premise at plan / existing_tool: The plan claims that the repository uses pytest. The issue does not state this fact, and no file in the input shows it. Evidence: "pytest is the open, maintained test runner that the repository uses."
  4. dan-petty commented on Nov 20, 2026

    @dan-petty
    Owner

    Frozen on 2026-11-20. The stage, implement and fix-checks jobs grade under 60%, so the owner rule asks for a re-architecture before more fixes inside the current design (tracker #6519). This item is incremental work on those jobs, so its Dependencies section now names #6521 first. Stage and implement leave this item while #6521 is open. When the experiments of #6519 decide, a person closes #6521 (this item can then continue) or closes this item as not planned.

  5. devops-cli-service commented on Nov 20, 2026

    @devops-cli-service
    ContributorAuthor

    Next step: the open items close, or a person replies in a comment or edits the body. See Dependencies in the section Proposed design of the body.

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/p2-mediumscope/roadmapsource/agentstatus/newtype/featurevalue/medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions