oc_chat
Loading...
Searching...
No Matches
seed_142_product_changelog Namespace Reference

Classes

class  SeedReport

Functions

dict[str, str] _roadmap_snapshot (Path roadmap_dir)
set[str] _gather_existing_versions (Path source_dir)
list[str] synthetic_versions (int count, set[str] existing)
str|None _first_iso_date (str segment)
SeedReport backfill (Path backup_path, Path source_dir)
int _main ()

Variables

str _ERA = "v3"
str _FALLBACK_DATE = "2026-05-15"
int _SYNTH_FLOOR = 1000
 _ISO_DATE_RE = re.compile(r"\b(\d{4}-\d{2}-\d{2})\b")

Detailed Description

Seed the live root product CHANGELOG.md into kind=product source records (Plan 142).

Purpose
-------
The live repo-root product ``CHANGELOG.md`` is not registry-managed (0 ``kind=product``
records → a 296-byte stub render). Tile it **content-faithfully** into
``source/changelog/product/<id>.md`` records: one ``kind=product`` record per
separator-delimited segment, body = the verbatim slice (canonicalised at
``format_record_text`` time), so the verbatim-seq render reproduces
``canonicalize(backup)`` byte-for-byte. The raw original survives as the Phase-0
backup receipt; this writes ONLY ``source/changelog/product/**`` (the roadmap seed
is never touched), and never the live ``CHANGELOG.md``.

Deliberately NOT the roadmap reseed: no destructive ``changelog/`` ``rglob`` cleanup,
no ``_BUMP_RE`` arrow classifier. Keys are **independent synthetic** versions in a
``v0.0.x`` band proven disjoint from every version in the source tree (all kinds) +
the store, fail-closed (mirroring a roadmap bump arrow would mint ``v3.03–v3.10`` and
hard-fail at ``SRC_VERSION_METADATA_CONFLICT`` or silently dedup-merge).

Responsibilities
----------------
- ``backfill`` (the migration), ``synthetic_versions`` (disjoint band, fail-closed),
  ``_roadmap_snapshot`` (the untouched guard), reported ``SeedReport`` for the audit.

Diagnostics
-----------
Domain: OC_CHAT.MAIN
Levels:
    L2 - seed lifecycle
    L3 - per-segment record emission
    L4 - version/date assignment

Contracts
---------
- Writes ONLY ``source/changelog/product/**``; a pre/post hash+filelist guard over
  ``source/changelog/roadmap/**`` fails closed on any change. Idempotent: a non-empty
  product dir must match this run's expected record set or it fails closed.

Dependencies
------------
- oc_diagnostics (structured debug logging via _dbg)
- option_c_registry_contracts (the Version model and SCHEMA_VERSION for each product record)
- oc_chat.registry.regenerate (imported for the contracts bootstrap it runs)
- oc_chat.registry.regenerate.pipeline (regenerate - rebuilds a temporary store for the fidelity proof)
- oc_chat.registry.render.roadmap (render_living_set - renders the root changelog for the fidelity proof)
- oc_chat.registry.source.canonical (format_record_text and load_record - writes each product record and reads existing versions)
- oc_chat.registry.source.canonical_product (split_segments, segment_line_ranges and product_changelog_canonicalize - tiles and canonicalises the changelog)
- oc_chat.registry.source.scanner (scan_source_tree - finds the version records whose versions the synthetic band avoids)

Function Documentation

◆ _first_iso_date()

str | None seed_142_product_changelog._first_iso_date ( str segment)
protected

Definition at line 145 of file seed_142_product_changelog.py.

Here is the caller graph for this function:

◆ _gather_existing_versions()

set[str] seed_142_product_changelog._gather_existing_versions ( Path source_dir)
protected
Every NON-product ``version`` string in the scanned source tree.

The synthetic band must be disjoint from the roadmap (and any other non-product)
version set — colliding there hard-fails at ``SRC_VERSION_METADATA_CONFLICT`` or
silently dedup-merges. The product records this seed (re)writes are deliberately
EXCLUDED so the band is stable across re-runs (idempotent); product versions are
unique within the band by construction.

Definition at line 114 of file seed_142_product_changelog.py.

Here is the caller graph for this function:

◆ _main()

int seed_142_product_changelog._main ( )
protected

Definition at line 227 of file seed_142_product_changelog.py.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ _roadmap_snapshot()

dict[str, str] seed_142_product_changelog._roadmap_snapshot ( Path roadmap_dir)
protected
``{relpath: sha256}`` over ``source/changelog/roadmap/**`` (the untouched guard).

Definition at line 105 of file seed_142_product_changelog.py.

Here is the caller graph for this function:

◆ backfill()

SeedReport seed_142_product_changelog.backfill ( Path backup_path,
Path source_dir )
Tile ``backup_path`` into ``source/changelog/product/**`` records.

Definition at line 150 of file seed_142_product_changelog.py.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ synthetic_versions()

list[str] seed_142_product_changelog.synthetic_versions ( int count,
set[str] existing )
A deterministic ``v0.0.<n>`` band of ``count`` versions, provably disjoint
from ``existing`` (fail-closed if no disjoint band is found at the floor).

Definition at line 132 of file seed_142_product_changelog.py.

Here is the caller graph for this function:

Variable Documentation

◆ _ERA

str seed_142_product_changelog._ERA = "v3"
protected

Definition at line 86 of file seed_142_product_changelog.py.

◆ _FALLBACK_DATE

str seed_142_product_changelog._FALLBACK_DATE = "2026-05-15"
protected

Definition at line 88 of file seed_142_product_changelog.py.

◆ _ISO_DATE_RE

seed_142_product_changelog._ISO_DATE_RE = re.compile(r"\b(\d{4}-\d{2}-\d{2})\b")
protected

Definition at line 92 of file seed_142_product_changelog.py.

◆ _SYNTH_FLOOR

int seed_142_product_changelog._SYNTH_FLOOR = 1000
protected

Definition at line 91 of file seed_142_product_changelog.py.