Skip to content

tests: missed piecereader test - #859

Merged
LexLuthr merged 2 commits into
mainfrom
misc/cached_pr_tests
Feb 13, 2026
Merged

tests: missed piecereader test#859
LexLuthr merged 2 commits into
mainfrom
misc/cached_pr_tests

Conversation

@magik6k

@magik6k magik6k commented Jan 3, 2026

Copy link
Copy Markdown
Collaborator

Used this to repro the recent piecereader issues but apparently didn't commit with that PR.

Still should be useful as it covers the existing logic pretty comprehensively so any future changes/optimizations will also benefit.


Note

Introduces a full test suite for pieceReader to validate correctness and performance across common and edge scenarios.

  • Covers Read, Seek, and ReadAt semantics, including position tracking and EOF/partial reads
  • Verifies LRU caching behavior for small reads, header caching at offset 0, and read-ahead
  • Tests "burn bytes" optimization vs. new reader creation on seeks (forward/backward)
  • Ensures thread safety with concurrent Read/Seek and ReadAt operations
  • Exercises error handling from getReader, reader reinitialization, and close/double-close cases
  • Adds benchmarks for sequential and random access patterns

Written by Cursor Bugbot for commit 2aa19ea. This will update automatically on new commits. Configure here.

@magik6k
magik6k requested a review from a team as a code owner January 3, 2026 23:02

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR is being reviewed by Cursor Bugbot

Details

You are on the Bugbot Free tier. On this plan, Bugbot will review limited PRs each billing cycle.

To receive Bugbot reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.

Comment thread lib/pieceprovider/cached_piecereader_test.go
@LexLuthr

LexLuthr commented Jan 6, 2026

Copy link
Copy Markdown
Collaborator

@magik6k Need to fix lint with defer in a func. Rest is good.

@LexLuthr

Copy link
Copy Markdown
Collaborator

@magik6k Can you please fix the lint so we can merge this?

@LexLuthr
LexLuthr merged commit 67b1fc4 into main Feb 13, 2026
23 of 25 checks passed
@LexLuthr
LexLuthr deleted the misc/cached_pr_tests branch February 13, 2026 08:26
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