|
| str | _one_line (object text, int max_len=240) |
| str | _iso_date (object value) |
| str | _sanitize_id (str raw, MigrationReport report) |
| str | _derive_purpose (object title, object prose, MigrationReport report) |
| dict[str, str] | phase_title_map (Path roadmap_md) |
| Registry | ingest_oracle (Path roadmap_dir, Path db_path) |
| tuple[dict, dict] | _deps_and_tracks (sqlite3.Connection conn, MigrationReport report) |
| list | _depends_on (str item_id, dict deps, dict sanitized) |
| bool | _needs_promotion (sqlite3.Row row, dict deps) |
| None | _write (Path out_dir, str rel, rc.RegistryModel model, str body="") |
| MigrationReport | emit_source (Path db_path, Path out_dir, Path roadmap_md) |
| list | _sub_rows (sqlite3.Connection conn, str phase_code) |
| None | _emit_phases (conn, out_dir, titles, deps, tracks, sanitized, report) |
| None | _emit_items (conn, out_dir, deps, tracks, sanitized, report) |
| str | _reconcile_child_status (str item_id, str status, bool parent_done, MigrationReport report) |
| object | _priority (object value) |
| str | _promotion_reason (sqlite3.Row row, dict deps) |
The v3.38 binary -> AuthoredSource seed migration (Plan 142 P1.7, §9 / §5.8).
Purpose
-------
Ingest the live ``ROADMAP-v3.38*`` four-file set into a worktree-local store
(the oracle), then EMIT the per-record ``oc_chat/roadmap/source/**`` tree: 14
top-level phases as ``Phase`` records (sub-phases nested as ``sub_phases`` or
promoted to ``phases/<code>/<sub_id>.md`` per §5.6), non-phase items as
``RoadmapItem`` records, plus the era/tracks/version — backfilling a non-empty
``purpose`` for every phase + item (AC §8.22) and sanitising legacy ids/dates.
Responsibilities
----------------
- ``ingest_oracle(roadmap_dir, db)`` — build the oracle store.
- ``emit_source(db, out_dir, roadmap_md)`` — write the canonical source tree;
return a migration report (counts, promotions, id/date sanitisations).
Diagnostics
-----------
Domain: OC_CHAT.MAIN
Levels:
L2 - migration lifecycle
L3 - per-entity emission
L4 - per-record sanitisation
Contracts
---------
- Deterministic: identical inputs -> identical source bytes.
- Never writes outside ``out_dir``; the oracle DB is worktree-local + temporary.
- Every emitted record validates against the P1.1 / P1.4 models.
Dependencies
------------
- oc_diagnostics (structured debug logging via _dbg)
- oc_chat.registry.regenerate (imported for the contracts bootstrap it runs)
- option_c_registry_contracts (the record models, SCHEMA_VERSION, ID_RE and TERMINAL_STATUSES for the emitted source tree)
- oc_chat.registry (Registry - the oracle registry over the SQLite backend)
- oc_chat.registry.backends.sqlite (SQLiteBackend and RegistrySeed - the worktree-local oracle store)
- oc_chat.registry.regenerate.promoted (PromotedItem - the record for a sub-phase promoted to its own file)
- oc_chat.registry.roadmap.ingest (ingest_corpus - ingests the v3.38 four-file set into the oracle)
- oc_chat.registry.source.canonical (format_record_text - writes each emitted record canonically)