Skip to main content

Module m0030_backfill_bundle_component_refs

Module m0030_backfill_bundle_component_refs 

Source
Expand description

Backfill db_bundle_skills_ref from the inline db_bundles.skills JSON column.

Skills only, since bundles stopped carrying MCP servers (SPEC_BUNDLE_CONTENTS_MEMORY_NOT_MCP_2026_10_07.md §3.1). This also carried the inline mcp_servers column into db_bundle_mcp_ref; m0036_drop_bundle_mcp now deletes those refs and clears that column, so a store that hasn’t run this yet would only have the servers dropped again straight after. That half went with the store code it called.

Phase 0b of SPEC_INSTRUCTION_AND_MEMORY_PORTABILITY_2026_09_09.md. The two stores were never synced: binding a skill in Memory → Skills wrote only a ref row, while ABF export read only the inline column, so a bundle could run with components it did not export and export components it did not run with (§3.4). The ref tables become authoritative; this carries the inline data across so nothing is lost when export stops reading the columns.

Ships in the same release as the read switch. Export reading refs before this has run would make every pre-existing bundle export empty.

Two stores, deliberately, as of when this migration was written. db_bundles lives in the shared store (run_shared_store_schema), while db_skills/db_mcp_servers and both ref tables lived in the channel store alone (run_object_schema in migrations.rs) — the ref tables had to sit next to the catalog tables they carried foreign keys to, which is also why they never had an FK to db_bundles (the comment above db_bundle_skills_ref in run_object_schema). So this reads bundles from the shared store and writes refs into the channel store, resolving the former exactly the way m0021 does. Now stale in one respect (Phase 2 of SPEC_DURABLE_BINDINGS_2026_09_10.md, m0032_drop_catalog_fk_from_ref_tables): db_skills/db_mcp_servers are authoritatively identity_store and the ref tables no longer carry the FK described above at all — this migration itself is unaffected (it ran, or runs, entirely within the world this comment describes, since it always operated on mstore’s own local catalog copy) and is left as a historical record of why the two stores were split, not a claim about the current schema.

Idempotent: INSERT OR IGNORE on the ref table. Re-running changes nothing.

Best-effort per bundle. One malformed skills blob must not abort a migration that is otherwise carrying real data across — the alternative leaves the store half-converted with the read switch already live. Every skip is logged with the bundle id.

Structs§

M0030BackfillBundleComponentRefs

Functions§

backfill_one_bundle 🔒
Carry one bundle’s inline skills across into the ref table.
resolve_bundle_store 🔒
Where db_bundles actually lives — the shared store, falling back to the channel store when it cannot be opened.