fix(test): prevent nil panic and index out of range in TestFile - #30
Merged
kael-reviewer[bot] merged 1 commit intoApr 17, 2026
Conversation
kael-reviewer
Bot
deleted the
fix/task-29-prevent-nil-panic-index-out-of-range-testfile
branch
April 17, 2026 08:34
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes four root causes of panics in
TestFile(doclite/files_test.go):Findresult before accessing fields; skipped invalid entries.len(nodes)instead ofnumOfInsert, so loops only cover successfully-found entries.Cachethat was disconnected from the btree's root structure. Deletions now usedb.rootTree.Deletedirectly.os.Removecalls to the start oftestFile(beforeOpenDB) so each iteration starts with a clean state instead of reading leftover data from a previous run.Changes
doclite/files_test.go— All four fixes applied (17 insertions, 14 deletions).Verification
go build ./...— ✅ passgo test ./doclite/— ✅ pass (includingTestFileacross all 33 iterations)Acceptance Criteria
go test ./doclite/ -run TestFilecompletes with exit code 0len(nodes)instead of assumed count