Performance refactor verification catalog¶
Historical PRF-1 test design. Some planned test names and locations below differ from the current suite; consult current verification and the test tree for executable evidence.
Revision PRF-1. Status: In review. Requirements are defined in the specification; source ownership and slice order are defined in the plan. This is a test design, not a claim that the proposed tests exist or pass.
Seams and controls¶
Use existing public Consumer workflows as the principal seam: evaluate, compare, assess, exchange evidence. Retain separate public execution/cleanup and installed-import/CLI seams for behavior the principal workflow cannot prove. Do not create one test interface per extracted file.
All candidate inputs/outputs and hostile strings must be synthetic. Use small integer examples, fixed UTC timestamps, fixed seeds and 100 bootstrap replicates where the public minimum permits. Use real reducers, serializers and compatibility logic. Filesystem tests use temporary directories; provider/device tests use the existing injected adapters. OS-failure injection targets the filesystem operation; clock control targets the timer source; concurrency uses events/barriers and cooperative awaits rather than sleeps. Optional provider/hardware tests remain separately qualified.
Functional fixtures belong beside the contract they exercise. They must not contain paths, real data, credentials, private case content, or raw exception messages. Verify semantic output and safety boundaries rather than preserving superseded module routes or byte-for-byte legacy serializations.
Verification cases¶
Each listed name is the proposed test name. Reuse an existing case when it already proves the same outcome with the same oracle; retain the verification ID in the implementation handoff. File names for new cases are planned additions, not current artifacts. Ordinary functional cases are small unit or contract tests unless noted.
V-01 — Small recommended interface¶
- Requirements: REQ-02, REQ-14, REQ-15. Decision: D-01.
- Test:
test_recommended_api_has_the_exact_identity_preserving_surfaceintests/contract/test_performance_api.py. - Import only the approved compact interface and verify each exported object is the package's canonical object. Functional evaluator, comparison, assessment, and serialization behavior remains covered by the focused unit and contract tests.
- Oracle: the approved compact export list. Rejects a second subtly different evaluator.
V-02 — Reserved historical identifier¶
The original coverage tables referenced V-02 without defining a verification case or oracle. This entry resolves that historical reference; it does not describe an implemented or passing test. Use V-01 for the proposed compact interface checks, V-19 for proposed documentation checks, and current verification for executable evidence.
V-03 — Ordinary execution semantics¶
- Requirements: REQ-06, REQ-09. Decisions: D-06/D-09.
- Test:
test_refactor_preserves_trial_order_warmup_and_failure_accountingintests/unit/test_performance_evaluation.py. - Use a stateful recording callable and custom Case/Corpus Measurements across two trials, fixed seed, warmups, one synthetic candidate failure, and one unavailable scorer. Exercise continue and fail-fast.
- Assert exact call sequence, warmup exclusion, successful/failed counts, partial status, unchanged exception classification, and no private marker in report bytes. Do not assert nondeterministic ns.
- Oracle: reviewed literal call order and count table from existing semantics; existing public tests.
- Prior art:
test_evaluator_runs_client_algorithm_and_custom_measurements,test_algorithm_and_measurement_failures_are_isolated_without_messages. - Expected pre-change: GREEN BASELINE. Rejects moving warmups into Measurements or dropping failures.
V-04 — Canonical evidence validation¶
- Requirements: REQ-05, REQ-11. Decisions: D-03/D-07.
- Tests: the report, assessment, comparison, and checkpoint unit contracts.
- Generate synthetic valid evidence, reject unsupported versions, non-finite values, malformed timestamps, inconsistent sections, invalid counts, and documents above the explicit byte ceilings.
- Oracle: the current closed schemas and safety limits. No frozen compatibility corpus is retained.
V-05 — Acyclic ownership and dynamic import detection¶
- Requirements: REQ-03, REQ-04. Decisions: D-02/D-09.
- Tests:
test_performance_dependency_rules_detect_forbidden_edgesandtest_performance_dependency_rules_allow_explicit_outer_seamsintests/unit/test_architecture_performance.py. - Build tiny synthetic source graphs covering direct/relative imports, TYPE_CHECKING, literal dynamic imports and aliases, plus layer backedges and canonical modules importing removed root routes. Run the extended checker on fixtures and the real package. Include permitted registry, CLI and MLflow/store edges.
- Oracle: the plan's explicit allowed-dependency table and current platform-wide ownership invariants.
- Controls: no execution of synthetic source. Test diagnostics' offending module and edge.
- Expected pre-change: RED for checker features not implemented; final graph fails on current backedges.
- Rejects hiding a core-to-evaluator edge with import_module or a broad exemption for integrations.
V-06 — Paired alignment and inference¶
- Requirements: REQ-06, REQ-07, REQ-08. Decisions: D-04/D-06.
- Test:
test_paired_workflow_preserves_alignment_and_private_evidenceintests/unit/test_performance_paired.py; reuse existing independent numerical cases. - Execute paired candidates over identifiable private positions with deterministic shuffle, one-sided failure, and a non-mean Consumer reducer. Check peer invocation, original pairing, incomplete evidence, rejection of report-only inference, and unchanged reducer semantics.
- Oracle: known position pairs and literal call counts; existing constant-difference and swapped-candidate interval cases. Include group resampling from existing resampling tests without splitting members.
- Controls: fixed seeds and hand-computable values; no independently bootstrapped interval subtraction.
- Expected pre-change: GREEN BASELINE. Rejects joining by result order or excluding hard cases silently.
V-07 — Compatibility diagnostics and precedence¶
- Requirements: REQ-04, REQ-07. Decision: D-04.
- Test:
test_comparison_keeps_legacy_failure_precedence_and_structured_diagnosticsintests/unit/test_performance_compatibility.py. - Compare complete compatible reports, then incomplete/case-mismatched/multiple-identity-mismatched reports. Exercise strict flags and quality/timing profiles; reject a report subclass where exact type is currently required. Assert diagnostic order, severity, fixed paths, reason and exception class.
- Oracle: reviewed existing compatibility tests and current legacy compare_reports behavior.
- Controls: literal immutable reports; no execution or collector. Unknown identity never equals verified identity.
- Expected pre-change: GREEN BASELINE unless the separately reported historical regression reproduces; record such a failure separately instead of changing its expected result.
V-08 — Slice and inference limits¶
- Requirements: REQ-07, REQ-08, REQ-09. Decision: D-05.
- Test:
test_slice_workflow_preserves_denominators_limits_and_inferenceintests/contract/test_performance_slice_rules.py. - Evaluate overlapping, empty, predicate-failed, and failure-containing slices; exercise declaration/ summary/byte limits at inclusive limit and limit+1, with small constructed summaries for cross-product tests. Confirm preflight rejects before a candidate call when computable in advance.
- Oracle: existing slice count tests, Bonferroni family tests and insufficient-unit rules. Required missing/insufficient slices remain unavailable/inconclusive; no fabricated denominator or pass.
- Controls: call counter; no real large candidate workload. Test retained size without truncation.
- Expected pre-change: GREEN BASELINE. Rejects implicit slice discovery or changed family correction.
V-09 — Assessment and uncertainty semantics¶
- Requirements: REQ-07, REQ-09. Decision: D-04.
- Test:
test_assessment_refactor_preserves_evidence_scope_and_outcomesintests/unit/test_performance_statistical_rules.py. - For absolute interval [0, 1] and threshold 0, assert inclusive pass; threshold 2 fails; threshold 0.5 is inconclusive. Exercise minimize orientation, wrong unit, unlinked document, absent relative interval, trial-variability evidence, partial candidate and failed baseline.
- Oracle: literal interval inequalities and established rule reason/status contract. Failure precedence and legacy passed boolean remain consistent with aggregate status.
- Controls: fixed linked report identities and synthetic interval records; independent of estimator RNG.
- Expected pre-change: GREEN BASELINE. Rejects promoting trial repetitions to population sample size.
V-10 — Lifecycle and asynchronous cleanup¶
- Requirements: REQ-06, REQ-08, REQ-09. Decision: D-06.
- Tests:
test_relocated_lifecycle_preserves_session_and_failure_precedenceintests/unit/test_performance_lifecycle.py; reuse async deadline/cancellation tests intests/unit/test_performance_async_evaluation.py. - Recording adapters cover setup failure, reset failure, invocation failure, teardown failure, and simultaneous primary/cleanup failure. Async fake waits on events until cancelled; assert teardown is awaited and caller cancellation propagates. Check per-item sessions remain per-item.
- Oracle: existing public lifecycle contract and literal event sequences/counters; deadline statuses remain distinct from candidate errors and queue wait from invocation duration.
- Controls: events and injected timer seams; no timing-sensitive sleeps. Expected pre-change: GREEN BASELINE.
V-11 — Checkpoint/replay and atomic file operations¶
- Requirements: REQ-05, REQ-06, REQ-11. Decisions: D-03/D-08.
- Test:
test_refactored_persistence_and_resume_keep_preflight_and_atomicityintests/contract/test_performance_resume.py; use existing checkpoint corruption tests. - A mismatched checkpoint and unsupported private-slice replay produce zero factory calls. A completed checkpoint produces zero calls; a partly complete one reruns only absent trials including warmup. Force replacement failure for each relocated writer with an existing destination and verify old bytes survive and temporary artifacts are cleaned according to the original contract.
- Oracle: fixed completed trial indices and literal factory/call counts; old file bytes.
- Controls: tmp_path, OS replacement failure fake, no mocked codec. Expected pre-change: GREEN BASELINE.
V-12 — Batch, resource, streaming and isolation contracts¶
- Requirements: REQ-06, REQ-08, REQ-09. Decisions: D-06/D-10.
- Test:
test_advanced_execution_routes_preserve_their_distinct_contractsintests/contract/test_performance_execution_compatibility.py, parameterized by mode with minimal setup. - Batch: final partial batch and invalid split/mask retain whole-batch counts/timing. Streaming: source reuse rules, moments and exact/approximate mismatch unchanged. Resources: unavailable readers and exclusive same-device peak ownership unchanged. Isolation: synthetic importable child factory with valid, oversized, malformed and timed-out outcomes through existing process harness.
- Oracle: existing batch/streaming/resources/isolation tests and public result types, not a universal EvaluationReport. Controls: deterministic fakes, fake device, actual spawned-process containment tests.
- Expected pre-change: GREEN BASELINE for the current routes; canonical route cases red until S-05.
V-13 — Serving accounting and separation¶
- Requirements: REQ-08, REQ-09, REQ-12. Decision: D-06/D-10.
- Test:
test_serving_namespace_preserves_accounting_and_all_sweep_pointsintests/contract/test_performance_serving_delivery.py. - Exercise existing bounded constant/Poisson/closed-loop fake-client scenarios with saturation, timeouts and a multi-point sweep. Verify count conservation, retained failed points, separate schedule and dispatch latency, and generator-limited inconclusive outcomes.
- Oracle: existing serving accounting equations and schema identity; no conversion to Collector evidence.
- Controls: existing coordinated fake client/small local bounds, no endpoints. Expected pre-change: GREEN BASELINE for the current routes; new sweep namespace red until S-05.
V-14 — Dependency-free import and absent effects¶
- Requirements: REQ-09, REQ-10, REQ-13. Decision: D-08.
- Test:
test_root_and_canonical_imports_remain_side_effect_freeintests/delivery/test_performance_adapter_packaging.py. - Fresh subprocess blocks torch/sklearn/psutil/pynvml/mlflow/pytest/datasketches/OpenTelemetry imports and instruments host probes, metadata discovery, subprocess/thread startup and filesystem writes. Import root, recommended, and canonical routes, construct and execute a pure custom Measurement evaluation.
- Oracle: no forbidden effects/imports and correct simple score; missing selected optional packages still return the exact established extra when explicitly loaded.
- Controls: distinguish harmless interpreter/module file reads from collection or artifact I/O; do not deny Python's import machinery itself. Expected pre-change: GREEN root routes, RED recommended route.
V-15 — Framework, LLM and telemetry integration contracts¶
- Requirements: REQ-08, REQ-09, REQ-10. Decision: D-08.
- Test:
test_relocated_integrations_preserve_safe_projection_and_lazy_loadingintests/contract/test_performance_integration_compatibility.py; reuse framework reference suites. - Verify sklearn reference scores/undefined cases, Torch setup/synchronization semantics using existing fakes, private LLM results versus serialized aggregates, usage budgets, cancellation and telemetry schema preflight. Disabled adapters remain effect-free. Reject prompt/decision/error markers in output.
- Oracle: existing external-package reference tests and literal budget/call counts; mocks do not qualify hardware. Controls: optional-package CI cells; injected fake providers, no network or real secrets.
- Expected pre-change: GREEN current routes; canonical routes red until S-06.
V-16 — History, export and presentation¶
- Requirements: REQ-05, REQ-09, REQ-11. Decision: D-08.
- Test:
test_tooling_migration_preserves_history_export_and_presentationintests/contract/test_performance_reporting.py; retain separate existing history/MLflow cases. - Store fixed reports, pin one, preview and explicitly prune eligible records; corrupt bytes and verify digest rejection. Inject confirmed/uncertain export acknowledgements and verify retries, indeterminate result, and unchanged local document. Render hostile safe-label characters to Markdown and HTML.
- Oracle: known pinned digest and prune targets, closed metadata projection, literal escape results, semantic self-contained HTML contract. Controls: tmp_path and injected client; no live MLflow.
- Expected pre-change: GREEN BASELINE. Do not combine unrelated state assertions into an opaque mega-test; split parameterized workflows using existing cases where appropriate.
V-17 — CLI compatibility¶
- Requirements: REQ-01, REQ-09, REQ-11, REQ-13. Decision: D-08.
- Test:
test_console_and_module_cli_keep_legacy_contractsintests/delivery/test_performance_cli.py. - Parameterize console/module invocation with run/compare/assess/render/history, checkpoint resume, paths containing spaces, invalid input, candidate failure and rejected/inconclusive assessment. Verify the current command's stdout JSON, bounded stderr and exact exit code using existing expected values. Evidence/history/policy loading cannot call a malicious import hook.
- Oracle: existing CLI command cases and baseline literals; no auto-updating snapshots.
- Controls: installed subprocess plus synthetic trusted factory; no evaluation on command import.
- Expected pre-change: GREEN BASELINE. Rejects losing the canonical module main guard during relocation.
V-18 — Public typing and actual domain types¶
- Requirements: REQ-01, REQ-03, REQ-04, REQ-13. Decision: D-02/D-09.
- Test:
test_public_consumer_typing_resolves_canonical_domain_typesintests/delivery/test_performance_public_typing.py. - Run strict mypy on small installed-package Consumer snippets implementing structural Measurement and AssessmentRule, using paired evidence and root/canonical imports. Positive snippets pass; deliberately wrong report/goal/context inputs produce expected type errors at marked sites. Resolve annotations where the existing public contract supports introspection.
- Oracle: public typed contracts and intended error sites, not complete diagnostic prose.
- Controls: isolated fixture module, configured supported interpreter, inline typing marker present.
- Expected pre-change: selected negative cases expose erased domain Any; record observed baseline. Rejects replacing known domain types with object, cast(Any), broad ignores or new cycles.
V-19 — Documentation and complete source ownership¶
- Requirements: REQ-02, REQ-03, REQ-14, REQ-15. Decisions: D-01/D-09.
- Evidence:
make docs-check, ownership-map review, old import manifest review, maintained example run. - Compare all 41 current source dispositions with implemented canonical owners and compatibility paths. Ordinary example uses recommended names; advanced examples name their specific namespaces and distinct result limitations. No duplicate policy code or misleading automatic streaming/batch claims.
- Oracle: PRF-1 ownership table and exact 22-name interface, plus preserved public behavior.
- Expected pre-change: documentation check green; new documented layout/example acceptance absent.
- Owner: implementer prepares inventory, maintainer reviews ownership; no arbitrary module-count target.
V-20 — Source-independent distribution and final gates¶
- Requirements: REQ-01, REQ-10, REQ-13, REQ-14. Decision: D-01/D-09.
- Evidence: existing installed-package verifier extended to cover root and canonical imports,
make build,make smoke, and existing Python/optional-integration CI cells. - Build wheel/sdist with no source dependencies, install base wheel without extras, run from a directory outside the checkout with source path unavailable. Import direct framework modules without loading frameworks, run custom Measurement/report round trip, and invoke console/module CLI.
- Oracle: supported Python range, zero mandatory dependencies, explicit extras, public identity and evaluated score, typing marker and CLI registration. Verify sdist includes canonical packages.
- Controls: clean temporary environment, no network/provider credentials in execution tests; preserve CI's real supported matrix. Expected pre-change: root smoke green; new routes red until implemented.
- Owner: implementer records local artifacts; CI owns matrix evidence. Hardware and hosted service qualification remain explicitly unclaimed.
Traceability¶
| Requirement | Design decisions | Verification | Coverage intention |
|---|---|---|---|
| REQ-01 | D-01, D-09 | V-01, V-17, V-18, V-20 | Complete public compatibility manifest plus workflow/installed evidence |
| REQ-02 | D-01 | V-02, V-19 | Exact recommended interface and runnable documentation |
| REQ-03 | D-02, D-03, D-05, D-09 | V-05, V-18, V-19 | Real graph and checker fault cases |
| REQ-04 | D-02, D-04 | V-05, V-07, V-18 | Dynamic resolution removal plus strict typing |
| REQ-05 | D-03, D-07 | V-04, V-11, V-16 | Canonical bytes/digests, old formats, atomicity |
| REQ-06 | D-06 | V-03, V-06, V-10, V-11, V-12 | State, order, seeds and cleanup |
| REQ-07 | D-04, D-05 | V-06, V-07, V-08, V-09 | Inference, compatibility and policy |
| REQ-08 | D-05, D-06, D-10 | V-06, V-08, V-10, V-12, V-13, V-15 | Specialist contracts preserved |
| REQ-09 | D-07, D-08 | V-03, V-08–V-17 | Privacy, bounds and effects at existing seams |
| REQ-10 | D-08 | V-14, V-15, V-20 | Fresh-process and base-wheel import isolation |
| REQ-11 | D-08 | V-04, V-11, V-16, V-17 | Persistence, tooling and export state |
| REQ-12 | D-06, D-10 | V-13, V-19 | Evidence kinds and documentation remain separate |
| REQ-13 | D-01 | V-01, V-14, V-17, V-18, V-20 | Installed interface, typing and package metadata |
| REQ-14 | D-09 | V-02, V-19, V-20 | Traceable evidence and truthful docs |
| REQ-15 | D-10 | V-02, V-12, V-19 | No universal result, feature deletion or semantic expansion |
This table describes planned coverage. It becomes completed evidence only when an implementation handoff names each executed test/artifact and result; unrun optional cells remain explicitly partial.
Commands and implementation gates¶
Before any Python toolchain command, resolve PyCharm's configured interpreter using the python-tools
skill. The planning environment is Python 3.14.7 at the repository's .venv/bin/python, managed by uv.
Use the committed Make targets, with UV_PYTHON set to that resolved executable when needed; do not
install packages or change the interpreter merely to make a test pass.
Verified planning baseline commands:
| Command | Result |
|---|---|
git status --short |
Clean before documentation edits |
git rev-parse HEAD |
Inspected revision recorded above |
| AST inspection with configured Python, standard library only | Mapped imports, dynamic internal imports and public definitions across 41 modules |
UV_PYTHON=/Users/pierre-luc-delisle/PycharmProjects/telemetry/.venv/bin/python make architecture-check test-focused TEST=tests/unit/test_performance_evaluation.py |
Architecture passed; 11 tests passed |
UV_PYTHON=/Users/pierre-luc-delisle/PycharmProjects/telemetry/.venv/bin/python make docs-check |
Passed; 50 Markdown files validated |
git diff --check |
Passed for tracked edits; new document whitespace additionally inspected |
Focused implementation commands, selected by slice rather than all repeated after every edit:
| Slice | Committed command selection |
|---|---|
| S-01/S-02 | make test-focused TEST=tests/unit/test_performance_evaluation.py; new public/evidence contract files once added |
| S-03 | make test-focused TEST=tests/unit/test_performance_compatibility.py; paired/difference/resampling/statistical/slice suites as affected; make type-check |
| S-04 | make test-focused TEST=tests/unit/test_performance_lifecycle.py; make test-focused TEST=tests/contract/test_performance_resume.py; ordinary/paired regression suites |
| S-05 | make test-focused TEST=tests/unit/test_performance_async_evaluation.py; batch/resources/streaming/isolation/serving suites as affected |
| S-06 | make test-focused TEST=tests/delivery/test_performance_adapter_packaging.py; affected optional integration contract cells |
| S-07 | make test-focused TEST=tests/delivery/test_performance_cli.py; checkpoint/history/reporting/MLflow suites |
| S-08 | make architecture-check; make docs-check; new public compatibility/typing tests |
| S-09 | make test-static; make test-unit; make test-integration; make build; make smoke |
make test-focused takes one path/node selector; run another invocation for another file. make smoke
already depends on build; record that rebuild honestly rather than implying it is a distinct extra
qualification. Do not repeatedly broaden passed suites without a new edit or unresolved concern.
At S-01 establish full baseline gates and record unrelated failures without changing their oracles.
At S-09 all applicable gates must be green or an explicit separately owned blocker must be reported;
a refactor is not complete with unexplained regressions. Supported Python and optional-extra matrix
evidence comes from the existing CI, not from one local interpreter. Docker and make verify are not
required solely for this package refactor; run make test-docker if Collector assets enter scope.
No production-source edits, new tests, full suites, optional-package qualification, builds, Docker, or live-provider/device checks were performed as part of preparing this catalog.