Skip to content

Verify ancestor walkability on shallow clones in findBaseSha#80

Merged
RomainCscn merged 1 commit into
mainfrom
romain/lin-70734-v0100-sync-silently-skips-release-creation-when-latest
May 18, 2026
Merged

Verify ancestor walkability on shallow clones in findBaseSha#80
RomainCscn merged 1 commit into
mainfrom
romain/lin-70734-v0100-sync-silently-skips-release-creation-when-latest

Conversation

@RomainCscn

Copy link
Copy Markdown
Collaborator

When findBaseSha checks whether a candidate release's commit is an ancestor of HEAD, it previously gated git merge-base --is-ancestor on commitExists. That gate misfires on shallow CI clones: a side-branch deepening fetch can pull a sibling commit as a boundary parent without extending main's shallow. The object is local but not walkable from HEAD, and merge-base --is-ancestor exits 1 in that case, the same exit code as a genuine non-ancestor, so the candidate is silently rejected.

End-to-end effect: in a main + long-lived release-branch workflow, a sync --release-version=… on main after a release-branch sync would fall through to the empty-range path, skip release creation, and 404 on the next update --stage=….

Fix: replace the commitExists + ensureCommitAvailable + isAncestor with one atomic verifyAncestorReachable that deepens iteratively and only treats a negative as definitive once the repo is fully unshallowed.

Includes a regression test that reproduces the failure inside a real shallow clone.


Will also add a new flag in another PR, likely --base-commit or something similar, so that we can allow users to set the base commit explicitly to avoid relying on the ancestor-walk heuristic.

@linear-code

linear-code Bot commented May 18, 2026

Copy link
Copy Markdown

@linear-code linear-code Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. The atomic verifyAncestorReachable correctly fixes the false-negative ancestor check on shallow clones, and the regression test verifies the fix with a real shallow clone topology. No blocking issues found.

@RomainCscn RomainCscn force-pushed the romain/lin-70734-v0100-sync-silently-skips-release-creation-when-latest branch from 9ff0789 to ad9ea28 Compare May 18, 2026 08:57
@RomainCscn RomainCscn requested a review from axelniklasson May 18, 2026 08:58
@RomainCscn RomainCscn merged commit 5a202e4 into main May 18, 2026
10 checks passed
@RomainCscn RomainCscn deleted the romain/lin-70734-v0100-sync-silently-skips-release-creation-when-latest branch May 18, 2026 09:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants