kidlisp(datomic): dual-write mints/media to the sidecar
After the 2026-03-24 backfill, every keep-*.mjs write still landed
only in Mongo even though reads had cut over to Datomic. New mints,
rebakes, and metadata updates were invisible to keep.kidlisp.com —
the page showed a frozen snapshot of the pre-cutover kept set.
Mirror each Mongo mutation into the sidecar behind the existing
KIDLISP_DATOMIC flag:
- keep-confirm → sidecar.recordMint (source="kept")
- keep-update-confirm → sidecar.recordMint (source="update")
- keep-mint → setIpfsMedia + setPendingRebake; server-mint
path also records the mint and tezos-state
- keep-prepare-bg → setIpfsMedia + setPendingRebake
- keep-update → recordMint on the deprecated server-sign path
All sidecar calls are fire-and-forget (errors logged, Mongo remains the
primary write). selectPrimaryKeep now prefers the freshest keptAt so
metadata updates surface immediately in the Mongo-shape response.
catchup-kidlisp-to-datomic.mjs replays the missed window idempotently:
it queries Datomic for each piece's existing keeps and only sends the
delta, then force-refreshes ipfsMedia / pendingRebake / tezos-state
(replace semantics on the sidecar side).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>