Skip to content

fix(storage): support file resources as relation sources (ENOTDIR) #3067#3089

Open
chethanuk wants to merge 3 commits into
volcengine:mainfrom
chethanuk:fix/issue-3067-file-resource-relation-source
Open

fix(storage): support file resources as relation sources (ENOTDIR) #3067#3089
chethanuk wants to merge 3 commits into
volcengine:mainfrom
chethanuk:fix/issue-3067-file-resource-relation-source

Conversation

@chethanuk

Copy link
Copy Markdown
Contributor

Description

File resources can now be sources for ov link / relations (previously ENOTDIR when source was a file). Directory sources unchanged (byte-identical on-disk format, zero migration).

Related Issue

Fixes #3067

Type of Change

  • Bug fix (non-breaking change that fixes an issue)

Changes Made

  • Added _relation_table_path(source_path, ctx) in viking_fs.py that stats the source and returns <dir>/.relations.json (dirs) or <parent>/.relations/<name>/.relations.json (files)
  • Routed both _read_relation_table and _write_relation_table (and callers link/unlink/get_relation_table) through the helper
  • _write_relation_table now calls _ensure_parent_dirs for sidecar paths
  • Registered .relations in STORAGE_INTERNAL_ENTRY_NAMES + WEBDAV_RESERVED_FILENAMES (internal_names.py) so sidecars are hidden from ls, not vectorized, not exported, not exposed over WebDAV

Testing

  • New tests/storage/test_relation_file_source.py (11 tests):

    • Path-helper coverage for all Source×Target combos + name collision + stat-failure fallback
    • A real end-to-end test that drives the actual VikingFS.link -> persist -> get_relation_table read-back -> unlink path for a file source through an in-memory backend modeling localfs ENOTDIR (a file cannot hold children) — it reproduces the original bug via a control assertion, then proves the sidecar routing makes the link succeed
    • Dir-source link asserted byte-identical (<dir>/.relations.json); .relations asserted registered internal (hidden from ls + WebDAV)
  • Existing relation/link, listing, ovpack, and ingest regression surfaces continue to key on the preserved .relations.json basename (no filter edits needed)

  • Ruff clean

  • I have added tests that prove my fix is effective or that my feature works

  • New and existing unit tests pass locally with my changes

  • I have tested this on the following platforms:

    • Linux

Checklist

  • My code follows the project's coding style
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • My changes generate no new warnings

chethanuk added 3 commits July 8, 2026 22:20
volcengine#3067

- Add _relation_table_path helper + route _read/_write_relation_table
- Register .relations as internal for ls/hide/webdav/ovpack
- Unit tests for path logic covering file vs dir sources (plan §5 rows)
… source

Drives the actual VikingFS.link / get_relation_table / unlink path for a
file source through an in-memory backend that models localfs ENOTDIR
(a file cannot hold children), so the test both reproduces the original
bug and proves the sidecar routing fixes it. Also asserts the dir-source
path stays byte-identical and .relations is registered internal.

refs volcengine#3067
…tring

The _write_relation_table parent-dir guard used `"/.relations/" in table_path`,
which assumes source_path is rooted/absolute and would misfire for any dir whose
own path contains a .relations segment. Compare table_path against the computed
legacy dir-source form (<dir>/.relations.json) instead — correct regardless of
whether the path is rooted, and behavior-identical for all real (rooted) inputs.

refs volcengine#3067
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Backlog

Development

Successfully merging this pull request may close these issues.

[Bug]: File resources cannot be relation sources (ov link returns "Not a directory (os error 20)")

1 participant