fix(store): exact match for DAG name lookup in listRoot (#1490)
Some checks failed
CI / Check for spelling errors (push) Has been cancelled
CI / Go Linter (push) Has been cancelled
CI / Test on ${{ matrix.os }} (ubuntu-latest) (push) Has been cancelled

* **Bug Fixes**
* Fixed filtering logic for DAG runs to require exact name matching
instead of substring matching, refining which results are returned when
filtering is applied.
This commit is contained in:
Yota Hamada 2025-12-17 00:33:57 +09:00 committed by GitHub
parent c72623154d
commit eef457b4c2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 17 additions and 1 deletions

View File

@ -500,7 +500,7 @@ func (store *Store) listRoot(_ context.Context, include string) ([]DataRoot, err
var roots []DataRoot var roots []DataRoot
for _, dir := range rootDirs { for _, dir := range rootDirs {
if include != "" && !strings.Contains(dir, include) { if include != "" && dir != include {
continue continue
} }
if fileutil.IsDir(filepath.Join(store.baseDir, dir)) { if fileutil.IsDir(filepath.Join(store.baseDir, dir)) {

View File

@ -314,6 +314,22 @@ func TestListRoot(t *testing.T) {
} }
} }
// TestListRootExactMatch verifies that listRoot does exact matching, not substring matching.
// Regression test for issue #1473.
func TestListRootExactMatch(t *testing.T) {
t.Parallel()
tmpDir := t.TempDir()
require.NoError(t, os.MkdirAll(filepath.Join(tmpDir, "go"), 0750))
require.NoError(t, os.MkdirAll(filepath.Join(tmpDir, "go_fasthttp"), 0750))
store := &Store{baseDir: tmpDir}
roots, err := store.listRoot(context.Background(), "go")
require.NoError(t, err)
require.Len(t, roots, 1, "should only match 'go', not 'go_fasthttp'")
assert.Equal(t, "go", roots[0].prefix)
}
func TestListRootEmptyDirectory(t *testing.T) { func TestListRootEmptyDirectory(t *testing.T) {
t.Parallel() t.Parallel()