Skip to main content
← Back to list
01Issue
FeatureShippedSwamp CLIPublic
Assigneeszack

Relationships

#4502 Rename a behavior type (e.g. move it to another namespace) without losing its data

Opened by liywjl · 11/7/2026· Shipped 11/12/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 rename renames a data item inside a behavior, and swamp repo upgrade doesn'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:

  1. Stopped serve, changed the type in the extensions and definition YAML.
  2. Moved the data, outputs and definitions-evaluated folders to the new type.
  3. Cleared the catalog's populated flag 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 modelType per 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.

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

Shipped

11/12/2026, 7:43:23 PM

Click a lifecycle step above to view its details.

03Sludge Pulse
zack assigned zack11/12/2026, 5:20:03 PM
Editable. Press Enter to edit.

zack commented 11/12/2026, 7:43:24 PM

Thanks @liywjl for reporting this! We shipped: Make a hand-moved behavior type safe to clean up. swamp doctor datastores already rebuilds the catalog from disk with --repair, but its completeness check only counts records the catalog is missing, so rows left behind under a type whose files moved (the reporter's 19,818 rows) are never reported and data.query returns items twice. Extend the check to report surplus own-namespace data names with no name directory on disk (filesystem datastores only, where the disk is authoritative), repair them surgically through CatalogStore.clearRows under the datastore global lock after draining per-model writers (keeping foreign rows and the populated mark), and document how to move a type by hand until swamp-club#4678 adds a rename command.. The fix has been merged and a release is on its way. We appreciate your contribution to swamp.

Sign in to post a ripple.