Repository navigation
Conversation
jbraband
force-pushed
the
fix/tia-read-capture
branch
from
November 4, 2026 19:46
8143b6a to
8d3f111
Compare
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What:
Description:
Under
--tia, a test that reads a project file as text (instead of executing or rendering it) replays a stale pass after that file changes. Coverage andBladeEdgesgive it no edge to the file, and the watch patterns skip any file the graph already knows (Graph::applyWatchPatternFallback()), so nothing selects it.This PR records the files a test reads:
src/Plugins/Tia/ReadCapture.php(new): afile://stream wrapper, registered only while a test records (Recorder::beginTest()toendTest()). It forwards every operation, and links each file opened for reading throughRecorder::linkSource(), the hookBladeEdgesuses. It skips includes, which coverage already records, and write-only opens. If another wrapper already ownsfile://(such asdg/bypass-finalsor Patchwork), it opens through that wrapper with the original flags and registers it again after the test.src/Plugins/Tia/Recorder.php: starts and stops the capture, and addslinkRead(), which keeps project files only throughSourceScope.On a fresh Laravel 13 skeleton, the patch adds exactly one graph edge (the reading test to the view), and recording takes about 4% longer. Plain runs are unchanged. Capture is on by default; I am happy to put it behind an opt-in such as
pest()->tia()->captureReads()instead.Tests:
tests/Unit/Plugins/Tia/ReadCapture.php: what is linked (reads throughfile_get_contents,file,fopen,SplFileObject) and what is not (writes, includes, files outside the project, directory listings), that the wrapper is swapped and restored, that filesystem operations pass through, and that an existingfile://wrapper is chained with its include flag.tests/Features/Tia/ReadCapture.php: in the fixture app, a test that readsapp/Greeter.phprecords an edge to it and is selected when it changes (sequential and parallel), and is not selected when an unrelated file changes.Known gaps: directory listings (
scandir,glob) are not captured, and while a test records, a failed open raises two warnings instead of one, as mutate's wrapper does.Related:
Fixes #2005
Reproduction: https://github.com/jbraband/pest-tia-reads-reproduction