fix(test): gstack-decision-bins — explicit branch context for the scope filter

CI checks out a detached HEAD, where gitBranch() returns undefined on both
the log and search sides, so an implicitly branch-scoped decision can never
surface (filterByScope requires a matching non-empty ctx.branch). Pass the
branch explicitly on both sides — the filter logic is what's under test, not
git branch detection.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Garry Tan 2026-08-15 09:11:28 -07:00
parent 6c0b2e93c7
commit c394e4836a
No known key found for this signature in database
GPG Key ID: C1F69E85C74EFE1D
1 changed files with 7 additions and 2 deletions

View File

@ -194,9 +194,14 @@ describe("gstack-decision-search --recent / --scope / datamark", () => {
expect(out).toContain("alpha"); // NaN slice is a no-op → returns all
});
test("--scope filters by scope", () => {
// Explicit branch on both sides: CI checks out a detached HEAD, where
// gitBranch() returns undefined on log AND search, so an implicit
// branch-scoped decision can never surface (filterByScope requires a
// matching non-empty ctx.branch). The filter logic is what's under test,
// not git branch detection.
log('{"decision":"repo-call","scope":"repo","source":"user"}');
log('{"decision":"branch-call","scope":"branch","source":"user"}');
const out = search("--scope branch");
log('{"decision":"branch-call","scope":"branch","branch":"feature-x","source":"user"}');
const out = search("--scope branch --branch feature-x");
expect(out).toContain("branch-call");
expect(out).not.toContain("repo-call");
});