Skip to content

[Paper/M1][P0] Pin Mega namespace bindings across native scopes and import repositories #55

Description

@Ivanbeethoven

Parent research epic: #39
Related: #42 (snapshot read adapter), #43 (CAS identity), #44 (refresh), #51 (shared lower), #53 (Libra/Orion).

Problem

The current SnapshotId draft assumes one repository/commit/tree can describe a mounted monorepo subtree. Mega's namespace can cross native scopes, import repositories, and intermediate directories. Fixed blob OIDs alone do not freeze path ownership or import revisions.

This issue tracks the missing namespace contract. It precedes the composite-view portion of #42; single-source fake-backend work in #42 and M0 work can proceed in parallel.

Verified baseline (2026-09-06)

Mega: c4c79bc195541a13ac1505b94728c81a8ff3d603; ScorpioFS: 6a2e7f2ddb7d913b497167f76ff6539bfbb983c2. These are upstream source checks, not a claim about the running deployment.

  1. Native refs have (path, ref_name) scope. A child-scope commit tree is not rooted at monorepo /: mega_refs, parent tree/ref updates.
  2. REST routing uses the configured import directory and registered repository boundaries: api_handler.
  3. Native tree reads already accept commit/tag selectors, but import get_root_tree ignores refs and reads the default ref: native, import.
  4. Import attach constructs placeholder path trees rather than embedding the complete import content into the native root: receive-pack handler.
  5. /file/tree?path=...&oid=... checks a current path tree against an optional OID; it is not historical tree lookup: tree_ops.

Proposed contract (draft, policy decisions pending)

  • SourceSnapshot: instance/source/repo identity, commit OID, tree OID, object format, explicit scope_path.
  • NamespaceView: native snapshot + immutable path-to-source bindings index + explicit candidate overrides + materialization policy.
  • view_id: immutable descriptor identity; projection_key: content/routing identity for sharing; workspace generation, delta_seq, and server publication_seq have separate semantics.
  • Ordinary native directories derive from one selected native root. Independent native scope commits are explicit scoped selections, not silently mixed global revisions.
  • Import directories resolve a selected commit/tree once. Intermediate directory listings and repository boundaries are frozen by the view.
  • Versioned import paths still pin content OIDs. Names such as 1.3.0 do not prove content immutability.
  • CL views record base namespace view, scope, base/head commit and delta digest. A moved CL creates a new candidate identity.
  • Scale the bindings index incrementally; no full registry enumeration on each mount.

Work

Mega-side implementation is a cross-repository dependency to scope separately. This issue does not claim those changes have been implemented or approved for deployment.

Acceptance

  • Native A/B and import A/B can coexist; old workspaces keep their exact trees after branch movement.
  • Root commit and child-scope commit resolve the same intended child contents without duplicated path prefixes.
  • Adding or removing an import does not change old view directory listings/routing.
  • Concurrent native/import updates expose only a valid published combination; explicit client composition is labeled as such.
  • Version-number directory replacement, if allowed by policy, preserves old snapshot readability.
  • Different commits with equal visible content retain provenance while sharing eligible caches.
  • Historical root with missing routing catalog returns HISTORICAL_BINDINGS_UNAVAILABLE.
  • A public independent tree oracle covers native, imported, intermediate and CL views.
  • Large-registry/small-working-set test proves mount avoids an O(all repositories) scan.

Decisions requiring owner confirmation

  1. Recommend Mega-published composite views; alternative is source-only first, with full-namespace consistency deferred.
  2. Recommend immutable published version-number paths; alternative permits replacement with retained historical objects.
  3. Recommend existing tasks stay pinned and existing mounts update at controlled pause/restart boundaries; transparent live refresh needs a separate handle/mmap/cwd protocol.

Draft specs have been prepared locally on codex/system-paper-spec: docs/spec/monorepo-versioning.md and docs/spec/system-paper-spec.md. They are not yet published on the default branch. The questions above remain pending; recommendations are not recorded as accepted decisions.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions