fix(gitstate): PriorBaselines from a repo subdirectory (--dir source)#22
Merged
Conversation
…es nothing A docs-only merge to main measures nothing: every coverage producer is path-filtered away, and --tests=skip finds no reports. The old code early-returned "no coverage measured" before the record path, leaving that main commit with no baseline at all — so the first PR against it recomputed nothing in the bare worktree, reported every language as [NEW], and gated on nothing (wardnet/wardnet#899). The record-on-main path now runs before the empty-report bailout: the carry-forward fills every detected language from the nearest prior baseline, so a nothing-measured main run still records a full baseline. "no coverage measured" is only printed when there is truly nothing to record — nothing measured and no priors to carry. Merge-base/HEAD resolution is now lenient so a repo with no origin/main still gets the message instead of a merge-base error. Claude-Session: https://claude.ai/code/session_01QMTWVM4pUB4xy6F6P9wWYA
…tory The carry-forward silently found nothing on wardnet's real CI (PR #899 rerun) despite the parent commit having a complete cached baseline: consumers run bulwark with --dir source, and `git ls-tree <ref>` without --full-tree scopes the listing to the cwd's path inside the ref's tree. bulwark-state has no source/ subtree, so the cached-files set came back empty and every ancestor was skipped — while `git show ref:path` (root-relative) kept working, which is why ReadBaseline never exposed the difference. --full-tree lists from the tree root regardless of cwd. The regression test now calls PriorBaselines from a subdirectory of the repo, reproducing the wardnet failure verbatim before the fix. Claude-Session: https://claude.ai/code/session_01QMTWVM4pUB4xy6F6P9wWYA
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.
Problem
The end-to-end verification of wardnet/wardnet#899 (rerun on v1.5.3) showed carry-forward finding nothing —
warning: rust/typescript ... no prior baseline entry was found to carry forward— even though the merge-base's parent (17cac2ed) has a complete cached baseline ({rust: 86.04, typescript: 93.77}). The job log exposes the mechanism: thegit fetchandgit rev-listinPriorBaselinesproduced output, but thegit ls-treebetween them produced none.Root cause: wardnet runs bulwark with
--dir source, a subdirectory of the repo.git ls-tree <ref>without--full-treescopes its listing to the cwd's path inside the ref's tree;bulwark-statehas nosource/subtree, so the cached-files set was empty and every ancestor was skipped.git show ref:pathis root-relative, which is whyReadBaselineworks fine from a subdirectory and the difference stayed invisible — including in the original test, which ran from the repo root.Fix
--full-treeon the ls-tree call. One flag; behavior from the repo root is unchanged.Testing
The regression test now invokes
PriorBaselinesfrom a subdirectory of the checkout, reproducing wardnet's failure verbatim (RED:map[]; GREEN after the flag). Fullgo test -race ./...,gofmt,golangci-lintclean.Merge Commit Message
fix(gitstate): use ls-tree --full-tree so PriorBaselines carry-forward works when bulwark runs with --dir pointing at a repo subdirectory
https://claude.ai/code/session_01QMTWVM4pUB4xy6F6P9wWYA