Skip to content

fix(tia): refresh edges within the coverage scope in coverage runs - #1956

Closed
almontasser wants to merge 1 commit into
pestphp:5.xfrom
almontasser:fix/tia-coverage-new-edges
Closed

almontasser wants to merge 1 commit into
pestphp:5.xfrom
almontasser:fix/tia-coverage-new-edges

Conversation

@almontasser

Copy link
Copy Markdown

What:

  • Bug Fix
  • New Feature

Description:

In --tia --coverage mode, Graph::replaceEdges() runs with keepExisting: true and skips every test that already has edges. When a test starts using a file it didn't touch when the graph was recorded, the coverage run never adds that edge. A later break in that file replays the test as passed.

A coverage run now replaces a test file's edges within the scope it can observe: the files its coverage data can show (files with an executable line and no ignored code), plus the Blade views that the link tracker records in both modes. It keeps recorded edges to every other file, such as files outside <source>, and adds the new edges. If the run saw a test file only in part, because a test was replayed from the cache, skipped, incomplete, risky, or narrowed by covers() or coversNothing(), it keeps all of that file's recorded edges and only adds new ones. Workers send their observed files and partly seen test files with their edge partials, so --parallel makes the same decision.

Regression tests:

  • tests/Unit/Plugins/Tia/Graph.php: replaceEdges() with no observed files (plain runs), an empty list, and a list; bladeFiles().
  • tests/Features/Tia/CoveragePiggyback.php, sequentially and in parallel: a coverage run adds a dependency that a test gained, and drops a dependency or a view that it lost (these fail on 5.x). It keeps an edge outside <source> or to code its coverage ignores, and keeps the edges of a test file that it filtered, replayed in part, or whose coverage it didn't record.

Related:

Fixes #1953

A coverage run replaces a test file's edges to files its coverage data
can show and keeps the rest. It keeps every edge of a test file it saw
only in part.
@nunomaduro

Copy link
Copy Markdown
Member

hi friend, thank you! there is a lot of changes on this pr that are not related to the issue. going with #1955 for the fix, feel free to send the edge-dropping part as a separate pr.

@nunomaduro nunomaduro closed this Oct 11, 2026
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.

[Bug]: --tia --coverage never records a new dependency of a test that is already in the graph, so a broken dependency replays as passed

2 participants