Expand description
One-time migration: per-block zones → per-agent zones.
Gated by the migration framework (db_migrations, via
migrations::m0002_block_zones_v1), NOT by its own marker file — see
migrate_block_zones_v1’s doc comment for what the marker is still for.
Structs§
- Migration
Stats - Stats from
migrate_block_zones_v1. Logged at INFO at startup.
Constants§
- MIGRATION_
MARKER_ V1 - Marker file written under the data dir when the migration completes.
Functions§
- agent_
definition_ 🔒id - The agent definition id a block carries, if it is an agent block with a
valid one. Stored under
agentId(current shape, set byagent.open+ the frontend launch flow) or the legacyagent:id. - block_
zones_ look_ incomplete - Read-only content check: is there an agent block whose per-block
snapshot has bytes, while its agent’s
:currentzone is still empty? That is the state this migration exists to fix, sotruemeans it has not (fully) run on this data — regardless of what any marker says. - existing_
archive_ 🔒snapshots - Every archive snapshot already stored for
def_id, by bytes. Read once per definition so the dedupe below is O(archives) per agent, not per block. Enumerates zone ids directly rather than throughlist_archives, which caps at 100 rows and reads previews this has no use for. - migrate_
block_ zones_ v1 - One-shot migration of per-block agent session zones to per-agent
zones. Content-idempotent: an archive is only written when no archive
for that agent already holds the same bytes, and
:currentis only seeded when empty — so running twice (or over a data dir that a staleMIGRATION_MARKER_V1wrongly calls done) writes nothing twice. The framework’sdb_migrationsrow is the gate; the marker is written at the end as evidence only.