Repository navigation
Commit 45c5ed8
Split Stage 12 coordination and the execution contracts into smaller modules
stage12_runtime/coordination.py (1,091 lines) and the contract's
stage12_execution.py (929 lines) were over the file-length limit. The
code moves unchanged.
coordination.py keeps coordinate_report and re-exports every public
name. The coordinator class, ReportCoordination, its dataclasses and the
polling constants move to report_coordination.py, the child simulations'
records, failures and cancellation to coordinated_simulations.py, and
the parent report's checks and claim to parent_claim.py. Child failures
still log under the coordination module's logger, now named explicitly.
Private names another module uses are public: _ReportCoordination,
_cancel_pending_simulations, _cancellation, _child_failure_detail,
_child_record and _simulation_failure_attributes (both with a new
docstring), _record_child_failure, _validate_dispatch_context,
_validate_submitted_parent and _claim_parent.
stage12_execution becomes a package with the same import path, whose
__init__.py re-exports every name: base.py holds the field types, the
strict contract base and the simulation execution input; report_inputs.py
the report input and output plans; result_artifacts.py the artifact
descriptors and payloads; comparison_runs.py the invocation context and
the comparison-run records. The models in the other modules subclass
StrictContractModel and SimulationExecutionInput through the package
path, which ruff.toml already lists as runtime-evaluated, so ruff keeps
their annotation imports at runtime with no settings change; base.py
sorts first, so the package binds those bases before the other modules
import them. Every model's JSON schema is unchanged.
The coordination tests' fixed clock patches datetime in each of the
three modules that read it, and uuid4 and resolve_report_output_plan in
report_coordination.py, where the coordinator looks them up.
The file-length baseline drops both files (count 10 to 8).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>1 parent 1781f17 commit 45c5ed8
15 files changed
Lines changed: 2198 additions & 1940 deletions
File tree
- docs/generated
- libs/policyengine-simulation-contract/src/policyengine_simulation_contract
- stage12_execution
- projects/policyengine-simulation-executor
- src/policyengine_simulation_executor/stage12_runtime
- tests
- rules
- baselines
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| 19 | + | |
19 | 20 | | |
20 | 21 | | |
21 | 22 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
66 | 66 | | |
67 | 67 | | |
68 | 68 | | |
69 | | - | |
| 69 | + | |
70 | 70 | | |
71 | 71 | | |
72 | 72 | | |
| |||
0 commit comments