Skip to content

[Bug]: TIA marks a source edit made during a run as tested, so no later run selects it #1972

Open

Description

@keithyeohh

What Happened

TIA records the state of the working tree when a run ends. An edit to a source file made while the run is in progress is therefore stored as already tested, and the next run prints No affected tests found. and exits 0.

  • A breaking edit made 12 s into a 37 s run produced no warning. The next --tia run selected nothing, while the same tests failed (12 failures) when run by path.
  • During a --fresh recording the same happens, with no warning.
  • Structural files are handled: an edit to phpunit.xml during a recording gives WARN Project files changed during the run — discarding recorded edges. Source files get no such check.

Expected: snapshot the tree when the run starts, or compare the start and end states and treat any file that changed during the run as still changed.

How to Reproduce

  1. Configure TIA and record a graph with vendor/bin/pest --tia.
  2. Start vendor/bin/pest --tia after a change that selects a long-running set of tests.
  3. While it runs, introduce a breaking change in a source class those tests cover.
  4. When the run finishes, run vendor/bin/pest --tia again — No affected tests found., exit 0.
  5. Run the covering tests by path — they fail.

Sample Repository

No response

Pest Version

5.3.2

PHP Version

8.5.8

Operation System

macOS

Notes

Same root shape as #1856 (end-of-run state recorded for code the run never executed), but triggered by an uncommitted working-tree edit rather than a commit, so the fix there (stamping HEAD at start) would not cover it.

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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions