Bug: test_gaming_check hardcoded index 11 doesn't match Ruby skip pattern (now at index 13)
File
internal/agent/test_gaming_check.go line 218-220
Problem
The Ruby skip directive guard uses a hardcoded index 11 to skip the Ruby ^\s*skip\b regex for non-.rb files. But the skipDirectiveRegexes array actually has 14 elements (indices 0-13), with the Ruby pattern at index 13, not 11.
// countSkipDirectives, line 218-220:
for i, re := range skipDirectiveRegexes {
// skipDirectiveRegexes index 11 is the Ruby `^\s*skip\b` pattern.
if i == 11 && ext != ".rb" {
continue
}
The actual array layout (0-indexed):
[0] t.Skip(f)?
[1] pytest.skip
[2] @pytest.mark.skip
[3] self.skipTest
[4] unittest.skip
[5] @unittest.skip
[6] @pytest.mark.xfail
[7] (it|test|describe).skip
[8] xit
[9] xdescribe
[10] @Ignore
[11] @Disabled ← this is what index 11 actually points to
[12] Assume.assumeFalse
[13] skip (Ruby) ← actual Ruby pattern
Impact
-
Ruby skip guard is broken: index 11 now protects @Disabled (a Java/Kotlin pattern) from being applied to non-.rb files, which is meaningless — @Disabled never matches in Go/Python anyway.
-
Ruby skip causes false positives: The Ruby ^\s*skip\b regex at index 13 is not guarded for non-.rb files. Any Go code with skip := true, skip = false, or if skip { in a test file triggers a false positive skip directive warning.
-
Fragile design: The hardcoded index approach means any future addition to the array silently shifts the index, breaking the guard with no compiler protection.
Trigger Scenario
A Go test file containing:
func TestFoo(t *testing.T) {
skip := shouldSkip()
if skip {
t.Skip()
}
// ...
}
The line skip := shouldSkip() matches ^\s*skip\b (Ruby pattern). Since index 13 != 11, the guard doesn't fire, and this is counted as a skip directive — producing a false positive test-gaming warning.
Fix
Replace the hardcoded index with a type-safe approach:
// Option A: Check the pattern source
if strings.Contains(re.String(), `^\s*skip\b`) && ext != ".rb" {
continue
}
// Option B: Separate Ruby patterns into a different slice
Severity
Medium — produces false positives on Go test files using skip as a variable name, which is common and idiomatic Go.
Verification
Independently verified by sub-agent (sa-69). Array contains 14 elements; Ruby pattern is at index 13, not 11.
Bug: test_gaming_check hardcoded index 11 doesn't match Ruby skip pattern (now at index 13)
File
internal/agent/test_gaming_check.goline 218-220Problem
The Ruby skip directive guard uses a hardcoded index
11to skip the Ruby^\s*skip\bregex for non-.rbfiles. But theskipDirectiveRegexesarray actually has 14 elements (indices 0-13), with the Ruby pattern at index 13, not 11.The actual array layout (0-indexed):
Impact
Ruby skip guard is broken: index 11 now protects
@Disabled(a Java/Kotlin pattern) from being applied to non-.rbfiles, which is meaningless —@Disablednever matches in Go/Python anyway.Ruby skip causes false positives: The Ruby
^\s*skip\bregex at index 13 is not guarded for non-.rbfiles. Any Go code withskip := true,skip = false, orif skip {in a test file triggers a false positive skip directive warning.Fragile design: The hardcoded index approach means any future addition to the array silently shifts the index, breaking the guard with no compiler protection.
Trigger Scenario
A Go test file containing:
The line
skip := shouldSkip()matches^\s*skip\b(Ruby pattern). Since index 13 != 11, the guard doesn't fire, and this is counted as a skip directive — producing a false positive test-gaming warning.Fix
Replace the hardcoded index with a type-safe approach:
Severity
Medium — produces false positives on Go test files using
skipas a variable name, which is common and idiomatic Go.Verification
Independently verified by sub-agent (sa-69). Array contains 14 elements; Ruby pattern is at index 13, not 11.