Skip to content

fix(#1140): fixture_commit ancestry is unevaluable in any shallow clone - #1146

Merged
admarble merged 3 commits into
mainfrom
feature/1140-shallow-fixture-commit
Sep 24, 2026
Merged

admarble merged 3 commits into
mainfrom
feature/1140-shallow-fixture-commit

Conversation

@admarble

Copy link
Copy Markdown
Contributor

Closes #1140

Cause

The ancestry guard in __tests__/evals-fixture-commit.test.ts assumed a shallow clone lacks the fixture commit objects. A claude.ai cloud checkout breaks that assumption. It clones 51 commits deep and then fetches other branches, which pulls 5 of the 7 fixture commits into the object database. HEAD's history is still cut off above them, so git merge-base --is-ancestor exits 1. The commits are present, so the test asserted ancestry and failed.

Reproduced with git clone --depth 51 + git fetch origin '+refs/heads/*:refs/remotes/origin/*': exactly the 5 failing files came back present=y ancestor=n, and the 2 absent ones took the existing skip. The test failed 5/16, matching the issue.

Fix

  • scripts/evals/commit-ancestry.ts: fixtureCommitAncestry() returns ancestor / not-ancestor / unevaluable. Any non-ancestor result in a shallow repository is unevaluable, whether or not the object is present. In a full clone, a present commit that isn't an ancestor still fails.
  • The helpers live in scripts/ rather than the test file because the tautology detector counts only relative imports as production code. It also treats a path matching /fixture/i as a mock, which is why the module is named commit-ancestry.
  • New describe("fixture_commit ancestry guard (#1140)"): a hermetic origin (main: F → G → M1 → M2, side forked from F), a --depth 1 clone of main that then fetches side (F present, G absent, both beyond the boundary), plus a full-clone negative control with a present orphan commit.

Verification

  • npx vitest run __tests__/evals-fixture-commit.test.ts (the issue's command): 18/18 in the full checkout and 18/18 in the real 51-deep shallow clone (was 5 failed / 11 passed).
  • timeout 900 npm test: 337 files, 8379 passed, 1 expected fail, 3 skipped.
  • npm run build, npx tsc --noEmit -p ., npm run typecheck:scripts, npm run lint, prettier: clean. The tautology detector reports all tests call production code.

Mutation-verified: AC-1 — restored the presence-only guard (if (!commitObjectPresent(sha, cwd)) return "unevaluable") in fixtureCommitAncestry; treats a present commit beyond the shallow boundary as unevaluable failed (1 failed / 17 passed); restored.

Mutation-verified: AC-2 — replaced the shallow check with an unconditional return "unevaluable"; rejects a present commit that is not an ancestor of HEAD in a full clone failed (1 failed / 17 passed); restored.

🤖 Generated with Claude Code

…ne, not only when the object is absent

Fetching other branches pulls the fixture commits into a shallow clone's object database while HEAD's history is still cut above them, so the presence-only guard asserted ancestry and false-failed 5 cases in a 51-commit cloud checkout. Guard on --is-shallow-repository instead, and pin the shape with hermetic depth-1 clone fixtures.

Entire-Checkpoint: 78fc3431d037
…s/commit-ancestry.ts

The tautology detector counts only relative imports as production code and treats any path matching /fixture/i as a mock, so the test-local helpers left four blocks flagged and failed scripts/qa/tautology-detector-cli.test.ts in the full suite.

Entire-Checkpoint: df59543b52a2
Entire-Checkpoint: 6f29072cfae1
@admarble
admarble merged commit 1bbe088 into main Sep 24, 2026
7 checks passed
@admarble
admarble deleted the feature/1140-shallow-fixture-commit branch September 24, 2026 22:20
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.

test(evals-fixture-commit): fixture_commit ancestor check false-fails on a shallow clone

1 participant