|
oc_chat
|
Classes | |
| class | Stamp |
| class | BranchRow |
| class | WorktreeRow |
Functions | |
| Stamp | _iso_now () |
| Stamp | _stamp_from_arg (str|None value) |
| tuple[int, str, str] | _run_cmd (Sequence[str] args, Path cwd, int timeout=DEFAULT_TIMEOUT_SECONDS) |
| Path | write_branch_inventory (Path repo_root, Path out_dir, Stamp stamp, *, int timeout=DEFAULT_TIMEOUT_SECONDS) |
| Path | write_health_baseline (Path repo_root, Path out_dir, Stamp stamp, *, int timeout=DEFAULT_TIMEOUT_SECONDS) |
| Path | write_test_baseline (Path repo_root, Path out_dir, Stamp stamp, *, int timeout=DEFAULT_TIMEOUT_SECONDS) |
| Path | write_filter_repo_dryrun (Path repo_root, Path out_dir, Stamp stamp, *, int timeout=DEFAULT_TIMEOUT_SECONDS) |
| list[Path] | run_all (Path repo_root, Path out_dir, Stamp stamp, *, int timeout=DEFAULT_TIMEOUT_SECONDS) |
| Path | write_summary (Path out_dir, Stamp stamp, Sequence[Path] artifacts) |
| list[BranchRow] | _collect_branches (Path repo_root, int timeout) |
| list[WorktreeRow] | _collect_worktrees (Path repo_root, int timeout) |
| set[str] | _merged_branches (Path repo_root, int timeout) |
| str | _ahead_behind (Path repo_root, str branch, int timeout) |
| tuple[str, str, str] | _worktree_commit_info (Path repo_root, str worktree, int timeout) |
| list[dict[str, str]] | _parse_worktree_records (str text) |
| int|None | _parse_test_count (str text) |
| str|None | _filter_repo_mode (Path repo_root, int timeout) |
| list[str] | _filter_repo_command (str mode) |
| bool | _safe_clone_dir (Path clone_dir, Path repo_root) |
| None | _write_filter_report (Path path, Stamp stamp, str status, str reason, *, str|None command=None, int|None returncode=None, str stdout="", str stderr="") |
| tuple[str, str, str, str] | _split_tab4 (str line) |
| str | _tail (str text, int lines=25) |
| str | _md (str value) |
| Path | _resolve_repo_root (str|None raw) |
| Path | _resolve_out_dir (Path repo_root, str|None raw) |
| None | _add_common (argparse.ArgumentParser parser) |
| list[Path] | _dispatch (argparse.Namespace args) |
| argparse.ArgumentParser | build_parser () |
| int | main (list[str]|None argv=None) |
Variables | |
| str | DEFAULT_OUT_DIR = ".migration" |
| int | DEFAULT_TIMEOUT_SECONDS = 300 |
| COUNT_RE = re.compile(r"(\d+)\s+(?:tests?|items?)\s+collected", re.IGNORECASE) | |
| PER_FILE_COUNT_RE = re.compile(r"^[^:\n]+:\s*(\d+)\s*$", re.MULTILINE) | |
M3.1 monorepo migration pre-flight artifact generator.
Purpose
-------
Capture the non-destructive baselines needed before the future M3.2
``git filter-repo`` migration into the Option_C monorepo.
Responsibilities
----------------
- Write branch/worktree inventory artifacts.
- Capture ``oct health --json`` output or a structured skip stub.
- Record the pytest collection count used for later parity checks.
- Run a filter-repo rehearsal only inside a throwaway temp clone.
- Write a summary artifact that separates automated and manual steps.
Diagnostics
-----------
Domain: OC_CHAT.MAIN
Levels:
L2 - CLI lifecycle and artifact writes
L3 - subprocess and tool-availability decisions
L4 - row-level inventory details
Contracts
---------
- No live branch or repository history is rewritten.
- Missing optional tools write SKIPPED artifacts and return success.
- Subprocesses run with argument lists and never through ``shell=True``.
- The filter-repo command is never run against the source repository root.
Dependencies
------------
- git (not imported; CLI run as a subprocess for the branch and worktree inventory, the temp clone and the optional git filter-repo rehearsal)
- pytest (not imported; run as python -m pytest --collect-only for the collection-count baseline)
- oct (not imported; optional CLI run as oct health --json for the health baseline)
- oc_diagnostics (structured debug logging via _dbg)
|
protected |
|
protected |
Definition at line 519 of file migration_preflight.py.
|
protected |
Definition at line 429 of file migration_preflight.py.
|
protected |
Definition at line 471 of file migration_preflight.py.
|
protected |
Definition at line 663 of file migration_preflight.py.
|
protected |
|
protected |
Definition at line 578 of file migration_preflight.py.
|
protected |
|
protected |
|
protected |
Definition at line 508 of file migration_preflight.py.
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
Run a subprocess command with captured output.
Definition at line 118 of file migration_preflight.py.
|
protected |
|
protected |
|
protected |
Definition at line 110 of file migration_preflight.py.
|
protected |
|
protected |
Definition at line 534 of file migration_preflight.py.
|
protected |
| argparse.ArgumentParser oc_chat.scripts.migration_preflight.build_parser | ( | ) |
Definition at line 680 of file migration_preflight.py.
| int oc_chat.scripts.migration_preflight.main | ( | list[str] | None | argv = None | ) |
| list[Path] oc_chat.scripts.migration_preflight.run_all | ( | Path | repo_root, |
| Path | out_dir, | ||
| Stamp | stamp, | ||
| * | , | ||
| int | timeout = DEFAULT_TIMEOUT_SECONDS ) |
Run all pre-flight producers and write the summary.
Definition at line 372 of file migration_preflight.py.
| Path oc_chat.scripts.migration_preflight.write_branch_inventory | ( | Path | repo_root, |
| Path | out_dir, | ||
| Stamp | stamp, | ||
| * | , | ||
| int | timeout = DEFAULT_TIMEOUT_SECONDS ) |
Write branch/worktree inventory markdown.
Definition at line 146 of file migration_preflight.py.
| Path oc_chat.scripts.migration_preflight.write_filter_repo_dryrun | ( | Path | repo_root, |
| Path | out_dir, | ||
| Stamp | stamp, | ||
| * | , | ||
| int | timeout = DEFAULT_TIMEOUT_SECONDS ) |
Run filter-repo only inside a throwaway clone and write the report.
Definition at line 287 of file migration_preflight.py.
| Path oc_chat.scripts.migration_preflight.write_health_baseline | ( | Path | repo_root, |
| Path | out_dir, | ||
| Stamp | stamp, | ||
| * | , | ||
| int | timeout = DEFAULT_TIMEOUT_SECONDS ) |
Write ``oct health --json`` output or a structured SKIPPED stub.
Definition at line 218 of file migration_preflight.py.
| Path oc_chat.scripts.migration_preflight.write_summary | ( | Path | out_dir, |
| Stamp | stamp, | ||
| Sequence[Path] | artifacts ) |
Write the pre-flight summary markdown.
Definition at line 393 of file migration_preflight.py.
| Path oc_chat.scripts.migration_preflight.write_test_baseline | ( | Path | repo_root, |
| Path | out_dir, | ||
| Stamp | stamp, | ||
| * | , | ||
| int | timeout = DEFAULT_TIMEOUT_SECONDS ) |
Write pytest collection-count baseline.
Definition at line 252 of file migration_preflight.py.
| oc_chat.scripts.migration_preflight.COUNT_RE = re.compile(r"(\d+)\s+(?:tests?|items?)\s+collected", re.IGNORECASE) |
Definition at line 65 of file migration_preflight.py.
| str oc_chat.scripts.migration_preflight.DEFAULT_OUT_DIR = ".migration" |
Definition at line 63 of file migration_preflight.py.
| int oc_chat.scripts.migration_preflight.DEFAULT_TIMEOUT_SECONDS = 300 |
Definition at line 64 of file migration_preflight.py.
| oc_chat.scripts.migration_preflight.PER_FILE_COUNT_RE = re.compile(r"^[^:\n]+:\s*(\d+)\s*$", re.MULTILINE) |
Definition at line 66 of file migration_preflight.py.