From 470c1a0bff9fb81f01584cda2510358a290fb700 Mon Sep 17 00:00:00 2001 From: Tom Boucher Date: Sat, 25 Apr 2026 16:47:55 -0400 Subject: [PATCH] fix(#2722): forensics gh commands pin --repo gsd-build/get-shit-done (#2723) * fix(#2722): forensics gh commands pin --repo gsd-build/get-shit-done gh issue create and gh label list both defaulted to the repo inferred from $PWD, causing issues to be submitted to the user's current project instead of this repo. Added --repo gsd-build/get-shit-done to both commands. Added two regression tests covering both gh calls. Closes #2722 Co-Authored-By: Claude Sonnet 4.6 * fix(#2723): scope forensics tests to specific gh commands, not whole file CodeRabbit found that the gh issue create test searched the whole workflow file, so it would pass even if gh issue create lacked --repo (because gh label list already contains the repo string elsewhere). Also replaced the brittle 200-char slice in the label-list test with a regex. Both tests now use assert.match() with command-scoped regexes. Co-Authored-By: Claude Sonnet 4.6 --------- Co-authored-by: Claude Sonnet 4.6 --- get-shit-done/workflows/forensics.md | 3 ++- tests/forensics.test.cjs | 22 ++++++++++++++++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/get-shit-done/workflows/forensics.md b/get-shit-done/workflows/forensics.md index caa5d765e..07e1c60c4 100644 --- a/get-shit-done/workflows/forensics.md +++ b/get-shit-done/workflows/forensics.md @@ -244,13 +244,14 @@ If actionable anomalies were found (HIGH or MEDIUM confidence): If confirmed: ```bash # Check if "bug" label exists before using it -BUG_LABEL=$(gh label list --search "bug" --json name -q '.[0].name' 2>/dev/null) +BUG_LABEL=$(gh label list --repo gsd-build/get-shit-done --search "bug" --json name -q '.[0].name' 2>/dev/null) LABEL_FLAG="" if [ -n "$BUG_LABEL" ]; then LABEL_FLAG="--label bug" fi gh issue create \ + --repo gsd-build/get-shit-done \ --title "bug: {concise description from anomaly}" \ $LABEL_FLAG \ --body "{formatted findings from report}" diff --git a/tests/forensics.test.cjs b/tests/forensics.test.cjs index d0caf75a3..a9e14dc69 100644 --- a/tests/forensics.test.cjs +++ b/tests/forensics.test.cjs @@ -138,6 +138,28 @@ describe('forensics workflow', () => { ); }); + test('workflow submits issues to gsd-build/get-shit-done, not the current repo', () => { + const content = fs.readFileSync(workflowPath, 'utf-8'); + // Scope check to the gh issue create invocation — a whole-file search would + // pass even if gh issue create lacked --repo, because gh label list also + // contains the repo string. + assert.match( + content, + /gh issue create[\s\S]{0,250}--repo\s+gsd-build\/get-shit-done/, + 'gh issue create must use --repo gsd-build/get-shit-done to avoid submitting to the user\'s current project repo' + ); + }); + + test('workflow checks bug label in gsd-build/get-shit-done, not the current repo', () => { + const content = fs.readFileSync(workflowPath, 'utf-8'); + // Regex is more robust than a fixed-length slice to formatting changes + assert.match( + content, + /gh label list[\s\S]{0,250}--repo\s+gsd-build\/get-shit-done/, + 'gh label list must target gsd-build/get-shit-done' + ); + }); + test('workflow updates STATE.md', () => { const content = fs.readFileSync(workflowPath, 'utf-8'); assert.ok(