fix(tia): support GitHub Enterprise remotes when fetching the shared baseline - #1900
Draft
yamenarahman wants to merge 1 commit into
Draft
fix(tia): support GitHub Enterprise remotes when fetching the shared baseline#1900yamenarahman wants to merge 1 commit into
yamenarahman wants to merge 1 commit into
Conversation
…baseline BaselineSync matched the origin remote against a literal github.com, so fetchIfAvailable() returned false before gh ran on a GitHub Enterprise Server remote. --tia --baselined then turned itself off with no warning, and GH_HOST could not help because gh was never invoked. GitHubRepository now parses the host out of the three remote shapes Pest already accepted. gh run list and gh run download take the documented -R [HOST/]OWNER/REPO, while gh api and gh auth status take --hostname <host>; the gh api path keeps its repos/OWNER/REPO form. Every call on github.com keeps its current arguments. A host other than github.com counts as GitHub only when gh is authenticated for it, so a GitLab remote stays the local-recording no-op it is today.
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:
Baseline fetching is a silent no-op on GitHub Enterprise Server.
BaselineSync::detectGitHubRepo()matched theoriginremote against a literalgithub.comin all three URL shapes and returnednullfor anything else.fetchIfAvailable()returnsfalseon thatnullbeforeghis reached, so on a remote such asgit@github.foodics.com:pay/capital-api.gitthe whole feature turns itself off: no run is queried, no artifact is downloaded, no warning is printed, and the suite quietly records a local baseline instead. SettingGH_HOSTcannot help, becauseghis never invoked.This makes the detection host-aware:
Pest\Plugins\Tia\GitHubRepositoryparses theoriginremote of any host across the three shapes Pest already accepted —user@host:owner/repo,https://host[:port]/owner/repoandssh://[user@]host[:port]/owner/repo— and carries thehostnext to theowner/reponame.gh run listandgh run downloadget-R host/owner/repo, which is the[HOST/]OWNER/REPOform--repodocuments.gh apikeeps therepos/owner/repo/actions/runs/<id>/artifactspath and gains--hostname host.gh auth statusgains--hostname host.github.comevery one of those calls keeps its current arguments byte for byte:qualifiedName()returns the bareowner/repoandhostnameArguments()returns an empty array.A remote that is not on
github.comcounts as GitHub only whenghis authenticated for its host. That is the ruleghitself applies to a repository's remotes, and it keeps a GitLab or Bitbucket remote the silent local-recording no-op it is today instead of turning it into agh-is-not-authenticated panic.Storage::projectKey()already read the origin remote host-agnostically, so the on-disk state key is untouched.Tests:
tests/Unit/Plugins/Tia/GitHubRepository.php— the three URL shapes ongithub.comand on Enterprise hosts (git@github.foodics.com:pay/capital-api.git,https://github.example.com/org/repo,ssh://git@ghe.example.com:2222/org/repo.git), the shapes that stay rejected, reading.git/config, and theghargument fragments each host produces.tests/Features/Tia/RemoteBaseline.php— an end-to-end fetch fromgit@github.foodics.com:pay/capital-api.gitasserting the recordedghargv carries-R github.foodics.com/pay/capital-api,auth status --hostname github.foodics.comandapi --hostname github.foodics.com repos/pay/capital-api/...; plus a case proving a hostghdoes not know records locally and never reachesgh run list. The existinggithub.comtest now also asserts-R pestphp/tia-fixtureand that no--hostnameis passed anywhere.ghstub records its argv and honoursgh auth status --hostname.Run on PHP 8.4:
*
Tests\Features\Tia\StateReclamation > a fatal error mid-file is a test error, not a truncation with dataset "parallel"fails the same way on a pristine5.xcheckout in my container, so it is not from this change.Related:
Docs companion: pestphp/docs#378
🤖 Generated with Claude Code