Performance package refactoring plan¶
Historical design record: the split core, execution, analysis, serving, integrations, and
tooling namespaces and the compact telemetry.performance.api interface now exist. The status,
source inventory, and proposed test names below describe the 2026-09-21 planning baseline, not the
current implementation. Use the descriptive specification and current source
for implemented behavior; this record does not assert that every PRF-1 acceptance case was completed.
The proposed old file layout and compatibility facades below are historical proposals, not a promise that those per-file import routes exist today. Consult the current source inventory for implemented modules and the root and compact API exports for supported interfaces.
Control and authority¶
| Field | Value |
|---|---|
| Revision | PRF-1, 2026-09-21 |
| Status | In review; implementation specification prepared, not self-approved |
| Decision owner / reviewer | Pierre-Luc Delisle |
| Implementation owner | Telemetry maintainer or assigned implementation agent |
| Governing request | Architecture review followed by the user's request for a full refactoring plan and implementation-ready specifications |
| Tracker | PL-220 |
| Inspected source revision | 46e388e2985cc8bb6e206be3e472a0f17a169caa |
| Change class | Standard brownfield architecture refactor; public compatibility, serialization, lifecycle, and packaging risks |
| Requirements | Specification PRF-1 |
| Verification | Verification catalog PRF-1 |
The user authorized planning and specification publication through $to-spec, not production-code
implementation. This document proposes a technical design; it does not claim reviewer approval or
implementation completion. Linear remains the authoritative work tracker. These documents are the
versioned technical attachment, not another backlog. Preserve PL-220's project, parent, priority,
status, labels, and existing relation to PL-110 when publishing.
The testing-seam check requested by $to-spec was presented to the user: public evaluation,
comparison, assessment, and evidence exchange, supplemented by import/CLI and lifecycle contracts.
No response is recorded in this revision. These are proposed seams, not claimed approval.
1. Outcome, scope, and invariants¶
Reduce the concepts needed for ordinary Performance Evaluation and give each implementation decision one owner. Preserve every currently supported capability and all existing public import routes. The success measure is understandable ownership and enforceable dependencies, not a smaller raw file count. Compatibility facades will temporarily increase the number of files; they must contain no second implementation of evaluation policy.
In scope: the complete current telemetry.performance package, its public typing/import contracts,
its installed CLI, tests, examples, package verification, and affected descriptive documentation.
Out of scope: new evaluation capabilities, changed score/statistical algorithms, changed concurrency
semantics, feature deletion, dependency upgrades, distribution splits, Collector changes, deployments,
or fixing unrelated baseline failures. See specification REQ-01 through REQ-15.
The governing constraints are CONTEXT, the evaluation/capacity ADR, the public contract, data safety, and release contract. The descriptive specification book must continue to describe implemented behavior. Do not rewrite it as though this proposed organization already exists.
Preserve Consumer ownership of cases, expected values, Measurement semantics, identities, and Assessment Rules. Preserve private in-process observations versus payload-free published evidence. Preserve all ceilings, default values, closed enums, unavailable reasons, exception classifications, validation order where observable, seed derivations, and existing opt-in collection/export behavior. Keep Performance Evaluation separate from both serving-load observations and telemetry Capacity Evaluation. Neither repetitions nor matching hardware prove production capacity or population quality.
2. Evidence-backed current state¶
The clean inspected tree has 41 package Python files, 22,761 physical lines, 354 root __all__
entries, and a 3,864-line evaluation module. The core evaluation characterization suite passes
11 tests on Python 3.14.7. The current architecture check passes, but its AST traversal only sees
ordinary imports; it cannot establish that the dynamic-import graph is acyclic.
| Current ownership | Evidence | Consequence |
|---|---|---|
| Evaluation records, Measurements, reports, execution, comparison, rules, codecs, and file I/O coexist | evaluation.py, including PerformanceEvaluator, EvaluationReport, compare_reports, assess, load_report |
Extract ownership before relocating extension files |
Domain types erased to Any; dynamic type resolution avoids cycles |
paired.py, comparison.py, compatibility.py, assessment.py |
Move records below their consumers; use actual generic types and ordinary imports |
| Checkpoints already use a narrow report Protocol | checkpoints.py:CheckpointReport |
Preserve this useful seam rather than introducing a new persistence service hierarchy |
| Synchronous evaluation returns reports; async returns private results; batch returns aggregate timing | evaluation.py, async_evaluation.py, batch.py |
Preserve distinct return contracts; do not claim a universal runner |
| Streaming has separate sources, moments, and KLL utilities | streaming.py; evaluator constructor freezes cases into a tuple |
Document its separate role; no implied streaming evaluator |
| Optional imports occur only through explicit loaders/readers | integrations.py, framework adapters, packaging tests |
Keep base installation dependency-free and import-time side effects absent |
| Canonical JSON is used as digest input | comparison report identity, AssessmentDocument, history, checkpoints | Byte stability matters, not only semantic JSON equality |
| Canonical modules are imported directly by source, tests, scripts, and examples | AST dependency inspection and repository text search | Remove root implementation routes after callers move to canonical namespaces |
| CLI supports console and module execution | pyproject.toml, tooling/cli.py main guard |
Preserve telemetry-eval and canonical module invocation |
Conceptual current dependency problem (arrows mean depends on):
flowchart LR
E[Evaluation: records + runner + reports + rules] --> A[Assessment]
E --> P[Paired evidence]
E --> K[Compatibility]
A -. dynamic type resolution .-> C[Comparison]
C -. dynamic type resolution .-> E
P -. dynamic type resolution .-> E
K -. dynamic type resolution .-> E
The original PL-220 description mentions an earlier compatibility regression. This planning run did not reproduce or resolve that historical failure. The implementation baseline must establish its current state; existing failures are not permission to change compatibility semantics in this refactor.
3. Selected architecture¶
3.1 Decisions and alternatives¶
| Decision | Commitment | Requirements |
|---|---|---|
| D-01 | Keep one distribution with a root public API and canonical advanced namespaces; introduce a compact recommended interface | REQ-01, REQ-02, REQ-13 |
| D-02 | Separate pure contracts/evidence from execution, analysis, and external effects | REQ-03, REQ-04, REQ-09 |
| D-03 | Co-locate report model validation and its in-memory codec to avoid a model-to-codec cycle | REQ-03, REQ-05 |
| D-04 | Give comparison one policy owner and assessment one policy owner; preserve distinct descriptive and paired interfaces | REQ-04, REQ-07 |
| D-05 | Consolidate slice declaration/planning and consolidate slice inference/comparison; retain numerical algorithms as cohesive modules | REQ-03, REQ-07, REQ-08 |
| D-06 | Keep execution modes explicit; share only verified invocation, trial, and reduction mechanics | REQ-06, REQ-08 |
| D-07 | Preserve separate report, comparison, assessment, checkpoint, serving, and LLM evidence schemas | REQ-05, REQ-09 |
| D-08 | Group optional integrations and tooling; preserve lazy package resolution and Consumer-controlled side effects | REQ-09, REQ-10, REQ-11 |
| D-09 | Add characterization before moves; change canonical ownership once per symbol; forbid internal imports through removed root routes | REQ-01, REQ-03, REQ-14 |
| D-10 | Preserve all current features; make follow-on capability integration a separate decision | REQ-15 |
Alternatives considered:
- Merge everything into a few large files: lowers file count but preserves tangled responsibilities and the broad interface; rejected.
- Move current files unchanged into folders: improves navigation but leaves cycles and duplicated ownership; insufficient as the selected design.
- Remove specialist features or split distributions: risks unknown Consumers and adds packaging and version coordination; not authorized by this refactor.
- Add a universal runner, plugin registry, or universal evidence envelope: would invent behavior and extension mechanisms with different lifecycle and privacy semantics; rejected.
- Immediately remove old exports: simplest final interface but breaks the installed contract; rejected.
3.2 Recommended interface and compatibility¶
Add telemetry.performance.api with exactly these 22 recommended exports:
EvaluationCase, EvaluationPlan, PerformanceEvaluator, EvaluationReport, EvaluationStatus,
Measurement, MeasurementGoal, CaseMeasurement, CorpusMeasurement, latency_measurement,
DatasetIdentity, CandidateIdentity, MeasurementIdentity, RandomnessPlan, SliceSpec,
ThresholdRule, RegressionRule, Assessment, compare_reports, assess, load_report,
write_report.
This is a discoverability facade, not a second evaluator or new convenience workflow. Existing
signatures and returned objects are re-exported unchanged. Advanced features use explicit namespaces
listed below. Existing root __all__ membership and order remain unchanged in this revision; all 354
names keep working. Explicit imports from old modules also remain supported. No warning is emitted
for old imports, and no removal schedule is implied. Retire facades only in a separately authorized
breaking change informed by Consumer usage.
Re-export the identical class/function/enum objects, never subclasses or wrappers that change
identity, equality, exception catching, decorators, or singledispatch registration. Preserve historical
public class __module__/__qualname__ values where moving definitions would change them, using
literal compatibility metadata at the canonical definition rather than importing the facade. Retain
old qualified paths for any existing serialized Python references without adding a pickle persistence
channel. Preserve call signatures, keyword-only markers, defaults, dataclass fields and order, enum
values, and resolvable public annotations. Resolved annotations may become more precise where the
current domain type is erased to Any; this must not narrow the valid runtime input set.
Do not promise compatibility for arbitrary mutation of private module globals. Existing tests that patch clocks, package readers, filesystem failures, or subprocess boundaries must still inject at the actual owning seam. Retain public collaborator lookups when their substitution is part of an existing documented contract. Audit each monkeypatch before changing its target; do not weaken its assertions.
3.3 Target ownership and allowed dependencies¶
The following are implementation locations, not new independently versioned products. Namespace
initializers expose curated interfaces and import canonical owners; implementation modules import
specific canonical modules, never the root, api, a removed root route, or a broad namespace initializer.
| Namespace | Owns | Allowed dependencies inside performance |
|---|---|---|
core |
Contracts, pure identity records, private/published evidence, numerical mechanics, in-memory codecs | Other core owners only, in the acyclic order below |
execution |
Candidate invocation, lifecycle, trials, pairing, replay, async/batch/isolation/resource/streaming execution | Core; execution internals; narrow optional-package registry for explicit reader/sketch loading |
analysis |
Compatibility diagnostics, descriptive/paired comparisons, slice inference, Assessment Rules | Core; other analysis owners in one direction |
serving |
Arrival generation, accounting, rate/concurrency sweeps | Core; serving internals |
integrations |
Framework Measurements/adapters, LLM observations/judges, host/provenance collection, telemetry and MLflow export | Core; execution or analysis as actually needed; storage for MLflow report retrieval; registry |
tooling |
File persistence, report history, presentation, CLI | Core; analysis; serving evidence; execution only for the CLI's explicit run workflow |
Compatibility root and api |
Re-exports only | Canonical owners; no implementation owner may depend back on these |
Special cases are explicit, not permission for package-wide cross-links: the registry imports only the standard library; execution may call it for optional resource/sketch packages. MLflow export may read local report history; history must never depend on MLflow. The CLI may invoke an explicit Consumer factory; evidence readers may never import code named by report content. Environment collection lives outside core, but its immutable collection result type lives with identity records so evaluator input normalization does not import the collector.
Core import direction:
statistics,randomness,resampling,quantiles, and pureidentityare leaves except for dependencies among numerical owners that remain acyclic.contractsdepends on randomness, identity, statistics/resampling as required; it has no report, slice, paired, execution, policy, or persistence dependency.slicesdepends on contracts and uncertainty; it owns declarations, membership, capacity plans, slice summary records, and size-validation through the existing narrowto_jsonProtocol.reportsdepends on contracts, identity, and slices. It ownsEvaluationReport, capabilities, execution evidence, validation, schema dispatch, and deterministic in-memory report codecs.paireddepends on contracts, reports, and slices. It owns private paired observations and reduction; reports must not import paired evidence.checkpointsdepends on contracts, identity, and randomness, retaining its narrow report Protocol. It owns checkpoint validation/codecs, but never file I/O or the evaluator.
Analysis import direction: compatibility reads core reports; comparison reads compatibility and core
paired evidence; slice analysis reads comparison and core evidence; assessment reads those analysis
results. None imports candidate execution. Place AssessmentContext, AssessmentRule, base rules,
advanced rules, outcome derivation, and AssessmentDocument together in the assessment owner. The
context may reference the canonical comparison document directly; comparison does not import assessment.
3.4 Complete source disposition¶
Paths below are relative to src/telemetry/performance. Every current file is accounted for. Old
files become compatibility facades unless noted. Where a module becomes a package, preserve its exact
import name through the package initializer and remove the same-name source file in that atomic move.
| Current file | Canonical destination / ownership after refactor |
|---|---|
__init__.py |
Preserve all exports as explicit compatibility re-exports; new api.py is the recommended small surface |
adapters.py |
execution/adapters.py; combine existing lifecycle wrapper here |
assessment.py |
analysis/assessment.py; absorb context, base rules, and assess from evaluation |
async_evaluation.py |
execution/async_evaluation.py |
batch.py |
execution/batch.py |
checkpoints.py |
Pure types/codecs to core/checkpoints.py; load_checkpoint/write_checkpoint to tooling/persistence.py |
cli.py |
tooling/cli.py; old shim retains main and module main guard; console entry point remains unchanged |
comparison.py |
analysis/comparison.py; absorb descriptive comparisons; file load/write to persistence |
compatibility.py |
analysis/compatibility.py; also owns ReportCompatibilityReason/Error and legacy error translation |
curation.py |
integrations/curation.py; unchanged Consumer handoff manifest |
environment.py |
Pure records/profile comparisons to core/identity.py |
environment_collection.py |
Result records/readers' type contracts to core/identity.py; collection behavior to integrations/environment.py |
evaluation.py |
Detailed split below; retain historical explicit exports in compatibility facade |
evaluation_records.py |
core/contracts.py |
history.py |
tooling/history.py |
identity.py |
core/identity.py |
integrations.py |
Convert to integrations/ package; closed registry to integrations/_registry.py; initializer preserves old registry exports only |
isolation.py |
execution/isolation.py; decode through pure report codec, without importing evaluator |
lifecycle.py |
Consolidate into execution/adapters.py |
lifecycle_timing.py |
Pure timing declarations/comparison to core/identity.py |
llm.py |
integrations/llm.py; preserve standalone stream/judge evidence and private results |
mlflow_export.py |
integrations/mlflow.py; explicit injected-client export |
paired.py |
core/paired.py; retain private observations/reducers, no runner imports |
provenance.py |
Pure records/version/allowlist to core/identity.py; collectors to integrations/provenance.py |
randomness.py |
core/randomness.py |
ranking.py |
integrations/ranking.py; remains dependency-free despite namespace placement |
reporting.py |
tooling/presentation.py |
resampling.py |
core/resampling.py |
resources.py |
execution/resources.py; optional loaders remain explicit |
serving.py |
Convert to serving/ package; scheduler/evidence to serving/runner.py; initializer preserves exports |
serving_sweep.py |
serving/sweep.py |
sklearn.py |
integrations/sklearn.py; do not split by metric merely for smaller files |
slice_comparison.py |
analysis/slices.py with slice inference/sufficiency |
slice_planning.py |
Consolidate into core/slices.py |
slice_sufficiency.py |
Consolidate into analysis/slices.py |
slices.py |
core/slices.py |
statistics.py |
core/statistics.py; old path remains usable by Capacity Evaluation scripts |
streaming.py |
execution/streaming.py; remains a separate bounded primitive toolkit |
sufficiency.py |
core/quantiles.py; mathematical quantile evidence, independent of policy |
telemetry.py |
integrations/telemetry.py; preserve disabled adapters and schema preflight |
torch.py |
integrations/torch.py; preserve direct-module exports absent from root |
The identity owner may be long because it owns a cohesive closed reproducibility vocabulary. Do not introduce a class per field or split it into arbitrary size-based files. Its collection mechanisms are separate because they perform optional host/package/subprocess effects, not because of line count.
Evaluation extraction inventory:
| Current symbols/responsibility | New owner |
|---|---|
| MeasurementGoal, EvaluationStatus, EvaluationCase/Observation, Measurement Protocol, CaseMeasurement, CorpusMeasurement, latency_measurement, MeasurementSummary; imported evaluation records | core/contracts.py |
| SliceMeasurementSummary, SliceResult | core/slices.py |
| EvaluationReport, EvidenceCapabilities, ExecutionEvidence; report version constants; report/plan/trial/failure/uncertainty codecs and validation | core/reports.py |
| PerformanceEvaluator and ReplayableEvaluation public orchestration | execution/evaluator.py |
| Ordering, warmups, measured trial invocation, paired execution, shared observation reduction | execution/_trials.py |
| MeasurementComparison, PerformanceComparison, compare_reports | analysis/comparison.py |
| ReportCompatibilityReason/Error, strict checks and legacy exception mapping | analysis/compatibility.py |
| AssessmentContext, AssessmentRule, ThresholdRule, RegressionRule, assess | analysis/assessment.py |
| write_report/load_report file effects | tooling/persistence.py |
| load_report_json and internal parse dispatch | core/reports.py |
Private helpers follow their invariant owner. Do not create a generic utilities module. Consolidate validation helpers only when accepted input sets, messages/categories, bounds, and rejection ordering are demonstrably identical. Similar-looking validators for report labels, identities, and credentials have different policies and must not be homogenized.
4. Contracts implementation must preserve¶
4.1 Execution and reduction¶
PerformanceEvaluator retains its constructor and all current methods: evaluate, evaluate_adapter,
evaluate_lifecycle_adapter, evaluate_pair, empty_checkpoint, and evaluate_replayable. The evaluator
freezes cases/Measurements/plan and preflights capacities and identities before candidate work. A
private immutable execution contract may carry those validated values to _trials; it must not
contain a reference to the evaluator or a bag of arbitrary callbacks. Keep the existing narrow invoke
callable accepting input, trial index, case index, and phase. No global execution registry is added.
Trial helpers return typed private observations, safe TrialResult/Failure records, and declared slice reductions. They do not write files, export telemetry, collect the environment, or choose assessment policy. Report assembly summarizes scores and status through core records; it cannot silently replace a scorer, resampling unit, or elapsed-time denominator. Preserve timestamp and timer scopes, including the existing zero elapsed duration for an already-complete resumed checkpoint.
| Mode | Preserved behavior |
|---|---|
| Ordinary callable | Serial calls; no implicit setup or global seeding; candidate determinism remains unspecified |
| Synchronous adapter | Explicit capability negotiation and current per-invocation session behavior |
| Lifecycle adapter | One successful setup, optional reset once per trial, warmups then measured calls, one teardown; original failure precedence |
| Paired | Identities before either candidate; interleaved seeded order; peer still runs when one fails; only successful aligned pairs enter private evidence |
| Replay | Validate identity/counts before factory; completed trials skipped; incomplete trial restarts including warmup; private slice replay still rejected |
| Async | Current bounded queue/workers; separate admission/queue/invocation times; cooperative deadlines, caller cancellation, awaited teardown |
| Batch | Consumer collate/predict/split; cardinality/mask validation; one batch failure accounts for every case; no divided per-case latency |
| Isolation | Spawned direct child, deadline/cleanup, bounded validated JSON pipe; no new pickle output or security-sandbox claim |
| Resources/streaming | Existing availability, ownership, sampling/sketch ceilings and explicit starts; no invented peak or automatic integration into evaluator |
4.2 Evidence, identity, and comparison¶
Core reports own their model validation plus deterministic to_dict, to_json, and in-memory reader.
Keeping those methods with the codec is intentional: a model importing an external codec that imports
the model would recreate the cycle. Persistence accepts bytes/text from the owning serializer; it does
not reimplement version dispatch. Comparison, assessment, checkpoint, serving, and LLM documents retain
their separate owners and schema identifiers. Do not replace them with a catch-all evidence envelope.
The report writer preserves canonical JSON bytes for a fixed report, including omission rules, ordering, float representation, and nested version/capability behavior. File writers preserve their existing newline policy and return values. Digest inputs remain byte-identical; do not normalize a legacy document merely because it is read. Legacy v1 and every currently supported v2 option remain readable; unknown versions/keys, non-finite JSON, impossible counts, and oversized input reject as before. Keep report and comparison 16 MiB ceilings, checkpoint and assessment 1 MiB ceilings, and all current lower-only Consumer limits.
Comparison's canonical compatibility validator returns the current ordered diagnostics. Legacy compare_reports applies the existing failure precedence and ValueError-compatible reason mapping; do not remove observable legacy checks just to deduplicate syntax. Preserve exact-type checks where currently used rather than broadening them to duck typing. Missing identity is unknown, not equality. Quality/timing profiles retain their different requirements and warnings.
Paired-population inference consumes private paired evidence; standalone reports never reconstruct pairing. Preserve original aggregation in shared resamples, group units, oriented differences, resampled ratios, zero-denominator unavailability, Bonferroni family policy, independent counts, and slice insufficiency. Assessment consumes linked compatible evidence, applies existing inclusive thresholds, and never passes partial/failed or missing required evidence.
4.3 Persistence and other effects¶
tooling/persistence.py owns existing report/comparison/checkpoint filesystem functions, preserving
function signatures and atomic replacement, parent-directory behavior, cleanup, byte ceilings, and
errors. A small private atomic-write helper may be shared only after characterizing the three writer
contracts; no new repository interface is needed. ReportStore retains its own index, digest checks,
pinning, quotas, preview, and explicit prune behavior and can reuse a proven helper without changing
transaction semantics. No automatic deletion, network upload, collector creation, or runtime startup.
Host/dependency collection remains explicitly requested. LLM provider calls and MLflow delivery still use injected Consumer clients. Preserve usage reservations, retry/deadline bounds, cancellation, indeterminate acknowledgement behavior, and safe projections. Telemetry remains an explicit adapter over Consumer schema; disabled adapters remain side-effect free. Credential-shaped data, private case content, candidate outputs, prompt/completion content, and exception messages cannot enter new logs, fixtures, digests, or persisted evidence.
5. Verification strategy and migration¶
The verification catalog supplies requirement/risk coverage, exact proposed test names, data, oracles, existing prior art, and commands. Characterization uses externally observable contracts, not snapshots of private helper names. Architecture tests are the deliberate exception: dependency direction and forbidden domain-type erasure are themselves requirements.
Strengthen scripts/validate_architecture.py to resolve static and literal dynamic internal imports,
including importlib.import_module aliases, package-prefix effects and relative imports. Reject
nonliteral performance-internal dynamic imports outside the explicit compatibility resolution policy;
this design uses static facades, so none are needed. Keep legitimate optional-package loading and
the CLI's explicitly requested Consumer factory separate. Count TYPE_CHECKING imports consistently
with the existing static policy. Avoid false-positive wildcard namespace bans for the narrow registry
and documented CLI/storage dependencies. Add small synthetic graph fixtures for allowed and forbidden
edges; verify the real package as well.
Do not add a measured speedup claim. Import-effect tests must show no optional framework/provider import, host probing, thread/process startup, I/O, or evaluation work. Existing observer and numerical limits stay fixed. If moves add calls inside measured hot loops, move delegation outside the timing window or compare a controlled synthetic before/after workload; disclose noise rather than adopting an arbitrary performance threshold.
5.1 Ordered implementation slices¶
Each slice must leave the installed old interface working. Keep changes locally reversible and avoid mixing mechanical relocation with changed policy. Add a discriminating new test, observe its expected red when applicable, implement, then run focused regression checks. Characterization starts green; do not invent a red failure for unchanged behavior.
| Slice | Scope and concrete exit condition | Depends on | Verification |
|---|---|---|---|
| S-01 | Capture public export/signature/enum/dataclass baseline and reviewed safe evidence fixtures; establish baseline failures separately | None | V-01, V-03, V-04; existing focused tests |
| S-02 | Extract canonical contracts, identity, slices, reports and checkpoint values/codecs; keep old re-exports; no runner backedges | S-01 | V-01, V-03–V-05, V-07, V-11 |
| S-03 | Move paired evidence and comparison/compatibility/assessment to one-way ownership; remove dynamic domain-type lookups and Any aliases | S-02 | V-05–V-09, V-18; strict mypy |
| S-04 | Move evaluator orchestration and trial mechanics; merge lifecycle with adapters; preserve all ordinary/paired/replay paths | S-03 | V-03, V-06, V-08–V-11 |
| S-05 | Group async/batch/isolation/resources/streaming and serving; preserve standalone results and timing scopes | S-04 | V-10, V-12, V-13; related existing suites |
| S-06 | Group optional integrations and split collection from pure identities; preserve registry and framework direct imports | S-05 | V-01, V-14, V-15; optional integration contracts |
| S-07 | Consolidate file writers/readers, history, presentation, CLI; preserve command forms and output/exit contracts | S-06 | V-04, V-11, V-16, V-17 |
| S-08 | Add 22-name recommended interface; migrate maintained examples and internal imports; enforce final graph and update inventory | S-07 | V-02, V-05, V-14, V-18, V-19 |
| S-09 | Clean installed-wheel verification, complete gates, compatibility metadata and documentation handoff | S-08 | V-20; all applicable repository gates |
This is a dependency-ordered plan within PL-220, not a request to spawn agents or create duplicate implementation tickets. If later split into issues, transfer these exact dependencies into Linear blocking relations. Do not mark the parent complete until all slices' evidence exists.
5.2 Rollout, rollback, and compatibility version¶
No data migration or feature flag is required because stored formats and runtime behavior remain unchanged. Install the resulting wheel as a normal versioned candidate and run old and new import examples against that wheel outside the source directory. Do not publish it as part of this work.
Update compatibility.toml when the additive public interface lands: increment
consumer_integration_contract once from inspected 34 to 35 if still current; if another accepted
change has incremented it, use the next integer without reverting that change. Do not change any
report schema, platform version, optional integration contract, dependency range, or Collector tuple
solely for file moves. Update the descriptive public API, safety/lifecycle references where relevant,
packaging chapter, and inventory together with implemented ownership. The README's old contract
example must be synchronized as part of this metadata update, not treated as authority over TOML.
Rollback trigger: import/signature incompatibility, serialized digest change, altered failure/order semantics, leakage, dependency regression, or a failing required gate. Roll back the most recent cohesive implementation slice using a normal reviewed revert; never rewrite unrelated work. Existing evidence remains readable by the prior wheel. After Consumers adopt the additive interface, rollback to a pre-interface wheel would break those new imports; retain the additive facade on rollback or coordinate those Consumer changes first. Do not delete history/checkpoints during rollback.
6. Risk ownership and completion criteria¶
| Risk | Detection / mitigation | Owner |
|---|---|---|
| Duplicate class objects or broken direct imports | Complete export manifest and cross-path identity/signature tests | Implementer |
| Cycles hidden behind Any/dynamic loading | Graph checks plus strict typed consumer samples | Implementer / reviewer |
| Report byte drift invalidates digest links | Fixed-version fixtures, canonical bytes/digests, previous-format round trips | Implementer |
| Changes to timing, seeds, callback counts, exception precedence | Deterministic lifecycle/trial characterization and stateful fakes | Implementer |
| Privacy or finite/bounded validation weakened by deduplication | Adversarial and boundary cases at public readers and emissions | Implementer / reviewer |
| Importing optional packages or host probes | Fresh-process blocked-import/effect checks and base-wheel smoke | Implementer |
| Existing tests patch relocated internal names | Retarget only true clock/OS/provider seams; retain independent oracles | Implementer |
| Broad relocation conflicts with ongoing feature work | Pin baseline, inspect dirty tree every slice, integrate canonical owner changes once | Implementer |
| New facade increases files without reducing complexity | Ownership table, 22-name workflow, no duplicate policy, no internal facade imports | Reviewer |
| Unknown external Consumers depend on old paths | Preserve legacy surface; no removal in this change | Maintainer |
Completion requires all REQ and verification mappings satisfied, all 41 old module paths accounted for, no unresolved domain-type cycles, no accidental schema/behavior changes, all applicable gates recorded, and installed-wheel evidence. No new hardware, hosted service, signing, publication, or production-capacity claim follows from local checks.
7. Planning handoff¶
Objective: implement PRF-1 only after the maintainer selects this reviewed design for execution. Current state: plan/specification/verification catalog prepared; production code unchanged. Decisions: compatibility-preserving canonical ownership; one distribution; explicit advanced modes. Changed files: this plan and its linked specification/verification catalog; documentation index. Baseline evidence: architecture check passed; core evaluation suite 11 passed on Python 3.14.7. Red-state evidence: not applicable to documentation planning; new-interface and architecture cases define their expected red signal in the verification catalog. Remaining implementation: S-01 through S-09. Full test suites, builds, optional integrations, and Docker were not run for planning; Docker is not required unless Collector assets are subsequently changed. Next action: review PRF-1, then execute S-01 against the then-current source revision.