|
| MigrationProjection | build_projection (Registry registry, MigrationOptions options) |
| ImportResult | run_import (Registry registry, MigrationOptions options, *, bool dry_run=False) |
| VerifyResult | run_verify (Registry registry, MigrationOptions options) |
| RollbackResult | run_rollback (Registry registry, MigrationOptions options) |
| CutoverResult | run_cutover_stub () |
| dict[str, object] | audit_null_closed_round_backfills (Registry registry) |
| list[dict[str, object]] | _build_agent_rows () |
| tuple[dict[str, QueueEntry], dict[str, str]] | _read_queue_entries (Path queue_path, Path root) |
| dict[str, PlanHeader] | _read_plan_headers (Path plan_dir, Path root) |
| dict[str, StatusSource] | _read_status_sources (tuple[Path,...]|None explicit_paths, Path root, str observed_at, list[str] warnings) |
| StatusSource | _read_status_source (Path path, Path root, str observed_at) |
| list[Path] | _discover_status_paths (Path root) |
| dict[str, RoundEvidence] | _round_evidence_by_plan (MigrationOptions options, Path root) |
| list[RoundEvidence] | _discover_round_evidence (Path root) |
| str|None | _main_sha (Path root) |
| str | _select_legacy_status (str plan_id, PlanHeader header, StatusSource|None source, Mapping[str, QueueEntry] pending, Mapping[str, str] completed) |
| set[str] | _dedupe_plan_ids_by_number (set[str] plan_ids, Mapping[str, PlanHeader] headers, Mapping[str, QueueEntry] pending, Mapping[str, str] completed, Mapping[str, StatusSource] status_sources, list[str] warnings) |
| int | _plan_number (str plan_id, Mapping[str, PlanHeader] headers) |
| tuple[int, str] | _plan_priority (str plan_id, Mapping[str, QueueEntry] pending, Mapping[str, str] completed, Mapping[str, StatusSource] status_sources) |
| dict[str, object]|None | _map_legacy_status (str plan_id, int plan_number, str legacy_status, StatusSource|None source, RoundEvidence|None evidence, str|None discovered_sha, list[str] errors) |
| dict[str, object] | _plan_payload (str plan_id, PlanHeader header, str legacy_status, Mapping[str, object] mapped, str source_file) |
| dict[str, object] | _round_row (RoundEvidence evidence) |
| PlanHeader | _placeholder_header (str plan_id, Path plan_dir, Path root) |
| str|None | _assigned_slot (QueueEntry|None queue_entry, StatusSource|None source, str|None completed_slot) |
| tuple[str|None, str|None, str|None] | _select_overrides (PlanHeader header, StatusSource|None source, QueueEntry|None queue_entry) |
| str | _parse_title (str text, str plan_id) |
| str|None | _header_value (str text, str name) |
| tuple[str|None, str|None, str|None] | _parse_suggested_model (str text) |
| str|None | _clean_header_value (str|None value) |
| str|None | _normalise_branch (str|None value) |
| None | _clear_duplicate_branches (Sequence[dict[str, object]] plan_rows, list[str] warnings) |
| str | _normalise_legacy_status (object value) |
| str|None | _normalise_header_status (object value) |
| str | _agent_label (str value) |
| str | _agent_label_to_slot (str label) |
| str|None | _first_model (object value) |
| bool | _looks_small_model (str|None model) |
| str|None | _provider_from_model (str|None model) |
| str | _display_path (Path path, Path root) |
| str|None | _string_timestamp (object value) |
| str|None | _optional_text (object value) |
| str|None | _first_text (*object values) |
| str|None | _first_nonempty_line (str text) |
| tuple[int, str] | _plan_sort_key (str plan_id) |
| Path | _backup_dir (Path root) |
| Path | _backup_path (Path root, str now) |
| SQLiteBackend | _sqlite_backend (Registry registry) |
| list[dict[str, object]] | _comparable_agents (Sequence[Mapping[str, object]] rows) |
| list[dict[str, object]] | _comparable_plans (Sequence[Mapping[str, object]] rows) |
| list[dict[str, object]] | _comparable_queue_entries (Sequence[Mapping[str, object]] rows) |
| list[dict[str, object]] | _comparable_rounds (Sequence[Mapping[str, object]] rows) |
| list[dict[str, object]] | _comparable_round_plans (Sequence[Mapping[str, object]] rows) |
| dict[str, object] | _snapshot_diff (Mapping[str, object] expected, Mapping[str, object] actual) |
| dict[str, object] | _result_dict (object value) |
Legacy queue/status migration into the M11 registry.
Purpose
-------
Project the Markdown-era orchestration state into the SQLite registry
without making the registry depend on those legacy files afterward.
Responsibilities
----------------
- Parse the legacy agent queue, plan headers, status files, and git evidence.
- Map legacy lifecycle names onto the ADR-00Z registry statuses.
- Build a deterministic projection for dry-run, import, verify, and rollback.
- Delegate all current-state SQL and operation-log writes to SQLiteBackend.
Diagnostics
-----------
Domain: OC_CHAT.MAIN
Levels:
L2 - lifecycle events
L3 - semantic details
L4 - deep tracing
Contracts
---------
- No raw wall-clock imports are used here; timestamps come from the backend Clock.
- Import uses one SQLite transaction for projected rows and audit rows.
- Unknown legacy statuses fail the import before writing audit rows.
Dependencies
------------
- oc_diagnostics (structured debug logging via _dbg)
- oc_chat.registry._legacy_queue (read-only legacy queue parser; plan 223
moved it here when the queue machinery retired)
- oc_chat.scripts.plan_status (legacy status file parser)
- oc_chat.registry.backends.sqlite (SQL owner for migration writes)
- oc_chat.registry (Registry facade passed to the import, verify and rollback entry points)
- yaml (fallback parse of legacy status-file frontmatter)
- git (not imported; run as a subprocess for worktree list, the first-parent log of main and rev-parse main, the legacy status-file and round evidence)