Skip to content

Bind ordered UK Scenario modifiers to executable receipt plans - #756

Merged
MaxGhenis merged 2 commits into
mainfrom
feat/ordered-uk-scenario-receipts
Nov 13, 2026
Merged

MaxGhenis merged 2 commits into
mainfrom
feat/ordered-uk-scenario-receipts

Conversation

@MaxGhenis

@MaxGhenis MaxGhenis commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #755

Native Scenario sums can wrap several modifiers in an internal closure, which the phase-aware receipt binder from #752 refuses. Add build_ordered_scenario to construct a native Scenario from trusted module-level callables and bind its actual execution order. It applies the complete parameter map once before loading data, then preserves each phase's ordered modifiers and repeated occurrences.

BoundOrderedScenario exposes that Scenario, an immutable plan and a live identity. The plan records the adapter, complete parameters and each modifier's source, module source, typed defaults and repository revision. Live checks refuse changes to those inputs or the native timing.

ordered_scenario_reform_identity validates and recomputes the plan's identity from data without importing carried module names. bind_ordered_scenario_plan checks a worker's actual trusted functions against the complete plan before execution; trusted pickle transport rebinds on load.

Plans with modifiers use policyengine-uk.phased_scenario_composition/v1. Parameter-only and empty plans retain their existing identities, as do valid legacy Scenario, phased Scenario and composition inputs. Legacy composition refuses phase flattening. Public models, schema, reproducible vectors, documentation and a standalone example accompany the API.

Callers supply the resolved parameter map and retain conflict, structural-consistency, approval and data checks. The API accepts trusted module-level leaves; it does not sandbox Python or prove write sets.

Validation: 115 focused tests pass on both Python 3.13.13 and 3.14.7 (--noconftest, 867 deselected): 57 ordered-API cases, 29 phased-Scenario cases and 29 legacy regressions, including real native construction and spawn transport. Schema/vector reproduction, full Ruff 0.17.5 lint and format checks, and all 14 repository CI checks pass, including the full Python 3.11–3.14 matrix. The full standalone example also passes against a wheel built from commit 12300f3b; its synthetic state advances from 1 to 4 to 9 through the actual adapters.

axiom: n/a: execution and provenance API; no policy-rule changes.

@MaxGhenis
MaxGhenis marked this pull request as ready for review November 13, 2026 00:09
@MaxGhenis
MaxGhenis merged commit 59d6311 into main Nov 13, 2026
16 checks passed
@MaxGhenis
MaxGhenis deleted the feat/ordered-uk-scenario-receipts branch November 13, 2026 00:31
anth-volk added a commit that referenced this pull request Nov 13, 2026
Main moved to 6.19.0 (#752, #754, #756, #758). Only the two TRACE TROs
conflicted; both were regenerated from the merged manifest with
`bundle.py generate --include-tros --strict-tros`, so they now name
bundle 6.19.0 and its manifest digest. `bundle.py check --published-spm
--include-tros --strict-tros` and `uv lock --check` pass.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bind ordered UK Scenario modifiers within each data-load phase

1 participant