Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

address review (claude): preserve a revision's payload.schemaVersion on restore so the boot migration upgrades it correctly

[._.]/ Adam Eivy5ca1ba85200e
diff --git a/server/routes/catalog.js b/server/routes/catalog.js
index 56a661923e..d8c1d4515b 100644
--- a/server/routes/catalog.js
+++ b/server/routes/catalog.js
@@ -229,10 +229,14 @@ router.post('/ingredients/:id/revisions/:revisionId/restore', asyncHandler(async
if (!revision || revision.ingredientId !== req.params.id) {
throw new ServerError('Revision not found', { status: 404 });
}
- // Drop the per-record payload.schemaVersion marker — createIngredient/
- // updateIngredient re-stamp it from the registry, and a restore should land
- // the CURRENT marker, not the (possibly older) one the revision captured.
- const { schemaVersion, ...restoredPayload } = revision.payload || {};
+ // Restore the revision's payload verbatim, INCLUDING its captured
+ // `payload.schemaVersion`. `updateIngredient` writes payload as-is and does
+ // NOT re-stamp the version (only create/revive do), so the marker must match
+ // the restored *shape*: a v1-era revision keeps v1, and the boot-time
+ // `migrateCatalogPayload` upgrades it to current iff it's behind. Stripping
+ // the marker (→ absent → treated as v1) or forcing it to current would
+ // mislabel the restored shape and mis-drive that migration.
+ const restoredPayload = revision.payload || {};
const embeddingPatch = await embedIngredient({ name: revision.name, payload: restoredPayload });
const updated = await catalogDB.updateIngredient(
req.params.id,