Skip to main content

agentmux_srv/migrations/
m0013_agent_direct_bindings.rs

1// Copyright 2026, AgentMux Corp.
2// SPDX-License-Identifier: Apache-2.0
3
4//! Backfill direct agent↔account links from bundle bindings — historical.
5//!
6//! Phase 3 slice 2 PR-A (additive, behavior-preserving). Revived the
7//! long-existing `db_agent_identity_links` table (`agent_id` ==
8//! `AgentDefinition.id`) as a resolution path and seeded it from the
9//! `identity_bundle → binding → account` graph so the resolver's new
10//! *dual-read* path resolved to the SAME accounts it did before.
11//!
12//! **Retired.** `db_identity_bundles`/`db_identity_bindings` (the source
13//! this read from) were dropped in Phase 4c of
14//! SPEC_PRESET_TO_BUNDLE_REFACTOR_2026_07_02.md, once this migration had
15//! already run on every real install and `db_agent_identity_links` was
16//! confirmed the sole credential-resolution path
17//! (`identity/resolver/inject.rs::resolve_bindings_for_instance`). The migration
18//! id stays registered — already-applied installs must never re-run a
19//! Global migration — but its body is now a documented no-op.
20//!
21//! **Idempotency (historical):** `agent_identity_link` is `INSERT ...
22//! ON CONFLICT ... DO UPDATE`, so re-running converged to the same rows.
23
24use super::{Migration, MigrationContext, MigrationError, MigrationScope};
25
26pub struct M0013AgentDirectBindings;
27
28impl Migration for M0013AgentDirectBindings {
29    fn id(&self) -> &'static str { "0013_agent_direct_bindings" }
30    fn scope(&self) -> MigrationScope { MigrationScope::Global }
31    fn description(&self) -> &'static str {
32        "Retired no-op — historically backfilled direct agent↔account links from existing bundle bindings"
33    }
34
35    fn up(&self, _ctx: &MigrationContext) -> Result<(), MigrationError> {
36        Ok(())
37    }
38}