From c394e4836a1bb347fdbfd78ff0ccbd8661ec3bde Mon Sep 17 00:00:00 2001 From: Garry Tan Date: Sat, 15 Aug 2026 09:11:28 -0700 Subject: [PATCH] =?UTF-8?q?fix(test):=20gstack-decision-bins=20=E2=80=94?= =?UTF-8?q?=20explicit=20branch=20context=20for=20the=20scope=20filter?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- test/gstack-decision-bins.test.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/test/gstack-decision-bins.test.ts b/test/gstack-decision-bins.test.ts index 219dbe9b2..3c0d42822 100644 --- a/test/gstack-decision-bins.test.ts +++ b/test/gstack-decision-bins.test.ts @@ -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"); });