Formalize v0.6 extension contract - #12
Merged
Merged
Conversation
Document the minimal downstream stability contract for the CGE-Core v0.6 public Hosoe workflow. Protect the benchmark -> scenario -> set -> solve -> read lifecycle, including repeated Scenario modification/solve cycles, immutable earlier Result snapshots, benchmark isolation, and Result.compare(). Clarify the public/private boundary for downstream packages and explicitly exclude private engine state, raw Pyomo traversal, universal closure/plugin abstractions, persistence, dynamic logic, and IFPRI/CAMCGE adaptation from the minimal contract. Add regression tests that exercise the contract using only public namespaces.
miraflor
marked this pull request as ready for review
August 28, 2026 16:33
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Formalize the narrow downstream extension contract for the CGE-Core v0.6
public Hosoe workflow.
Contract
The protected lifecycle is:
CGE -> solve_benchmark() -> Equilibrium -> scenario() -> Scenario.set() -> Scenario.solve() -> ResultThe contract also protects:
value()reads;set()/solve()cycles on the sameScenario;Resultsnapshots;Result.compare()as the stable comparison path;cge_coreandcge_core.models.Public/private boundary
The contract deliberately does not include:
_engineor_snapshotstate;Closureabstraction;Scenario.unfix()as a required downstream capability;PyCGEremains available as the advanced/lower-level API, but its mutableengine state is outside the downstream stability promise.
Changes
docs/developer/extension-contract.md;Scope
This PR adds no new economic behavior and no new runtime abstraction. It
formalizes and tests capabilities already implemented in the v0.6 public API.
Validation
The Phase 5 contract tests and existing v0.6 documentation guards pass locally.
Merge policy
Do not merge until all CI checks are green.