Skip to content

Preserve historical SHA pins during branch normalization - #165

Open
bayandin wants to merge 2 commits into
github:mainfrom
bayandin:fix-preserve-historical-sha-pins
Open

bayandin wants to merge 2 commits into
github:mainfrom
bayandin:fix-preserve-historical-sha-pins

Conversation

@bayandin

@bayandin bayandin commented Oct 14, 2026 •

Copy link
Copy Markdown

Problem

Different historical SHA refs can belong to the same branch. Reverse lookup replaces each SHA with that branch name even after its head has advanced, causing planning to fail with conflicting planned target owner/action@main resolves to both .... Repairing existing lockfile entries can cause the same collision.

Fix

Only rewrite a bare SHA to a branch name when the branch head matches the pinned commit, both during initial reverse lookup and existing-lockfile repair. Keep the containing branch as metadata for historical pins. Exact tags continue to identify their matching commits.

Regression tests cover fresh and existing lockfiles, adding a workflow to existing inventory, historical commits, exact branch heads, and exact tags.

Validation

  • The new historical-SHA regressions fail against the original production code and pass with this fix.
  • make test, including release fixtures and go test -race -count=1 ./....
  • make vet, make fmt-check, and git diff --check.
  • make test-stub: all 34 compiled-binary integration scenarios.

@bayandin
bayandin force-pushed the fix-preserve-historical-sha-pins branch 2 times, most recently from f0a8ff8 to 95a7e88 Compare October 14, 2026 09:09
@bayandin bayandin changed the title Preserve historical SHA refs when their containing branch has advanced Preserve distinct SHA pins during ref normalization Oct 14, 2026
@bayandin
bayandin force-pushed the fix-preserve-historical-sha-pins branch from deb144a to 19daa8c Compare October 14, 2026 10:44
@bayandin bayandin changed the title Preserve distinct SHA pins during ref normalization Preserve historical SHA pins during branch normalization Oct 14, 2026
Only replace a bare SHA with a branch name when its head matches the
pinned commit. Keep containing branches as metadata for older commits,
both during reverse lookup and when repairing existing lockfile entries.
Update the existing branch-repair test fixture to provide the branch head.
Cover distinct historical commits on the same branch in fresh and
existing lockfiles, including adding a workflow to existing inventory.
Check that branch heads and exact tags still normalize to symbolic refs.
@bayandin
bayandin force-pushed the fix-preserve-historical-sha-pins branch from 19daa8c to 8489db0 Compare October 14, 2026 10:48
@bayandin
bayandin marked this pull request as ready for review October 14, 2026 10:58
@bayandin
bayandin requested a review from a team as a code owner October 14, 2026 10:58
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