Skip to main content
← Back to list
01Issue
BugShippedSwamp CLIPublic
Assigneesstack72

Relationships

#3301 Datastore rework: on v3, namespace set before setup --format 3 fails without --skip-migration, and namespace list shows no namespaces

Opened by stack72 · 10/12/2026· Shipped 10/12/2026

Background (read this first)

swamp is reworking its datastore layer (tracking: swamp-club#2865). The new format, v3, records every change as a commit in a single-writer SQLite commits.db. Content is stored as chunks, and each checkout's local files and _catalog_v3.db are rebuilt from the commits by a read model that catches up when a context opens.

swamp-club#3279 made v3 usable for new, empty filesystem datastores with a single writer, through swamp datastore setup filesystem --path <dir> --format 3. It's released from 20261012.143252.0-sha.cc63f3a8. The design is in design/enablers/datastores.md, under the "v3 …" sections and the opt-in section.

Facts about v3 that this issue depends on:

  • Repositories still write local files, and also stage typed changes into a commit-log unit. A commit lands when the unit ends.
  • withUnitOfWork (src/libswamp/unit_of_work.ts) ends a v3 unit by decision 5:
    • it commits on completed, suspended, cancelled and a reported error;
    • it abandons on a throw or an early stop.
  • A second checkout joins as a git clone does: the same .swamp.yaml and repo id, and a fresh .swamp/. Its first command catches up.
  • v2 must not change. Any shared code path needs the v2 gate that #3240, #3250 and #3279 used: v2 suites unedited, and a whole-suite route recorder that's identical before and after.

Found by swamp-uat#619's filesystem-v3 backend (PR swamp-uat#623). That suite fails on this bug today, on purpose.

The bugs

1. Following swamp's own advice for a namespaced v3 datastore makes setup fail.

On v3, swamp datastore namespace set is refused, and its message says to set the namespace before setup --format 3. Doing exactly that, namespace set team on a fresh repo and then swamp datastore setup filesystem --path <empty dir> --format 3, fails with:

The current datastore at …/.swamp/team is not accessible … holds no datastore data

It only works with --skip-migration. swamp-uat#623's helper adds that flag so the namespaced suites can run. Its journey test leaves it out, and it fails: "swamp datastore namespace set before swamp datastore setup filesystem --format 3 creates a namespaced v3 datastore".

Likely cause. namespace set points the current datastore at the namespaced local path (.swamp/<namespace>). That directory doesn't exist on a fresh repo, so v3 setup's source checks treat it as an inaccessible current datastore (src/libswamp/datastores/setup.ts, the v3 branch around setupV3Filesystem, and the source and records checks that --skip-migration bypasses). Confirm this by tracing.

2. swamp datastore namespace list shows namespaces: [] on a namespaced v3 repo, even though currentNamespace is set. It fails swamp-uat#623's "namespace list --json validates against NamespaceListSchema [filesystem-v3]".

Likely cause. namespace list reads v2's namespace registry. On v3, namespaces exist as a column in commits.db (one database per datastore, swamp-club#3236), and nothing lists them.

Goal

The documented route works: namespace set, then setup --format 3, creates a namespaced v3 datastore with no --skip-migration. And namespace list reports v3 namespaces correctly.

Design

  1. Setup. A namespace set before v3 setup is an expected starting state, not an inaccessible datastore. Make v3 setup accept a fresh repo whose current datastore is the namespaced local path with nothing in it. Keep refusing a repo that really holds records, as #3279 requires. Don't weaken the records check for v2 setup.
  2. namespace list on v3:
    • list the datastore's namespaces from the commit store: the distinct namespace values in commits.db, plus the current namespace if nothing has been committed yet;
    • keep NamespaceListSchema's shape;
    • leave v2's listing unchanged.
  3. The refusal message. If any other namespace command's v3 message is misleading, fix it too, and keep each --json shape.
  4. v2 doesn't change. Run the v2 gate.

Tests

  • In-process, on a v3 filesystem datastore:
    • namespace set, then v3 setup, succeeds with no --skip-migration, and the datastore is namespaced;
    • a repo with records is still refused.
  • namespace list on v3: an unnamespaced datastore, a namespaced one before any commit, and one after commits. Validate it against NamespaceListSchema.
  • The v2 gate.
  • When this ships, swamp-uat#623's two namespace tests must pass against the release.

Out of scope

  • managedConfig and config migrate on v3 (a parallel issue).
  • Sharing several namespaces across repos on one v3 datastore (hasSharedNamespaces; v3 refuses that today).

Blocked by: nothing. It runs in parallel with the v3 SIGTERM and v3 managedConfig issues.

02Bog Flow
✓OPEN✓TRIAGED✓IN PROGRESS✓SHIPPED+ 1 MOREASSIGNED+ 9 MOREREVIEW+ 9 MOREPR_LINKED+ 2 MORESESSION_SUMMARIZED

Shipped

10/12/2026, 6:20:07 PM

Click a lifecycle step above to view its details.

03Sludge Pulse
stack72 assigned stack7210/12/2026, 5:00:43 PM

Sign in to post a ripple.