Skip to content

fix(tia): persist graph on detached HEAD - #1844

Open
calebdw wants to merge 2 commits into
pestphp:5.xfrom
calebdw:calebdw/push-owkpumrmwusw
Open

fix(tia): persist graph on detached HEAD#1844
calebdw wants to merge 2 commits into
pestphp:5.xfrom
calebdw:calebdw/push-owkpumrmwusw

Conversation

@calebdw

@calebdw calebdw commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

What:

  • Bug Fix
  • New Feature

Description:

This updates TIA so detached HEAD checkouts can still persist the dependency graph.

Detached HEAD is not necessarily an unsafe or throwaway state. GitLab CI checks out commits detached by default, which prevents a TIA baseline publisher job from writing graph.json. Local workflows that use tools like jj with colocated Git repositories can also leave Git HEAD detached while still expecting Pest to record and reuse the TIA graph.

Previously, TIA suppressed graph writes, deletes, and --fresh purges when HEAD was detached. That made --tia appear to run successfully while silently producing an empty baseline. This removes that suppression and continues to use the configured or fallback branch name when Git cannot report a current branch.

The detached-head reclamation tests were updated to assert the new intended behavior: detached HEAD runs can rebuild, refresh, and replace unreadable TIA state.

Thanks!

@calebdw
calebdw force-pushed the calebdw/push-owkpumrmwusw branch from 1aeae06 to 4779cf9 Compare August 11, 2026 03:29
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.
@calebdw
calebdw force-pushed the calebdw/push-owkpumrmwusw branch from 4779cf9 to b794a6b Compare August 17, 2026 20:36
Detached HEAD is common in valid TIA recording environments, not just
unsafe throwaway states. GitLab CI checks out commits detached by default,
which prevented baseline publisher jobs from writing graph.json at all.

Local workflows that use tools like jj can also leave Git HEAD detached
while still expecting Pest to record and reuse the TIA graph. Suppressing
all writes in those cases makes --tia appear to run successfully while
silently producing an empty baseline.

Always allow graph writes and deletions, using the configured or fallback
branch name when Git cannot report a current branch.
@calebdw
calebdw force-pushed the calebdw/push-owkpumrmwusw branch from b794a6b to 63427c7 Compare August 17, 2026 22:26
@calebdw calebdw changed the title fix(tia): allow graph persistence on detached HEAD locally fix(tia): persist graph on detached HEAD Aug 17, 2026
@calebdw

calebdw commented Aug 17, 2026

Copy link
Copy Markdown
Contributor Author

@nunomaduro, I came across this while testing the GitLab tia work---this is needed to support recording tia in gitlab ci

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.

1 participant