Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
94587bb
Test rebuilding economy results from report runs' result rows (failing)
anth-volk Nov 10, 2026
ef09731
Rebuild a report run's economy result from its result rows
anth-volk Nov 10, 2026
a5ed3c7
Test reading v2 reports, report lists and simulations (failing)
anth-volk Nov 10, 2026
294ca9e
Read v2 reports, report lists and simulations from the detailed-save …
anth-volk Nov 10, 2026
df1d1d9
Test creating simulations and reports through the simulation service …
anth-volk Nov 10, 2026
a7e34da
Create simulations and reports through the simulation service's routes
anth-volk Nov 10, 2026
77c69e4
Test creating v2 reports and simulations through the shared submissio…
anth-volk Nov 10, 2026
5988f52
Create v2 reports and simulations through the shared submission checks
anth-volk Nov 10, 2026
a309227
Test saving detailed-save reports and simulations (failing)
anth-volk Nov 10, 2026
5195425
Save detailed-save reports and simulations by their IDs
anth-volk Nov 10, 2026
45af5fd
Test registering v2 reports and simulations for migration logs and co…
anth-volk Nov 10, 2026
edb885e
Register v2 reports and simulations for migration logs and contracts
anth-volk Nov 10, 2026
240897b
Expect saved simulations to take a detailed-save simulation_id in the…
anth-volk Nov 10, 2026
4c45685
Merge remote-tracking branch 'origin/master' into v2plan/c1-8-simulat…
anth-volk Nov 11, 2026
571fff4
Test that answers lost after sending, proxy answers and sim's 500 ans…
anth-volk Nov 11, 2026
16ec0b3
Answer 502 when a submission may have reached the simulation service
anth-volk Nov 11, 2026
9c0ff33
Test that a created record that cannot be read back answers 502 with …
anth-volk Nov 11, 2026
cd465ca
Answer 502 with the created record's ID when it cannot be read back
anth-volk Nov 11, 2026
f3b8761
Test that no report or simulation error mapping is shadowed by an ear…
anth-volk Nov 11, 2026
e47b7dd
Remove the report and simulation routes' unreachable configuration ma…
anth-volk Nov 11, 2026
191fce1
Say what a saved simulation's update checks instead of "the same kind"
anth-volk Nov 11, 2026
22ed552
Test that of two runs created together the one with the larger ID is …
anth-volk Nov 11, 2026
a5b55ac
Test rebuilding results the simulation service's own writer stored, a…
anth-volk Nov 11, 2026
3800900
Read a report run's stored SPM receipts as SPMComparisonProvenance
anth-volk Nov 11, 2026
a91be37
Import .py's US data by name in the golden fixture generator
anth-volk Nov 11, 2026
512ca22
Test the simulation service's 400 codes and its 503's code, reason an…
anth-volk Nov 11, 2026
9026236
Answer 422 only for 400s naming the caller's rows, and pass on the si…
anth-volk Nov 11, 2026
139e829
Test that a 503 that may follow a created record answers 502, and tha…
anth-volk Nov 11, 2026
2de37f5
Answer 502 for a 503 that may follow a created record, and ask to sub…
anth-volk Nov 11, 2026
ca47724
Merge origin/master into v2plan/c1-8-simulations-and-reports
anth-volk Nov 11, 2026
81a135b
Test that unexpected statuses answer 502 and that 500s and 503s pass …
anth-volk Nov 11, 2026
0cff622
Answer 502 for unexpected statuses, and pass on only the code of a 50…
anth-volk Nov 11, 2026
d37c66d
Read the tests' failure messages from a module that doesn't build the…
anth-volk Nov 11, 2026
34ebb3f
Test that a 500's or 503's code is passed on only as a fixed identifi…
anth-volk Nov 11, 2026
7d8d5eb
Pass on a 500's or 503's code only as a fixed identifier, and give re…
anth-volk Nov 11, 2026
6f88c84
Say a 503 naming the created record gives no reason, and what the unr…
anth-volk Nov 11, 2026
2dffbd9
Merge remote-tracking branch 'origin/master' into v2plan/c1-8-simulat…
anth-volk Nov 11, 2026
d52925b
Test that the saved-record writes answer a deleted record's foreign k…
anth-volk Nov 11, 2026
f445260
Answer a saved record's deleted report or simulation in its connectors
anth-volk Nov 11, 2026
b137b72
List V2ErrorResponse among ruff's runtime-evaluated base classes
anth-volk Nov 11, 2026
b32e5e6
Share the simulation service's answer handling between household calc…
anth-volk Nov 11, 2026
b71e86c
Test that a report or simulation deleted before a saved record is rep…
anth-volk Nov 11, 2026
28a36e0
Name a refused saved record's report or simulation from values read b…
anth-volk Nov 11, 2026
e590557
Say why the insert connectors name the input's record, and check a re…
anth-volk Nov 11, 2026
fd4f8d3
Enable the route-support logger in the tests that read its log records
anth-volk Nov 12, 2026
bc3ca8b
Merge master into v2plan/c1-8-simulations-and-reports
anth-volk Nov 12, 2026
4704beb
Merge master into v2plan/c1-8-simulations-and-reports
anth-volk Nov 12, 2026
f5edeaf
Merge master into v2plan/c1-8-simulations-and-reports
anth-volk Nov 12, 2026
50c354a
Merge master into v2plan/c1-8-simulations-and-reports
anth-volk Nov 12, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/workflows/v2-integration-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,12 @@ jobs:
run: uv run --frozen --extra dev python scripts/reconcile_v2_privileges.py apply --create-missing-roles
- name: Verify the managed v2 roles hold their declared privileges
run: uv run --frozen --extra dev python scripts/reconcile_v2_privileges.py verify
- name: Test v2 metadata publication, resource routes and the countries list
run: uv run --frozen --extra dev coverage run --branch -m pytest -q tests/integration/test_v2_catalog_publication.py tests/integration/test_v2_catalog_publication_time_periods.py tests/integration/test_v2_catalog_publication_pruning.py tests/integration/test_v2_catalog_spm_availability.py tests/integration/test_v2_metadata_routes.py tests/integration/test_v2_country_routes.py
- name: Test v2 metadata publication, resource routes, the countries list, reports and simulations
run: uv run --frozen --extra dev coverage run --branch -m pytest -q tests/integration/test_v2_catalog_publication.py tests/integration/test_v2_catalog_publication_time_periods.py tests/integration/test_v2_catalog_publication_pruning.py tests/integration/test_v2_catalog_spm_availability.py tests/integration/test_v2_metadata_routes.py tests/integration/test_v2_country_routes.py tests/integration/test_v2_report_reads.py tests/integration/test_v2_report_creation.py
- name: Test v2 policy persistence and immediate v1 mirroring
run: uv run --frozen --extra dev coverage run -a --branch -m pytest -q tests/integration/test_v2_policy_persistence.py tests/integration/test_v1_policy_dual_write.py tests/integration/test_mysql_policy_dual_write.py tests/integration/test_v2_user_policy_mirroring.py tests/integration/test_v1_user_policy_dual_write.py
- name: Test signed-in identity provisioning, user associations and user types
run: uv run --frozen --extra dev coverage run -a --branch -m pytest -q tests/integration/test_v2_user_identity_persistence.py tests/integration/test_v2_user_type_persistence.py
- name: Test signed-in identity provisioning, user associations, saved detailed-save records and user types
run: uv run --frozen --extra dev coverage run -a --branch -m pytest -q tests/integration/test_v2_user_identity_persistence.py tests/integration/test_v2_user_type_persistence.py tests/integration/test_v2_saved_detailed_save_records.py
- name: Test comparison-run persistence, the simulation API's roles and privilege reconciliation as the managed roles
run: uv run --frozen --extra dev coverage run -a --branch -m pytest -q tests/integration/test_v2_stage12_comparison_persistence.py tests/integration/test_v2_simulation_role_privileges.py tests/integration/test_v2_privilege_reconciliation.py
- name: Test v2 household persistence, immediate v1 copying and household calculation reads
Expand Down
1 change: 1 addition & 0 deletions changelog.d/v2-simulations-and-reports.added.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add `/v2/reports` and `/v2/simulations`: create economy reports and simulations through the simulation service, read a report with its newest run, that run's economy result and the versions the Public API runs, list up to 25 named reports, and read a simulation with its newest run. A create answers 422 when the simulation service refuses the caller's data: its 422, or its 400 with code `unknown_region`, `unknown_dataset` or `unknown_dynamic`. It answers 502 when the simulation service may have created the record but gave no usable answer: its 500, an answer lost after the request may have reached it, a proxy's 502 or 504 in its place, a 503 that cannot be read or that names only another record, any status the Public API does not expect (such as 200, 204 or 409, which the simulation service's route may answer after writing rows), or a created answer that cannot be read. For all but the last, the message asks the caller to submit again and says that this creates a second record if the first request went through. A created record that cannot be read back also answers 502, with its `report_id` or `simulation_id`. It answers 503, and the simulation service has created nothing, when the request was never sent (no connection made, no gateway token, or the simulation service not configured); when the simulation service answers a readable 503 naming no record, a 400 with any other code or none, a 400 or 422 that cannot be read, or 401, 403, 404, 405, 413 or 429, which are sent before its route runs; and when the v2 database is not configured or cannot be read for the checks. A readable 400's or 422's message gives the simulation service's code, when it has one, and its reason, but not its status. The message for any other answer gives the simulation service's status and code, as in `503 modal_call_refused`, but never its reason, since a 500's or 503's may be an exception's text; a code that isn't a fixed identifier (lower-case letters, digits and underscores, starting with a letter, at most 64 characters) is left out. A 503 for a record the service created and whose run it then failed gives that record's `report_id` or `simulation_id`. Saved reports and simulations now also take a detailed-save `report_id` or `simulation_id`, but not together with a v1 number.
29 changes: 21 additions & 8 deletions docs/engineering/migration-contracts.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ Generated from `policyengine_api/migration_registry.py` and `tests/contract/regi
| Metric | Count |
| --- | ---: |
| route group count | 9 |
| workflow count | 17 |
| request count | 92 |
| workflow count | 18 |
| request count | 97 |
| db entity count | 6 |
| sim flow count | 3 |

Expand All @@ -23,7 +23,7 @@ Generated from `policyengine_api/migration_registry.py` and `tests/contract/regi
| `household` | `household`, `households`, `household-calculations`, `user-household`, `user-households`, `calculate`, `calculate-full` | `household` | `household` |
| `economy` | `economy` | `simulation` | `economy` |
| `simulation` | `simulation`, `simulations`, `user-simulations` | `simulation` | `economy` |
| `report` | `report`, `user-reports`, `shared-reports` | `report` | `report` |
| `report` | `report`, `reports`, `user-reports`, `shared-reports` | `report` | `report` |
| `user_profile` | `user-profile`, `me`, `admin` | `user` | `none` |

## App V2 Workflow Contracts
Expand Down Expand Up @@ -126,12 +126,12 @@ Generated from `policyengine_api/migration_registry.py` and `tests/contract/regi
| `POST` | `/v2/user-simulations?country_id=us` | 201 | `simulation` | `Authorization` | `status`, `message`, `result.item.id`, `result.item.country_id`, `result.item.user_id`, `result.item.simulation_id`, `result.item.legacy_simulation_id`, `result.item.name`, `result.item.description`, `result.item.created_at`, `result.item.updated_at` |
| `GET` | `/v2/user-simulations/{association_id}?country_id=us` | 200 | `simulation` | `Authorization` | `status`, `message`, `result.item.id`, `result.item.country_id`, `result.item.user_id`, `result.item.simulation_id`, `result.item.legacy_simulation_id`, `result.item.name`, `result.item.description`, `result.item.created_at`, `result.item.updated_at` |
| `GET` | `/v2/user-simulations?country_id=us` | 200 | `simulation` | `Authorization` | `status`, `message`, `result.items`, `result.offset`, `result.limit`, `result.has_more` |
| `PATCH` | `/v2/user-simulations/{association_id}?country_id=us` | 200 | `simulation` | `Authorization` | `status`, `message`, `result.item.id`, `result.item.legacy_simulation_id`, `result.item.name`, `result.item.description`, `result.item.updated_at` |
| `PATCH` | `/v2/user-simulations/{association_id}?country_id=us` | 200 | `simulation` | `Authorization` | `status`, `message`, `result.item.id`, `result.item.simulation_id`, `result.item.legacy_simulation_id`, `result.item.name`, `result.item.description`, `result.item.updated_at` |
| `DELETE` | `/v2/user-simulations/{association_id}?country_id=us` | 204 | `simulation` | `Authorization` | |
| `POST` | `/v2/user-simulations?country_id=us` | 201 | `simulation` | `PolicyEngine-Unauthenticated-User` | `status`, `message`, `result.item.id`, `result.item.country_id`, `result.item.user_id`, `result.item.simulation_id`, `result.item.legacy_simulation_id`, `result.item.name`, `result.item.description`, `result.item.created_at`, `result.item.updated_at` |
| `GET` | `/v2/user-simulations/{association_id}?country_id=us` | 200 | `simulation` | `PolicyEngine-Unauthenticated-User` | `status`, `message`, `result.item.id`, `result.item.country_id`, `result.item.user_id`, `result.item.simulation_id`, `result.item.legacy_simulation_id`, `result.item.name`, `result.item.description`, `result.item.created_at`, `result.item.updated_at` |
| `GET` | `/v2/user-simulations?country_id=us` | 200 | `simulation` | `PolicyEngine-Unauthenticated-User` | `status`, `message`, `result.items`, `result.offset`, `result.limit`, `result.has_more` |
| `PATCH` | `/v2/user-simulations/{association_id}?country_id=us` | 200 | `simulation` | `PolicyEngine-Unauthenticated-User` | `status`, `message`, `result.item.id`, `result.item.legacy_simulation_id`, `result.item.name`, `result.item.description`, `result.item.updated_at` |
| `PATCH` | `/v2/user-simulations/{association_id}?country_id=us` | 200 | `simulation` | `PolicyEngine-Unauthenticated-User` | `status`, `message`, `result.item.id`, `result.item.simulation_id`, `result.item.legacy_simulation_id`, `result.item.name`, `result.item.description`, `result.item.updated_at` |
| `DELETE` | `/v2/user-simulations/{association_id}?country_id=us` | 204 | `simulation` | `PolicyEngine-Unauthenticated-User` | |

### `user_report_associations_v2`
Expand All @@ -144,14 +144,14 @@ Generated from `policyengine_api/migration_registry.py` and `tests/contract/regi
| `POST` | `/v2/user-reports?country_id=us` | 201 | `report` | `Authorization` | `status`, `message`, `result.item.id`, `result.item.country_id`, `result.item.user_id`, `result.item.report_id`, `result.item.legacy_report_id`, `result.item.name`, `result.item.description`, `result.item.user_policy_id`, `result.item.baseline_user_policy_id`, `result.item.source_note`, `result.item.provisions`, `result.item.validation`, `result.item.budget_window_years`, `result.item.last_run_at`, `result.item.created_at`, `result.item.updated_at` |
| `GET` | `/v2/user-reports/{association_id}?country_id=us` | 200 | `report` | `Authorization` | `status`, `message`, `result.item.id`, `result.item.country_id`, `result.item.user_id`, `result.item.report_id`, `result.item.legacy_report_id`, `result.item.name`, `result.item.description`, `result.item.user_policy_id`, `result.item.baseline_user_policy_id`, `result.item.source_note`, `result.item.provisions`, `result.item.validation`, `result.item.budget_window_years`, `result.item.last_run_at`, `result.item.created_at`, `result.item.updated_at` |
| `GET` | `/v2/user-reports?country_id=us` | 200 | `report` | `Authorization` | `status`, `message`, `result.items`, `result.offset`, `result.limit`, `result.has_more` |
| `PATCH` | `/v2/user-reports/{association_id}?country_id=us` | 200 | `report` | `Authorization` | `status`, `message`, `result.item.id`, `result.item.legacy_report_id`, `result.item.name`, `result.item.description`, `result.item.user_policy_id`, `result.item.baseline_user_policy_id`, `result.item.source_note`, `result.item.provisions`, `result.item.validation`, `result.item.budget_window_years`, `result.item.last_run_at`, `result.item.updated_at` |
| `PATCH` | `/v2/user-reports/{association_id}?country_id=us` | 200 | `report` | `Authorization` | `status`, `message`, `result.item.id`, `result.item.report_id`, `result.item.legacy_report_id`, `result.item.name`, `result.item.description`, `result.item.user_policy_id`, `result.item.baseline_user_policy_id`, `result.item.source_note`, `result.item.provisions`, `result.item.validation`, `result.item.budget_window_years`, `result.item.last_run_at`, `result.item.updated_at` |
| `DELETE` | `/v2/user-reports/{association_id}?country_id=us` | 204 | `report` | `Authorization` | |
| `POST` | `/v2/user-reports?country_id=us` | 201 | `report` | `PolicyEngine-Unauthenticated-User` | `status`, `message`, `result.item.id`, `result.item.country_id`, `result.item.user_id`, `result.item.report_id`, `result.item.legacy_report_id`, `result.item.name`, `result.item.description`, `result.item.user_policy_id`, `result.item.baseline_user_policy_id`, `result.item.source_note`, `result.item.provisions`, `result.item.validation`, `result.item.budget_window_years`, `result.item.last_run_at`, `result.item.created_at`, `result.item.updated_at` |
| `GET` | `/v2/user-reports/{association_id}?country_id=us` | 200 | `report` | `PolicyEngine-Unauthenticated-User` | `status`, `message`, `result.item.id`, `result.item.country_id`, `result.item.user_id`, `result.item.report_id`, `result.item.legacy_report_id`, `result.item.name`, `result.item.description`, `result.item.user_policy_id`, `result.item.baseline_user_policy_id`, `result.item.source_note`, `result.item.provisions`, `result.item.validation`, `result.item.budget_window_years`, `result.item.last_run_at`, `result.item.created_at`, `result.item.updated_at` |
| `GET` | `/v2/user-reports?country_id=us` | 200 | `report` | `PolicyEngine-Unauthenticated-User` | `status`, `message`, `result.items`, `result.offset`, `result.limit`, `result.has_more` |
| `PATCH` | `/v2/user-reports/{association_id}?country_id=us` | 200 | `report` | `PolicyEngine-Unauthenticated-User` | `status`, `message`, `result.item.id`, `result.item.legacy_report_id`, `result.item.name`, `result.item.description`, `result.item.user_policy_id`, `result.item.baseline_user_policy_id`, `result.item.source_note`, `result.item.provisions`, `result.item.validation`, `result.item.budget_window_years`, `result.item.last_run_at`, `result.item.updated_at` |
| `PATCH` | `/v2/user-reports/{association_id}?country_id=us` | 200 | `report` | `PolicyEngine-Unauthenticated-User` | `status`, `message`, `result.item.id`, `result.item.report_id`, `result.item.legacy_report_id`, `result.item.name`, `result.item.description`, `result.item.user_policy_id`, `result.item.baseline_user_policy_id`, `result.item.source_note`, `result.item.provisions`, `result.item.validation`, `result.item.budget_window_years`, `result.item.last_run_at`, `result.item.updated_at` |
| `DELETE` | `/v2/user-reports/{association_id}?country_id=us` | 204 | `report` | `PolicyEngine-Unauthenticated-User` | |
| `GET` | `/v2/shared-reports/{association_id}?country_id=us` | 200 | `report` | none | `status`, `message`, `result.item.id`, `result.item.country_id`, `result.item.legacy_report_id`, `result.item.name`, `result.item.source_note`, `result.item.provisions`, `result.item.validation`, `result.item.budget_window_years`, `result.item.baseline_reform`, `result.item.last_run_at`, `result.item.created_at`, `result.item.updated_at` |
| `GET` | `/v2/shared-reports/{association_id}?country_id=us` | 200 | `report` | none | `status`, `message`, `result.item.id`, `result.item.country_id`, `result.item.report_id`, `result.item.legacy_report_id`, `result.item.name`, `result.item.source_note`, `result.item.provisions`, `result.item.validation`, `result.item.budget_window_years`, `result.item.baseline_reform`, `result.item.last_run_at`, `result.item.created_at`, `result.item.updated_at` |

### `user_account_v2`

Expand Down Expand Up @@ -197,6 +197,19 @@ Generated from `policyengine_api/migration_registry.py` and `tests/contract/regi
| --- | --- | ---: | --- | --- | --- |
| `GET` | `/v2/countries` | 200 | `metadata` | none | `status`, `message`, `result.items` |

### `detailed_save_reports_v2`

- Current contract: `typed_v2_resources`
- Future owner: C1 · 8: v2 simulations and economy reports

| Method | Path | Status | Route group | Required headers | Stable response fields |
| --- | --- | ---: | --- | --- | --- |
| `POST` | `/v2/reports?country_id=us` | 201 | `report` | none | `status`, `message`, `result.item.id`, `result.item.country_id`, `result.item.kind`, `result.item.status`, `result.item.run`, `result.item.current_versions`, `result.item.result` |
| `GET` | `/v2/reports?country_id=us&report_id={report_id}` | 200 | `report` | none | `status`, `message`, `result.items` |
| `GET` | `/v2/reports/{report_id}?country_id=us` | 200 | `report` | none | `status`, `message`, `result.item.id`, `result.item.status`, `result.item.run`, `result.item.current_versions`, `result.item.result` |
| `POST` | `/v2/simulations?country_id=us` | 201 | `simulation` | none | `status`, `message`, `result.item.id`, `result.item.kind`, `result.item.status`, `result.item.run` |
| `GET` | `/v2/simulations/{simulation_id}?country_id=us` | 200 | `simulation` | none | `status`, `message`, `result.item.id`, `result.item.status`, `result.item.run`, `result.item.current_versions` |

### `metadata_resources_v2_preview`

- Current contract: `typed_v2_resources`
Expand Down
Loading
Loading