fix(core): fail directory listing on out-of-range offset - #46159
Open
ukarpenkov wants to merge 1 commit into
Open
fix(core): fail directory listing on out-of-range offset#46159ukarpenkov wants to merge 1 commit into
ukarpenkov wants to merge 1 commit into
Conversation
Directory read pagination returned an empty success page when offset passed the last entry, so the model could not tell a short listing from a bad offset. Fail with OffsetOutOfRangeError like text reads already do.
Contributor
|
The following comment was made by an LLM, it may be inaccurate: Based on my search, I found one related PR that may be worth reviewing alongside the current PR: Related PR:
The current PR (#46159) is the only one directly addressing the out-of-range offset error for directory listings, but PR #45195 is related work in the same area that should be cross-checked for consistency. |
Contributor
|
Thanks for updating your PR! It now meets our contributing guidelines. 👍 |
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.
Issue for this PR
Closes #45928
Type of change
What does this PR do?
Directory
readwith an offset past the last entry returned{ entries: [], truncated: false }. That looks like a short/empty listing, so the model cannot tell the offset was wrong.list()now fails withOffsetOutOfRangeErrorwhen the page is empty and offset is not 1, same as text-file pagination. Empty directories at offset 1 still succeed. The tool also forwards that error message to the model instead of a generic "Unable to read".How did you verify your code works?
Ran in
packages/core:bun test test/tool-read-filesystem.test.ts test/tool-read.test.tsbun typecheckAlso covered: offset 100 on a small directory fails; offset 1 on an empty directory still returns an empty page.
Screenshots / recordings
If this is a UI change, please include a screenshot or recording.
Checklist