Skip to main content
← Back to list
01Issue
BugOpenSwamp CLIPublic
AssigneesNone

Relationships

#2382 model delete resolves auto-definitions from repo-local .swamp instead of the datastore cache

Opened by stack72 · 9/22/2026

Summary

swamp model delete (src/cli/commands/model_delete.ts ~141-146) calls createModelDeleteDeps(repoDir, datastoreResolver, undefined, repoContext.markDirty) without injecting a definition repository. createModelDeleteDeps (src/libswamp/models/delete.ts ~124-131) then builds new YamlDefinitionRepository(repoDir, undefined, undefined, undefined, markDirty), whose auto-definitions dir defaults to the repo-local .swamp/auto-definitions.

Everywhere else, the repository factory resolves auto-definitions through the datastore path resolver (src/infrastructure/persistence/repository_factory.ts ~444-454: 'Auto-definitions are datastore-tier'), so with a remote datastore they live in the cache (~/.swamp/repos/<repoId>/[<namespace>/]auto-definitions).

Impact

With a remote datastore, deleting an auto-definition-backed model does not find or remove its auto-definition in the cache, so the definition is not deleted locally or remotely and the model can reappear.

Suggested fix

Pass repoContext.definitionRepo (or a repo built via the factory with the datastore auto-definitions dir) as injectedDefinitionRepo, and cover it with a test using a datastore resolver pointing at a separate cache dir.

Found while triaging swamp-club#2353.

02Bog Flow
◉OPEN○TRIAGED○IN PROGRESS○SHIPPED

Open

9/22/2026, 10:26:53 PM

No activity in this phase yet.

03Sludge Pulse

Sign in to post a ripple.