pub(crate) fn purge_bundle_component_refs(mstore: &Store, bundle_id: &str)Expand description
Drop a deleted bundle’s component refs.
Called from both delete paths — bundle.delete here and deletememory
in agent_handlers/bundle.rs, which is the one Memory actually calls.
Fixing only the first left the product path orphaning refs (Codex, PR
#3153), so this exists to make “both” mean one implementation.
bundle_delete runs on the store that owns db_bundles, which has no ref
tables — they live in the channel store, a different database, which is
also why no foreign key reaches across (the db_bundle_skills_ref comment
in migrations.rs’s run_object_schema). So the purge cannot live inside
it and has to be driven from a handler, where both stores are in scope.
Best-effort by design: the bundle row is already gone by the time this runs, so a failure here must not turn a successful delete into an error.