Skip to content

fix(gitstate): PriorBaselines from a repo subdirectory (--dir source)#22

Merged
pedromvgomes merged 2 commits into
mainfrom
feature/vulture-inselberg
Jul 14, 2026
Merged

fix(gitstate): PriorBaselines from a repo subdirectory (--dir source)#22
pedromvgomes merged 2 commits into
mainfrom
feature/vulture-inselberg

Conversation

@pedromvgomes

Copy link
Copy Markdown
Contributor

Problem

The end-to-end verification of wardnet/wardnet#899 (rerun on v1.5.3) showed carry-forward finding nothingwarning: 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: the git fetch and git rev-list in PriorBaselines produced output, but the git ls-tree between them produced none.

Root cause: wardnet runs bulwark with --dir source, a subdirectory of the repo. git ls-tree <ref> without --full-tree scopes its listing to the cwd's path inside the ref's tree; bulwark-state has no source/ subtree, so the cached-files set was empty and every ancestor was skipped. git show ref:path is root-relative, which is why ReadBaseline works fine from a subdirectory and the difference stayed invisible — including in the original test, which ran from the repo root.

Fix

--full-tree on the ls-tree call. One flag; behavior from the repo root is unchanged.

Testing

The regression test now invokes PriorBaselines from a subdirectory of the checkout, reproducing wardnet's failure verbatim (RED: map[]; GREEN after the flag). Full go test -race ./..., gofmt, golangci-lint clean.

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

…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
@pedromvgomes
pedromvgomes merged commit dd9b18e into main Jul 14, 2026
4 checks passed
@pedromvgomes
pedromvgomes deleted the feature/vulture-inselberg branch July 14, 2026 16:42
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