Relationships
#4502 Rename a behavior type (e.g. move it to another namespace) without losing its data
Opened by liywjl · 11/7/2026
Problem
After my username rename (#4500), my repo's 12 local behaviors had to move from @williamjtlacroix/es-* to @liywjl/es-*. There's no command for that, and the type is part of where data lives:
- data is stored under
.swamp/data/<type>/<definitionId>/, outputs under.swamp/outputs/<type>/, and the data catalog keys every row by type; swamp data renamerenames a data item inside a behavior, andswamp repo upgradedoesn't touch types;- changing only the type string in the extension and definitions would leave about 400 MB of history under the old type's folders.
What I did by hand:
- Stopped serve, changed the type in the extensions and definition YAML.
- Moved the
data,outputsanddefinitions-evaluatedfolders to the new type. - Cleared the catalog's
populatedflag so it would backfill.
The backfill is upsert-only (by design, per bulkUpsert), so it kept 19,818 rows for the old type whose files no longer existed. data.query then returned every item twice until I deleted those rows from SQLite myself. It works now, and new versions carry on from the old history.
This will come up again: moving local extensions into a collective before publishing, or from a personal namespace to a team's.
Proposed
Smallest first:
- A supported full reindex, e.g.
swamp data reindex, that rebuilds the catalog from disk and drops rows with no file behind them. Hand moves then become safe. swamp behavior type rename <old> <new>: moves the data and outputs folders and rewrites catalog rows while holding the repo's locks, refusing while serve or a run is active, and prints what changed.- A docs note on what a type rename involves until either exists.
Cost
- A rename has to be resumable if interrupted halfway, and remote datastores (S3) can't just move a folder.
- Workflow run records keep
modelTypeper step. Rewriting them keeps history links working; leaving them makes history show the old name.
I'm happy to be credited as co-author if you take this on.
Open
No activity in this phase yet.
Sign in to post a ripple.