oc_chat
Loading...
Searching...
No Matches
oc_chat.testing.report Namespace Reference

Functions

dict make_error (str kind, str code, str severity, str message, str source="orchestrator")
dict make_violation (str rule_id, str file, str|None nodeid, str severity, str message)
tuple[int, str] compute_exit_and_status (*, bool fatal_config, bool interrupted, bool orchestrator_error, bool error_violations, bool failed_or_timeout)

Variables

str SCHEMA_STAMP = "oct-test/v0.4"
dict SUPPORTED_FEATURES
tuple REQUIRED_FIELD_PATHS
dict IMPLEMENTATION_ERROR_CODES
tuple STATUSES

Detailed Description

Report-layer constants and pure mappings for the §20 stand-in (Plan 184).

Purpose
-------
Pin everything the spec-10 section 11 and section 20.3 report
contract fixes at the data level: the ``oct-test/v0.4`` schema stamp,
the pinned ``supported_features`` values VERBATIM, the required-field
path list, the documented 9xxx implementation-code catalog (section
12.4 requires the implementation to document its extension codes in
its own catalog — this module IS that catalog), and the section-4
exit-code precedence.

Responsibilities
----------------
- ``SCHEMA_STAMP`` / ``SUPPORTED_FEATURES`` / ``REQUIRED_FIELD_PATHS``.
- ``IMPLEMENTATION_ERROR_CODES`` — every 9xxx code the stand-in emits.
- ``make_error`` / ``make_violation`` — the §11 pinned entry shapes.
- ``compute_exit_and_status`` — §4 precedence (4 over 3 over 2 over 1
  over 0) with the §12.3 interrupted-status carve-out.

Diagnostics
-----------
Domain: OC_TESTING
Levels:
    L2 — lifecycle events
    L3 — semantic details
    L4 — deep tracing

Contracts
---------
- ``supported_features`` values are the §20.3 pinned set verbatim; a
  serial stand-in reports ``workers_auto: "deferred"``. Since Plan 240
  the stand-in can also DISTRIBUTE, and ADR-T-11's v0.3 amendment
  (readiness audit A-19) makes that one value run-dependent —
  ``"deferred"`` when serial, ``"enforced"`` when the run resolved
  ``auto`` and distributed. This constant stays the SERIAL baseline;
  ``runner._features_for`` applies the parallel value per run, so the
  pinned dict below is still exactly what a serial report carries.
- Timeout counts drive the ``failed`` status class (§11 status rule):
  ``failed`` exactly when ``summary.failed + summary.timeout > 0``.

Dependencies
------------
- oc_diagnostics (structured debug logging via _dbg)

Function Documentation

◆ compute_exit_and_status()

tuple[int, str] oc_chat.testing.report.compute_exit_and_status ( * ,
bool fatal_config,
bool interrupted,
bool orchestrator_error,
bool error_violations,
bool failed_or_timeout )
§4 exit precedence: 4 over 3 over 2 over 1 over 0.

``interrupted`` and ``orchestrator_error`` share exit 3; the
interrupted STATUS wins when both hold (§12.6: an
``ORCHESTRATOR_INTERRUPTED`` signal already forced exit 3).

Definition at line 187 of file report.py.

◆ make_error()

dict oc_chat.testing.report.make_error ( str kind,
str code,
str severity,
str message,
str source = "orchestrator" )
Build a §11 ``errors[]`` entry ``{kind, code, severity, message,
source}``.

Definition at line 146 of file report.py.

◆ make_violation()

dict oc_chat.testing.report.make_violation ( str rule_id,
str file,
str | None nodeid,
str severity,
str message )
Build a §11 ``contract_violations[]`` entry ``{rule_id, file,
nodeid, severity, message}`` (nodeid ``None`` for file/run-level
findings).

Definition at line 166 of file report.py.

Variable Documentation

◆ IMPLEMENTATION_ERROR_CODES

dict oc_chat.testing.report.IMPLEMENTATION_ERROR_CODES

Definition at line 106 of file report.py.

◆ REQUIRED_FIELD_PATHS

tuple oc_chat.testing.report.REQUIRED_FIELD_PATHS
Initial value:
1= (
2 "schema",
3 "run_id",
4 "status",
5 "exit_code",
6 "workspace.root",
7 "workspace.mode",
8 "selection.packages",
9 "selection.profile",
10 "selection.marker",
11 "selection.seed",
12 "selection.nodeids",
13 "selection.pytest_args",
14 "workers.requested",
15 "workers.actual",
16 "workers.dist_mode",
17 "summary",
18 "tests",
19 "contract_violations",
20 "artifacts.junit_xml",
21 "artifacts.ndjson",
22 "artifacts.ndjson_stream",
23 "errors",
24 "supported_features",
25)

Definition at line 78 of file report.py.

◆ SCHEMA_STAMP

str oc_chat.testing.report.SCHEMA_STAMP = "oct-test/v0.4"

Definition at line 58 of file report.py.

◆ STATUSES

tuple oc_chat.testing.report.STATUSES
Initial value:
1= (
2 "passed", "failed", "contract_violation", "orchestrator_error",
3 "orchestrator_interrupted", "configuration_error",
4)

Definition at line 140 of file report.py.

◆ SUPPORTED_FEATURES

dict oc_chat.testing.report.SUPPORTED_FEATURES
Initial value:
1= {
2 "cwd_chdir": "enforced",
3 "env_mutation": "enforced",
4 "owned_writes_outside_tmp": "advisory",
5 "singleton_reset": "deferred",
6 "lock_target_outside_tmp": "deferred",
7 "network_marker": "deferred",
8 "large_suite_pagination": "deferred",
9 "workers_auto": "deferred",
10 "error_code_catalog": "enforced",
11 "signal_handling": "enforced",
12 "per_test_timeout": "enforced",
13 "single_package_walk": "enforced",
14}

Definition at line 61 of file report.py.