Skip to content

localstore: find files when the base path is . - #64

Merged
sduchesneau merged 1 commit into
streamingfast:developfrom
pinax-network:fix/localstore-relative-base-path
Nov 13, 2026
Merged

sduchesneau merged 1 commit into
streamingfast:developfrom
pinax-network:fix/localstore-relative-base-path

Conversation

@matthewdarwin

Copy link
Copy Markdown
Contributor

Fixes streamingfast/firehose-core#56.

Problem

A local store opened with the base path . finds no files. firecore tools check merged-blocks . reports an empty range and "🆗 No hole found" on a store that does have files and holes. The same command run against the full path, or ../merged-blocks, works.

Cause: walk filters on s.basePath + "/", which is ./ for this store. filepath.Walk(".") reports 0000000100.dbin.zst, not ./0000000100.dbin.zst, so the strings.HasPrefix(infoPath, fullPath) check skips every file. Walk, WalkFrom, ListFiles and WalkAttributes all return nothing.

Change

newLocalStoreContext resolves the base path with filepath.Abs instead of filepath.Clean. Abs also cleans the path, and it puts every relative base path in the form the walk already handles. BaseURL() and ObjectURL() are unchanged, because they keep using the URL as given. ObjectPath() now returns an absolute path for stores opened with a relative base path.

Tests

  • New TestNewLocalStore_CurrentDirectory: chdirs into a temp dir and checks Walk, WalkFrom and OpenObject on a store opened at .. It fails before this change.
  • go test ./... passes.
  • End to end: I built firecore (firehose-core develop) with this branch and ran tools check merged-blocks . -r 0:700 on a store with a hole at 300–499. It now prints both ranges, ❌ Range [#300, #499] (Missing, [300:500]) and "🆘 Holes found!". Before, it printed ✅ Range [#0, #0] and "🆗 No hole found".

🤖 Generated with Claude Code

With a base path of `.`, walk filtered on the `./` prefix, but
filepath.Walk(".") reports `file` and not `./file`, so every file was
skipped and Walk, WalkFrom and the listings returned nothing. Resolve the
base path to an absolute path when the store is created.

Fixes streamingfast/firehose-core#56 (`firecore tools check merged-blocks .`).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@sduchesneau
sduchesneau merged commit b1a065e into streamingfast:develop Nov 13, 2026
3 checks passed
sduchesneau pushed a commit to streamingfast/firehose-core that referenced this pull request Nov 13, 2026
Picks up streamingfast/dstore#64, so `firecore tools check merged-blocks .`
reads the files of the current directory instead of reporting an empty
range and "No hole found".

Fixes #56

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.

fireeth tools check merged-blocks . does nothing

2 participants