Skip to content

v0.16.0 — compact mutation runtime: lean results, crash evidence, immutable-source campaigns

Choose a tag to compare

@prostomarkeloff prostomarkeloff released this 19 Jul 18:19
· 5 commits to main since this release

Compact mutation runtime

A generic runtime surface for exact mutation executors and other high-frequency wrapper tools: minimal per-request payloads, provable crash attribution, and fail-closed contracts at every edge — while the full pytest protocol keeps running underneath.

request_run_results — the quiet compact client

request_run_results(addr, on_result, nodeids=[...], stop_on_failure=..., fresh_workers=...) delivers validated lean RunResults through a callback. Unlike request_run it never writes to stdout (progress goes to an optional on_progress callback); unlike request_run_streamed it does not ask workers to serialize full pytest reports. Everything crossing the socket is validated — malformed progress frames, missing or malformed results, wrong outcome/duration/phase shapes all reject with rc=2 instead of reaching the executor.

Phase timings in every result

Every RunResult now carries phases — per-phase durations for setup / call / teardown — so timing-aware clients get exact phase attribution without paying for serialized TestReports.

Exact crash evidence — run_meta["process_failures"]

Each worker publishes the index of the item it is about to execute into a per-worker shared-memory slot right before entering the pytest protocol, and overwrites it with a terminal sentinel right after. If a worker process dies (os._exit, hard crash, kill), the parent reads the slot after the run and reports exactly the nodeid that was provably inside the protocol — nothing else. A completed earlier occurrence of the same nodeid cannot mask a later crash of its re-execution. The run stays UNTRUSTED as before; the new field tells you which item took the process down, with zero per-item transport frames on the happy path.

Collection errors fail closed for compact requests

A compact (want_results) request against a daemon whose collection has errors is rejected with rc=2 and a collection_errors count before any test item is dispatched — on both the persistent and fork-per-request paths. Wrapper tools can no longer receive results from a silently shortened suite. The ordinary CLI keeps its native collection output.

pytest_fast_worker_shutdown hook

Fired once per worker after final fixture teardown and before the worker's successful completion frame — the place to durably flush process-local artifacts that os._exit would otherwise discard. Deliberately fail-closed: an exception means no completion frame, and the controller rejects the run as incomplete rather than accepting missing plugin output. Worker identity (--worker-identity) now also applies with a single worker, so one-worker campaigns get the same gw0 lifecycle.

PYTEST_FAST_IMMUTABLE_SOURCES — campaign mode

Opt-in: when an outer campaign fingerprints the complete source/config/runtime set before and after the daemon lifetime, the per-request source-tree mtime scan can be skipped entirely — O(tree) work off the hot path of every request. The env-fingerprint guard stays active, and the flag itself is part of the fingerprint, so toggling it forces a respawn. Intended for fail-closed tooling, not interactive development.

Leaner persistent runs

Persistent workers previously serialized full per-phase reports on every request regardless of who asked. The requested full_report flag now travels to the workers, so lean requests skip pytest_report_to_serializable work entirely; streaming requests keep full reports.

Fixes

  • The pre-warm watcher records its source-mtime baseline before announcing readiness, so an edit landing in that gap is no longer lost at startup.
  • CI preserves the matrix-selected interpreter, so the 3.11–3.14 jobs genuinely test their declared Python version.

Protocol contract

EXACT_MUTATION_PROTOCOL_VERSION = 1 is exported: compact phase results, stop-first/fresh-worker acknowledgements, collection fail-closed behavior, and exact active-item crash evidence.

Verification

Integration tests for crash attribution on both execution paths (including the duplicate-nodeid case), compact stop-first contract, lean-vs-native serialization, collection-error rejection, shutdown-hook lifecycle (1 and 2 workers), and malformed-frame rejection. Gates: make lint-heavy, make test-full (138 passed); CI matrix Python 3.11–3.14 across Linux/macOS plus stress and parity tiers — all green.