Skip to content

feat: support directory references in <filepath@store> (fixes #1410)#1415

Open
dimitri-yatsenko wants to merge 2 commits intomasterfrom
fix/1410-filepath-directory-support
Open

feat: support directory references in <filepath@store> (fixes #1410)#1415
dimitri-yatsenko wants to merge 2 commits intomasterfrom
fix/1410-filepath-directory-support

Conversation

@dimitri-yatsenko
Copy link
Copy Markdown
Member

Summary

Fixes #1410.

<filepath@store> only supported individual files. is_dir was hardcoded to False and StorageBackend.exists() used Path.is_file(), so directory paths always failed the existence check.

Four targeted changes:

  1. storage.pyStorageBackend.exists() now uses Path.exists() (accepts both files and dirs); new isdir() method added for local and fsspec backends.
  2. filepath.pyFilepathCodec.encode() calls backend.isdir(path) to detect directories dynamically; size is None for directories.
  3. objectref.py_verify_folder() returns True (unverified-but-valid) when no manifest file is present, instead of raising IntegrityError. Directories stored without a manifest are accepted gracefully.

Test plan

  • Insert a row with a <filepath@store> column pointing to a directory; confirm is_dir=True is stored
  • Fetch the row back; confirm ObjectRef is returned with is_dir=True
  • Confirm existing file-path tests are unaffected
  • Run pixi run test -k filepath

🤖 Generated with Claude Code

dimitri-yatsenko and others added 2 commits March 27, 2026 14:16
Previously is_dir was hardcoded to False in FilepathCodec.encode(),
and StorageBackend.exists() used Path.is_file() which returned False
for directories. Together these caused directory paths to fail the
existence check and never set is_dir correctly.

Changes:
- storage.py: StorageBackend.exists() now uses Path.exists() so
  directories pass the check; add isdir() method for both local
  and remote (fsspec) backends.
- filepath.py: encode() calls backend.isdir() to detect directories
  dynamically; size is set to None for directories.
- objectref.py: _verify_folder() returns True (unverified-but-valid)
  when no manifest is present, rather than raising IntegrityError.
  Directories stored without a manifest are accepted.

Co-Authored-By: Claude Sonnet 4.6 (1M context) <[email protected]>
Two tests that mock the storage backend were not setting
mock_backend.isdir.return_value = False. The new encode() logic
calls backend.isdir() before backend.size(), so without the mock
isdir() returned a truthy MagicMock, making is_dir=True and
skipping the size() call entirely (leaving size=None).

Co-Authored-By: Claude Sonnet 4.6 (1M context) <[email protected]>
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.

Support directory references in <filepath@store>

1 participant