fix: support Tia when the Pest project is a subdirectory of the git repository - #1805
Draft
johnbacon wants to merge 1 commit into
Draft
fix: support Tia when the Pest project is a subdirectory of the git repository#1805johnbacon wants to merge 1 commit into
johnbacon wants to merge 1 commit into
Conversation
…epository Git prints and addresses paths relative to the repository root, while Tia's dependency graph is keyed on project-relative paths. When the two roots coincide the notions are identical; in a monorepo they are not, which previously made change detection map every change to zero tests — so the repository-root guard refused to run Tia at all. ChangedFiles now resolves the project's prefix inside the repository once (git rev-parse --show-prefix) and translates at every git boundary: output paths from diff/status are stripped to project-relative (dropping sibling packages), and input paths to git show are prefixed. The guard and its exception are removed. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
johnbacon
marked this pull request as ready for review
July 31, 2026 15:11
johnbacon
marked this pull request as draft
July 31, 2026 19:46
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:
Tia currently cannot be used when the Pest project is a subdirectory of its git repository (e.g. a
backend/Laravel app in a monorepo). On 4.x this failed silently — change detection mapped every change to zero tests and replayed stale results as passing (#1783's reproduction) — and 5.x added theTiaRequiresRepositoryRootguard, which refuses to run instead (#1802).The root cause is a path-frame mismatch: git prints and addresses paths relative to the repository root, while the Tia dependency graph is keyed on project-relative paths. This PR makes
ChangedFilestranslate at every git boundary instead of requiring the two roots to coincide:ChangedFiles::gitPrefix()resolves the project's prefix inside the repository once, viagit rev-parse --show-prefix(empty at the repo root or when git is unavailable, so single-repo projects are byte-for-byte unaffected).git diff --name-onlyandgit status --porcelainare stripped to project-relative; paths outside the project (sibling packages) are dropped.git show <sha>:<path>(behaviourally-unchanged filtering, and the composer.lock drift summary in the Tia plugin) get the prefix prepended.git check-ignore --stdinalready receives cwd-relative paths with the project root as cwd, so it needed no change.TiaRequiresRepositoryRootguard and exception are removed — with the translation in place there is nothing left to guard against. The suggested-fix sketch in TIA: change detection misses all changes when the Pest project is a subdirectory of the git repository (monorepo) #1783 is what's implemented here.Covered by new
ChangedFilesunit tests that build real nested-repo fixtures: prefix resolution, working-tree + committed change detection from a subdirectory (sibling changes dropped), the behaviourally-unchanged filter across the prefix boundary, and a repo-root regression case. Full suite (--exclude-group=integration), Pint, Rector, and PHPStan are green locally.One adjacent gap deliberately not touched here:
BaselineSyncreads<projectRoot>/.git/configdirectly to derive the GitHub slug, so remote baseline sync stays inactive for subdirectory projects (and git worktrees, where.gitis a file). Switching that togit config --get remote.origin.urlwould fix both — happy to follow up separately if you want it.Related:
🤖 Generated with Claude Code