Skip to content

Fix LocalStore with prefix#60

Open
aaron-kaplan wants to merge 3 commits intovirtual-zarr:mainfrom
aaron-kaplan:localstore-bug
Open

Fix LocalStore with prefix#60
aaron-kaplan wants to merge 3 commits intovirtual-zarr:mainfrom
aaron-kaplan:localstore-bug

Conversation

@aaron-kaplan
Copy link

This fixes #59 for me, and doesn't break any existing tests.

I may be getting out over my skis, and don't claim to have understood how everything fits together yet, but here's my current understanding. The word "path" in the context of the ObjectStore API means a string that identifies a file within that ObjectStore, but "path" in the context of a ChunkManifest means a full, absolute URL. In this parser, a single parameter named "path" was taken to be an ObjectStore path in some places and a ChunkManifest path in others. I've resolved that by replacing "path" with "url" or "path_in_store" as appropriate.

Tomorrow I'll try adding a test that demonstrates the bug (and the fix). In the meantime, if someone sees that I'm barking up the wrong tree, please let me know.

Copy link

@TomNicholas TomNicholas left a comment

Choose a reason for hiding this comment

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

Thanks @aaron-kaplan ! I'm not the main developer of this package (@maxrjones is) but this looks correct to me. A test would be great.

@aaron-kaplan
Copy link
Author

Thanks, will work on a test.

At first glance, the CI failures on this PR don't seem to have anything to do with my change. Let me know if there's something I need to address.

@maxrjones
Copy link
Member

Thanks, will work on a test.

At first glance, the CI failures on this PR don't seem to have anything to do with my change. Let me know if there's something I need to address.

Hi @aaron-kaplan, thanks for this PR. The CI failures are unrelated, please ignore them for now - I'll work on fixing them later today and will give this PR a review.

@aaron-kaplan
Copy link
Author

After taking a look at the existing tests, I think the most straightforward way to test this behavior would be to use one of the test files from the dvc directory, but as you know dvc isn't working right now. Could you ping me when it's fixed?

In order to make progress in the meantime, I dropped in one of my own test files and wrote a test using that. I'll change the filename once dvc is working again. I put the test in a commit that precedes the fix, so you can check out the first commit and see it fail, then check out the second and see it pass. If you like to keep all the tests green on every commit, I'm happy to squash them together.

We could consider modifying the existing tests instead of adding a new one. I would argue that it's better practice to use LocalStore with a prefix than to include your entire filesystem hierarchy in it.


def test_local_store_with_prefix():
data_dir = resolve_folder('tests/dvc/github').absolute()
filepath = data_dir / "chirps-v2.0.2025.01.tif"
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
filepath = data_dir / "chirps-v2.0.2025.01.tif"
filepath = data_dir / "test_reference.tif"

This file will work. I added instructions to https://virtual-tiff.readthedocs.io/en/latest/#contributing to authenticate and pull the DVC files, or you can navigate the available files at https://dagshub.com/virtual-zarr/virtual-tiff/src/main/tests/dvc.

Copy link
Member

Choose a reason for hiding this comment

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

FYI @aaron-kaplan the dvc setup should be fixed. I think this PR would be ready for a final check with this code suggestion

@aaron-kaplan aaron-kaplan marked this pull request as ready for review February 12, 2026 15:13
@aaron-kaplan
Copy link
Author

I failed to create an account on dagshub. I tried to authenticate with GitHub, that flow broke halfway through, and now the signup page redirects to /favicon.ico. My stack is several bugs deep at this point, so I'm not inclined to take this up with them. Just FYI.

I did manage to download the file anonymously through the web interface, and confirmed that the test fails before my fix and passes after it.

@maxrjones
Copy link
Member

I failed to create an account on dagshub. I tried to authenticate with GitHub, that flow broke halfway through, and now the signup page redirects to /favicon.ico. My stack is several bugs deep at this point, so I'm not inclined to take this up with them. Just FYI.

I did manage to download the file anonymously through the web interface, and confirmed that the test fails before my fix and passes after it.

Yikes, sorry about this pain! I'll consider an alternative to DagsHub, since I'd like it to be easier for folks to contribute

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.

VirtualTIFF parser doesn't work with obstore.LocalStore with a non-null prefix

3 participants