Skip to content

feat(acfs): add a limit to list - #27

Closed
neurekadev wants to merge 1 commit into
getarcaneapp:mainfrom
neurekadev:feat/26-acfs-list-limit
Closed

neurekadev wants to merge 1 commit into
getarcaneapp:mainfrom
neurekadev:feat/26-acfs-list-limit

Conversation

@neurekadev

Copy link
Copy Markdown
Contributor

Adds an optional --limit N to acfs list, so a caller that caps a folder also caps the helper's work.

Changes

  • acfs list --limit N emits at most N entries in name order. When entries were left out, the response is {"entries":[...],"truncated":true,"version":2}.
  • New Root.ListEachBounded and Root.ListBounded take types.ListOptions{Limit} and return types.ListResult{Count, Truncated}. ListEach and List keep their signatures and now wrap these.
  • Names are still read and sorted, which the ordering needs, but only the emitted entries and one more (to report truncation) are lstated. The temporary output holds at most N entries.
  • Without --limit (or with 0), the output is byte-identical, so ProtocolVersion stays at 2. types.ListResponse gains Truncated with omitempty.

Measurements

One folder with 200,000 empty files, local build:

Time Output
acfs list ~925 ms 38.6 MB
acfs list --limit 10000 ~425 ms 1.9 MB

What's left is reading and sorting the names.

Checks

just format go --check, golangci-lint run for acfs, and go test -race ./... in acfs pass. Extended TestListBounded and TestListLimit cover truncation, a limit equal to the count, reserved temporary names, and negative limits.

Closes #26


Drafted with Claude Code (Claude Opus 5.5).

`acfs list --limit N` and the new Root.ListEachBounded and Root.ListBounded
stop after N entries. Names are still read and sorted for the order, but
only the emitted entries and one more are inspected, so the helper's
temporary output and stat calls are bounded by the caller's cap instead of
the folder size. A limited response adds "truncated":true when entries were
left out.

Without --limit the output is byte-identical, so the protocol stays at
version 2. ListEach and List keep their signatures.
@neurekadev

Copy link
Copy Markdown
Contributor Author

🔍 Code Review

PR #27 · e2943ae..7a30cb6 · 6 files · ✅ No findings

Critical: 0 High: 0 Medium: 0 Low: 0 Informational: 0

🤖 Claude Opus 5.5 (High) · T3 Code (Claude Code) · Round 1 of 3

@neurekadev
neurekadev marked this pull request as ready for review November 8, 2026 18:17
@neurekadev
neurekadev requested a review from a team as a code owner November 8, 2026 18:17
@kmendell

kmendell commented Nov 9, 2026

Copy link
Copy Markdown
Member

56634e5

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.

acfs: add a limit to list so callers can cap large folders in the helper

2 participants