* 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 <noreply@anthropic.com> * 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 <noreply@anthropic.com> --------- Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -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}"
|
||||
|
||||
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user