Summary
brief diff can omit languages and tools that are present in the full report when the relevant changed file uses an uppercase extension or matches a recursive ** knowledge-base pattern at more than one directory level.
Examples include R files matched by *.R or **/*.R and Ruby native extensions matched by ext/**/extconf.rb.
Reproduction
In a Git repository with a baseline commit, add these files without committing them:
analysis/nested/model.R
ext/pkg/sub/extconf.rb
Example contents:
require "mkmf"
create_makefile("example")
Compare:
brief --json .
brief diff --json HEAD
The full scan detects R and mkmf. The diff report omits R and mkmf even though both detections are relevant to changed files.
Root cause
There are two problems in detect/filter.go:
- Changed extensions are stored in lowercase, but extensions extracted from knowledge patterns are looked up without normalization:
ext := pattern[idx+1:]
if changedExts[ext] {
return true
}
For *.R, the lookup uses .R, while changedExts contains .r.
- The fallback uses
filepath.Match:
if matched, _ := filepath.Match(pattern, f); matched {
return true
}
Go's filepath.Match does not give ** recursive semantics. A pattern such as ext/**/extconf.rb may match one intermediate segment accidentally, but it does not match deeper paths such as ext/pkg/sub/extconf.rb.
The detection engine already has matchPathPattern, which supports ** across path segments and is used elsewhere in the same filter implementation.
Expected behavior
brief diff should use the same path-pattern semantics as full detection and should handle extension comparisons consistently, regardless of extension case.
Proposed implementation
Normalize the extracted extension:
if changedExts[strings.ToLower(ext)] {
return true
}
Replace the filepath.Match fallback with the existing matcher:
if matchPathPattern(pattern, f) {
return true
}
Suggested tests
- Keep R in a diff report for a changed multi-level path ending in
.R.
- Keep R Markdown for a changed multi-level path ending in
.Rmd.
- Keep mkmf for
ext/pkg/sub/extconf.rb.
- Verify ordinary non-recursive patterns retain their existing behavior.
Summary
brief diffcan omit languages and tools that are present in the full report when the relevant changed file uses an uppercase extension or matches a recursive**knowledge-base pattern at more than one directory level.Examples include R files matched by
*.Ror**/*.Rand Ruby native extensions matched byext/**/extconf.rb.Reproduction
In a Git repository with a baseline commit, add these files without committing them:
Example contents:
Compare:
brief --json . brief diff --json HEADThe full scan detects R and mkmf. The diff report omits R and mkmf even though both detections are relevant to changed files.
Root cause
There are two problems in
detect/filter.go:For
*.R, the lookup uses.R, whilechangedExtscontains.r.filepath.Match:Go's
filepath.Matchdoes not give**recursive semantics. A pattern such asext/**/extconf.rbmay match one intermediate segment accidentally, but it does not match deeper paths such asext/pkg/sub/extconf.rb.The detection engine already has
matchPathPattern, which supports**across path segments and is used elsewhere in the same filter implementation.Expected behavior
brief diffshould use the same path-pattern semantics as full detection and should handle extension comparisons consistently, regardless of extension case.Proposed implementation
Normalize the extracted extension:
Replace the
filepath.Matchfallback with the existing matcher:Suggested tests
.R..Rmd.ext/pkg/sub/extconf.rb.