fix(tia): persist state on detached HEAD- #1844 - #1891
Open
calebdw wants to merge 2 commits into
Open
Conversation
Consolidate duplicated CI environment detection logic from Snapshot and BaselineSync into a shared Pest\Support\Ci class. This reduces duplication and provides a single source of truth for CI detection, including comprehensive environment variable checks for all major CI providers.
Allow detached checkouts to write, delete, and rebuild TIA state so baseline publishers and local detached workflows produce a usable graph. Resolve the writable baseline from the Git branch, CI branch metadata, or a stable workspace key. Keep the default branch as the read fallback so local workspaces can use a published baseline without changing it.
Contributor
Author
|
@MrPunyapal, looks like ci needs to be approved |
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.
Supercedes: #1844
What:
Description:
This allows TIA to persist its dependency graph and related state when Git HEAD is detached.
Detached HEAD is a normal checkout state for GitLab CI and for local workflows that use jj with a colocated Git repository. TIA previously suppressed graph writes, state deletion, structural rebuilds, and
--freshpurges in this state. A run could therefore pass without producing the graph required by a baseline artifact or a later local run.TIA now permits the same state operations for attached and detached checkouts. It resolves the writable baseline identity in this order:
@workspace:<hash>key for jj and other detached workspaces.The default branch remains the read fallback. A local detached workspace can download a baseline recorded on the default branch, calculate changes from that baseline, and store its own SHA, tree, and test results under its workspace key. This prevents an unknown detached checkout from changing the published default-branch baseline.
The TIA CI abstraction now resolves both current and default branches, so each provider owns its environment-variable handling. Workspace baselines survive Git branch reclamation and do not participate in default-branch inference.
The tests cover sequential and parallel detached runs, structural rebuilds,
--fresh, unreadable graph replacement, branch reclamation, default-baseline isolation, and detached GitLab and GitHub branch detection. The fixture process also removes inherited CI variables so local-behavior tests remain local when the Pest suite itself runs in CI.Thanks!