Skip to content

Update aiusechat read_dir tests for typed entry output#3007

Merged
sawka merged 2 commits intomainfrom
copilot/fix-read-dir-test-failures
Mar 7, 2026
Merged

Update aiusechat read_dir tests for typed entry output#3007
sawka merged 2 commits intomainfrom
copilot/fix-read-dir-test-failures

Conversation

Copy link
Contributor

Copilot AI commented Mar 7, 2026

pkg/aiusechat/tools_readdir_test.go was still asserting the old entries payload shape after read_dir moved to returning typed directory entries. This caused the pkg/aiusechat test failures even though the tool behavior itself was already correct.

  • Align test expectations with current callback output

    • Update TestReadDirCallback to treat entries as []fileutil.DirEntryOut
    • Assert directory/file classification via the Dir field instead of map lookups
  • Fix truncation/sorting coverage

    • Update TestReadDirSortBeforeTruncate to validate the typed slice returned by readDirCallback
    • Preserve the existing intent of the test: directories should still be sorted ahead of files before truncation
  • Keep scope limited to stale tests

    • No changes to read_dir implementation or output contract
    • Only the broken test assumptions were corrected
entries, ok := resultMap["entries"].([]fileutil.DirEntryOut)
if !ok {
    t.Fatalf("entries is not a slice of DirEntryOut")
}

for _, entry := range entries {
    if entry.Dir {
        // directory assertions
    }
}

✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Co-authored-by: sawka <2722291+sawka@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix test failures in tools_readdir_test.go Update aiusechat read_dir tests for typed entry output Mar 7, 2026
Copilot finished work on behalf of sawka March 7, 2026 01:07
@sawka sawka marked this pull request as ready for review March 7, 2026 01:09
@sawka sawka merged commit 56c1829 into main Mar 7, 2026
6 checks passed
@sawka sawka deleted the copilot/fix-read-dir-test-failures branch March 7, 2026 01:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants