Skip to content

Store keys hash_prefix/schema_prefix are accepted but not honored by writers or GC #1486

Description

@dimitri-yatsenko

Found during review of #1479 (GC). The per-store config keys hash_prefix, schema_prefix, and filepath_prefix are accepted and validated by settings (Config.get_store_spec_validate_prefix_separation; also listed in storage_adapter.py COMMON_SPEC_KEYS) — but only <filepath@> consumes them, and only as reserved-namespace guards (builtin_codecs/filepath.py: filepath may not write under hash_prefix/schema_prefix; must stay under filepath_prefix).

Neither the hash writer (hash_registry.build_hash_path — fixed _hash/{schema}/... layout, now via the HASH_STORAGE_PREFIX constant) nor the schema-addressed writer (storage.build_object_path{schema}/{table}/{pk}/...) nor GC honors them as relocation knobs.

Why this needs a decision

  • A user who sets stores.x.hash_prefix = "content" expecting relocation gets a validated, silent no-op — misleading config surface.
  • Worse, the trap is loaded: if a future change wires hash_prefix into the writer without teaching GC, hash objects land outside _hash/, get enumerated by the schema-addressed walk, match no schema reference, and are deleted as orphans — data loss. (fix(#1469): codec-driven GC reference discovery + file-level orphan matching #1479 added a comment on HASH_STORAGE_PREFIX flagging exactly this.)

Options

  1. Declare the layout fixed (recommended): document hash_prefix/schema_prefix as what they actually are today — reserved-namespace declarations for <filepath@> cohabitation validation, not relocation settings — and rename or clearly re-document them (e.g. in the object-store-configuration spec).
  2. Wire them through: honor the prefixes in build_hash_path/build_object_path AND in gc.list_stored_hashes/list_schema_paths in the same change, with migration guidance for existing stores. Larger and of unclear demand.

Either way, the current state — validate-and-ignore — should not survive. Related: the <filepath@>-cohabitation GC hazard noted on #1479 (unattributable files) and the fail-safe planned with #1445/#1478.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementIndicates new improvements

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions