|
Option C Tools
|
Functions | |
| Path | _write (Path path, dict data) |
| test_get_debug_domain_map_v2_not_legacy () | |
| test_get_debug_domain_map_v1_is_legacy () | |
| test_get_debug_domain_map_short_form_normalised () | |
| test_migrate_config_upgrades_v1_to_v2 (Path tmp_path) | |
| test_migrate_config_idempotent_on_v2 (Path tmp_path) | |
| test_migrate_config_dry_run_never_writes (Path tmp_path) | |
| test_validate_config_warns_on_legacy_schema (Path tmp_path) | |
| test_cli_migrate_config_round_trip (Path tmp_path) | |
Variables | |
| dict | _LEGACY_FULL |
| dict | _LEGACY_SHORT = {"domains": {"TEST": 2}} |
| dict | _V2_FULL |
Purpose
-------
OI-508 / FS-515 regression coverage — ``debug_config.json`` schema
bridge. :func:`_get_debug_domain_map` must normalise both the legacy v1
``domains:`` and the current v2 ``DEBUG_LEVELS:`` shape into a single
map shape; :func:`migrate_config` must upgrade v1 -> v2 in-place with a
``.bk`` backup and be idempotent on already-v2 files. The
``oct diag migrate-config`` CLI command must expose the same behaviour
and print a helpful summary.
Responsibilities
----------------
- Verify legacy v1 ``domains:`` config normalises into v2 ``DEBUG_LEVELS``.
- Verify ``migrate-config`` creates a ``.bk`` backup and is idempotent.
- Verify ``validate-config`` emits a WARNING on legacy schema with a
``migrate-config`` hint.
Diagnostics
-----------
Domain: DIAG-TESTS
Levels:
L2 — test lifecycle
L3 — assertion details
L4 — deep tracing
Contracts
---------
- Legacy ``domains:`` config normalises into a v2 ``DEBUG_LEVELS`` map.
- Running migrate-config writes ``<path>.bk`` with the original content.
- Running migrate-config twice is a no-op (no backup clobber).
- ``validate-config`` emits a WARNING (not ERROR) on legacy schema and
references the ``migrate-config`` hint.
|
protected |
| tests_diag.test_migrate_config.test_cli_migrate_config_round_trip | ( | Path | tmp_path | ) |
OI-508: ``oct diag migrate-config PATH`` migrates an arbitrary file.
Definition at line 149 of file test_migrate_config.py.
| tests_diag.test_migrate_config.test_get_debug_domain_map_short_form_normalised | ( | ) |
v1 short form ``{"TEST": 2}`` → ``{"TEST": {"level": 2, "color": "default"}}``.
Definition at line 97 of file test_migrate_config.py.
| tests_diag.test_migrate_config.test_get_debug_domain_map_v1_is_legacy | ( | ) |
v1 ``domains`` → is_legacy is True; shape matches v2.
Definition at line 89 of file test_migrate_config.py.
| tests_diag.test_migrate_config.test_get_debug_domain_map_v2_not_legacy | ( | ) |
v2 ``DEBUG_LEVELS`` → is_legacy is False.
Definition at line 82 of file test_migrate_config.py.
| tests_diag.test_migrate_config.test_migrate_config_dry_run_never_writes | ( | Path | tmp_path | ) |
OI-508: dry_run returns the target shape without touching disk.
Definition at line 128 of file test_migrate_config.py.
| tests_diag.test_migrate_config.test_migrate_config_idempotent_on_v2 | ( | Path | tmp_path | ) |
OI-508: running migrate on an already-v2 file is a no-op.
Definition at line 118 of file test_migrate_config.py.
| tests_diag.test_migrate_config.test_migrate_config_upgrades_v1_to_v2 | ( | Path | tmp_path | ) |
OI-508: migrate writes v2 schema in-place and creates .bk backup.
Definition at line 104 of file test_migrate_config.py.
| tests_diag.test_migrate_config.test_validate_config_warns_on_legacy_schema | ( | Path | tmp_path | ) |
OI-508: legacy schema → WARNING with migration hint; no hard ERROR.
Definition at line 138 of file test_migrate_config.py.
|
protected |
Definition at line 57 of file test_migrate_config.py.
|
protected |
Definition at line 66 of file test_migrate_config.py.
|
protected |
Definition at line 68 of file test_migrate_config.py.