Skip to content

Conversation

@bplatz
Copy link
Contributor

@bplatz bplatz commented Aug 11, 2025

Standardize branch naming to ledger:branch; reserve @ for time travel

Summary

Standardizes branch naming to ledger:branch, removes branch segments from content‑addressed paths, and scopes nameservice records by branch. Consolidates branch handling and reserves @ for time travel (PR #1088).

Motivation

  • Support upcoming branching features with a consistent, parseable ledger:branch format.
  • Keep ledger names URL‑safe so ledgers can be used as full IRIs when hosted.
  • Reserve @ exclusively for time travel to align with forthcoming query semantics.
  • Streamline branch handling across db, ledger objects for more consistency

Key Changes

  • Branch format
    • ledger-name:branch-name (e.g., my-ledger:main)
    • : reserved from ledger names; @ reserved for time travel (e.g., my-ledger:main@t:42)
    • Branch names disallow / to avoid unintended subdirectories
  • Paths
    • Content‑addressed artifacts (commit/txn/index) no longer include branch
      • Example: /my-ledger/commit/[hash].json (deduped across branches)
    • Nameservice files are per‑branch subfiles
      • Example: /ns@v1/my-ledger/main.json (supports ledger names with /)
  • API and internals
    • fluree.db.api/create rejects : in ledger names (:db/invalid-ledger-name)
    • New fluree.db.util.ledger with ledger-base-name, ledger-branch, ledger-parts
    • Removed redundant branch tracking from Ledger; fixed circular deps
    • Commit storage now uses ledger-name (not alias)

Impact

  • Ledger names cannot contain :
  • Branch names cannot contain /
  • External tools relying on branch-in-path or old nameservice locations must update
  • No data re-encoding; hashes remain stable and deduplicated

Testing

  • New/updated tests for name validation, nameservice layout, and path conventions
  • All tests passing; no lint warnings

Related Work

  • Builds on time travel proposal in PR #1088, which adds @-based query time travel:
    • Supports @t:<tx>, @iso:<timestamp>, @sha:<commit>, works with ledger:branch
    • @ takes precedence over legacy ?t=...; supports git‑style SHA prefixes

@bplatz bplatz self-assigned this Aug 11, 2025
@bplatz bplatz requested a review from a team August 11, 2025 21:56
@bplatz bplatz force-pushed the refactor/consistent-branch-naming branch from fa79e4c to 23609e1 Compare August 12, 2025 17:13
@bplatz bplatz marked this pull request as ready for review August 26, 2025 20:24
Copy link
Contributor

@zonotope zonotope left a comment

Choose a reason for hiding this comment

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

🍶

@bplatz bplatz force-pushed the refactor/consistent-branch-naming branch from 6b242ac to c50e384 Compare September 9, 2025 10:42
@bplatz bplatz merged commit 5697acd into main Sep 16, 2025
10 checks passed
@bplatz bplatz deleted the refactor/consistent-branch-naming branch September 16, 2025 10:43
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.

4 participants