|
Option C Tools
|
Functions | |
| test_registry_parity () | |
| test_minimal_args_covers_all_tools () | |
| test_model_validates_minimal_args (str tool_name, Path tmp_path) | |
| test_argv_starts_with_expected_subcommand (str tool_name, Path tmp_path) | |
| list[str] | _build_cmd (str tool_name, Path tmp_path) |
| test_skeleton_does_not_emit_output_dir (Path tmp_path) | |
| test_deps_does_not_emit_check (Path tmp_path) | |
| test_test_does_not_emit_jobs (Path tmp_path) | |
| test_diag_does_not_emit_json (Path tmp_path) | |
| test_format_does_not_emit_jobs (Path tmp_path) | |
| test_git_commit_accepts_valid_conventional_messages (str message, Path tmp_path) | |
Variables | |
| dict | _MINIMAL_ARGS |
| dict | _EXPECTED_SUBCOMMAND |
Purpose
-------
OI-502 / FS-502 — MCP contract parity harness. The validator's
``_TOOL_MODEL_MAP`` and the executor's ``_ARGV_BUILDERS`` must register
the same set of tool names, and each registered tool must be executable
against a realistic validated-args dict without tripping the executor's
``.get()`` defaults into producing a CLI flag that the real ``oct`` CLI
does not accept.
The test exercises three invariants:
1. **Registry parity** — ``set(_TOOL_MODEL_MAP) == set(_ARGV_BUILDERS)``.
2. **Per-tool argv well-formed** — for every tool, instantiate the model
with sensible defaults, call its argv builder, and check the first
four elements match ``[sys.executable, "-m", "oct", <subcommand>]``.
3. **No spurious flags** — for a curated list of previously-drifting
flags (``--output-dir``, ``--check``, ``--jobs`` on ``oct test``,
``--json`` on ``oct diag``) the argv must *not* contain the flag.
Regression coverage for the bugs this harness was introduced to fix.
The harness is intentionally static — it does not spawn the ``oct`` CLI
or compare against ``--help`` output, so it runs fast and works even in
environments where click or pytest are missing.
Responsibilities
----------------
- Verify registry parity between ``_TOOL_MODEL_MAP`` and
``_ARGV_BUILDERS``.
- Verify per-tool argv starts with
``[sys.executable, "-m", "oct", <subcommand>]``.
- Verify previously-drifting flags do not appear in builder output.
Diagnostics
-----------
Domain: MCP-TESTS
Levels:
L2 — test lifecycle
L3 — assertion details
L4 — deep tracing
Contracts
---------
- The parity test must fail if a new tool is added to one registry and
not the other.
- The spurious-flag checks must fail if a previously-fixed executor
regression is re-introduced.
|
protected |
| tests_mcp.test_contract_parity.test_argv_starts_with_expected_subcommand | ( | str | tool_name, |
| Path | tmp_path ) |
Builder output must begin with python -m oct <subcommand>.
Definition at line 144 of file test_contract_parity.py.
| tests_mcp.test_contract_parity.test_deps_does_not_emit_check | ( | Path | tmp_path | ) |
OI-502: CLI ``oct deps`` does not accept ``--check``.
Definition at line 179 of file test_contract_parity.py.
| tests_mcp.test_contract_parity.test_diag_does_not_emit_json | ( | Path | tmp_path | ) |
OI-502: no ``oct diag`` subcommand accepts ``--json`` (yet).
Definition at line 191 of file test_contract_parity.py.
| tests_mcp.test_contract_parity.test_format_does_not_emit_jobs | ( | Path | tmp_path | ) |
OI-502: ``oct format`` argparser does not register ``--jobs``.
Definition at line 197 of file test_contract_parity.py.
| tests_mcp.test_contract_parity.test_git_commit_accepts_valid_conventional_messages | ( | str | message, |
| Path | tmp_path ) |
OI-502 / FS-502 — scoped and breaking commits must round-trip.
Definition at line 217 of file test_contract_parity.py.
| tests_mcp.test_contract_parity.test_minimal_args_covers_all_tools | ( | ) |
_MINIMAL_ARGS must cover every registered tool.
Definition at line 128 of file test_contract_parity.py.
| tests_mcp.test_contract_parity.test_model_validates_minimal_args | ( | str | tool_name, |
| Path | tmp_path ) |
Minimal args dict must validate against the registered model.
Definition at line 136 of file test_contract_parity.py.
| tests_mcp.test_contract_parity.test_registry_parity | ( | ) |
Every validator model must have a matching executor argv builder.
Definition at line 117 of file test_contract_parity.py.
| tests_mcp.test_contract_parity.test_skeleton_does_not_emit_output_dir | ( | Path | tmp_path | ) |
OI-502: CLI ``oct export-skeleton`` does not accept ``--output-dir``.
Definition at line 173 of file test_contract_parity.py.
| tests_mcp.test_contract_parity.test_test_does_not_emit_jobs | ( | Path | tmp_path | ) |
OI-502: CLI ``oct test`` does not accept ``--jobs``.
Definition at line 185 of file test_contract_parity.py.
|
protected |
Definition at line 93 of file test_contract_parity.py.
|
protected |
Definition at line 67 of file test_contract_parity.py.