Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
110 commits
Select commit Hold shift + click to select a range
731a2ab
Test sim's models of the Public API's definition keys and run indexes…
anth-volk Nov 13, 2026
d95cae5
Model the Public API's definition keys, forced markers and run indexes
anth-volk Nov 13, 2026
f79fa9a
Test the definition keys of economy reports (failing)
anth-volk Nov 13, 2026
7608e4f
Build the definition keys of economy reports
anth-volk Nov 13, 2026
0909244
Test finding a shared simulation, report or run, or inserting it (fai…
anth-volk Nov 13, 2026
d8a80b9
Find a shared simulation, report or run, or insert it
anth-volk Nov 13, 2026
e84e096
Test forced re-runs as extra runs, marked and never refused (failing)
anth-volk Nov 13, 2026
5bbb7dd
Create forced re-runs as extra runs, marked forced
anth-volk Nov 13, 2026
ca14692
Test that the service marks a forced report re-run forced (failing)
anth-volk Nov 13, 2026
2c58d9a
Mark a forced report re-run forced
anth-volk Nov 13, 2026
e27b64c
Test the staging economy check forcing a new run (failing)
anth-volk Nov 13, 2026
734bd24
Force a new run in the staging economy check
anth-volk Nov 13, 2026
c5396b7
Test a simulation re-run joining its run on the current versions (fai…
anth-volk Nov 13, 2026
5667a00
Join a simulation's run on the re-run's versions, or create it
anth-volk Nov 13, 2026
106902f
Test that a simulation re-run joining a run starts no call (failing)
anth-volk Nov 13, 2026
7297491
Start a simulation re-run's call only for a run it created
anth-volk Nov 13, 2026
8307444
Test a report re-run joining the report's run on its versions (failing)
anth-volk Nov 13, 2026
1b920ab
Test a report re-run that loses to a run created after its lookup (fa…
anth-volk Nov 13, 2026
6becdff
Join a report's run on the re-run's versions, or create it
anth-volk Nov 13, 2026
806d9c0
Test that a report re-run joining a run starts no call (failing)
anth-volk Nov 13, 2026
9875411
Answer a report re-run that joined a run, with no call
anth-volk Nov 13, 2026
7338dcd
Test that no report reuses a forced run (failing)
anth-volk Nov 13, 2026
4e689fa
Never reuse a forced run
anth-volk Nov 13, 2026
94e996d
Tighten two of the shared-run tests (review round 1)
anth-volk Nov 13, 2026
b7a496a
Test a 503 for a run that keeps failing before it is read (failing)
anth-volk Nov 13, 2026
4bfbd3f
Answer a run that keeps failing before it is read as unavailable
anth-volk Nov 13, 2026
2dc7d77
Keep one statement in the unavailable re-run test's raises block
anth-volk Nov 13, 2026
087522b
Test the re-run routes' documented answers after joining (failing)
anth-volk Nov 13, 2026
df7c61f
Describe re-runs that join, and the staging check as it is (review ro…
anth-volk Nov 13, 2026
4446b9a
Keep the re-run and read tests within one unfailed run per version set
anth-volk Nov 13, 2026
87d75bc
Keep the Stage 12 sweep and window tests within one unfailed run per …
anth-volk Nov 13, 2026
1e4352e
Test the dataset-independent key's index on that key alone (failing)
anth-volk Nov 13, 2026
6181ae6
Model the index on the dataset-independent key alone
anth-volk Nov 13, 2026
d1afb83
Seed rows the service could write, and check the 503 starts no call (…
anth-volk Nov 13, 2026
b8c3488
Say how each kind of re-run is answered (review round 2)
anth-volk Nov 13, 2026
d904d33
Test the dataset-independent key: the report key without its dataset …
anth-volk Nov 13, 2026
413e453
Build the dataset-independent key of an economy report
anth-volk Nov 13, 2026
124d632
Describe each re-run's joining exactly, and seed realistic rows (revi…
anth-volk Nov 13, 2026
5ed8c9b
Test a report run naming one simulation run on both sides (failing)
anth-volk Nov 13, 2026
ae48b44
Accept a report run naming one simulation run on both sides
anth-volk Nov 13, 2026
74deda2
Test the keys under answer 4: SPM in the simulation key, no report op…
anth-volk Nov 13, 2026
d61f2cd
Key simulations by everything that changes their numbers, reports by …
anth-volk Nov 13, 2026
18bd6e5
Format the one-run-on-both-sides check as the pinned Ruff does
anth-volk Nov 13, 2026
cda2e4e
Test finding economy reports and simulations by key, or creating them…
anth-volk Nov 13, 2026
f3b16f7
Find economy reports and simulations by key, with their runs, or crea…
anth-volk Nov 13, 2026
b802f00
Test the service creating reports and simulations by key (failing)
anth-volk Nov 13, 2026
5b2133e
Test the store finding or creating by key in its own transaction (fai…
anth-volk Nov 13, 2026
bb10db8
Find or create reports and simulations by key through the store
anth-volk Nov 13, 2026
a3aa206
Move an economy request's types and input reads out of the store
anth-volk Nov 13, 2026
e8c1009
Restore the three store methods the move renamed by mistake
anth-volk Nov 13, 2026
3930506
Create economy reports and simulations by key, calling only for new runs
anth-volk Nov 13, 2026
413b021
Describe creates by key in the README and the economy routes
anth-volk Nov 13, 2026
7224b9d
Test a keyed report's re-run joining each side's run on its versions …
anth-volk Nov 13, 2026
e0a94ba
Join each side's run on a keyed report's re-run
anth-volk Nov 13, 2026
0f7cf6e
Move what a re-run reads of a stored record into rerun_definitions
anth-volk Nov 13, 2026
ac3ed06
Test a keyed report's re-run joining each side's run in the service (…
anth-volk Nov 13, 2026
b1739d5
Have a keyed report's re-run join each side's run in the service
anth-volk Nov 13, 2026
aecf14b
Describe the shared simulations, reports and runs in the READMEs
anth-volk Nov 13, 2026
e4d83ac
Patch the input reads where they now live, in the store's side-refusa…
anth-volk Nov 13, 2026
9bbd25c
Test a keyed re-run with one simulation on both sides (failing)
anth-volk Nov 13, 2026
0b1ada5
Answer a side reused only when its run isn't one the re-run inserted
anth-volk Nov 13, 2026
1b59eeb
Test refusing a report that asks for cliffs, until per-run cliffs exi…
anth-volk Nov 13, 2026
486f0bf
Refuse a report asking for cliffs until per-run cliffs exist
anth-volk Nov 13, 2026
876fc0e
Test re-runs of reports with no keys as forced runs, and refusing sto…
anth-volk Nov 13, 2026
2431ca6
Re-run reports with no keys as forced runs, and refuse stored cliffs
anth-volk Nov 13, 2026
1a70fdf
Find or insert a report's side runs in one place, for creates and re-…
anth-volk Nov 13, 2026
e8d4d43
Test one household simulation run named on both sides of a calculatio…
anth-volk Nov 13, 2026
5f373f7
Accept one household simulation run on both sides of one calculation
anth-volk Nov 13, 2026
f1ebcbc
Test the keys of household simulations and reports (failing)
anth-volk Nov 13, 2026
0784113
Key household simulations and reports
anth-volk Nov 13, 2026
d9491db
Test finding or creating household reports by key (failing)
anth-volk Nov 13, 2026
05bfcde
Find or create household reports by key
anth-volk Nov 13, 2026
78af963
Test household re-runs that join a keyed report's run or are forced (…
anth-volk Nov 13, 2026
67bd61d
Join a keyed household report's run on re-run, or force an extra run
anth-volk Nov 13, 2026
6564350
Test household reports found by key and re-runs joining in the servic…
anth-volk Nov 13, 2026
07a1f44
Find or create household reports by key, and join or force their re-runs
anth-volk Nov 13, 2026
2a57409
Call the contract-refusal helper where it now lives, in the builder's…
anth-volk Nov 13, 2026
4d525f7
Test that no re-run answers 409 run_in_progress any more (failing)
anth-volk Nov 13, 2026
0d94eba
Answer no re-run with 409 run_in_progress
anth-volk Nov 13, 2026
e60f526
Describe household reports found by key, and re-runs that join or force
anth-volk Nov 13, 2026
651616d
Test the nullable per-user columns and the window run index (failing)
anth-volk Nov 13, 2026
b7db8b5
Model the nullable per-user columns and the window run index
anth-volk Nov 13, 2026
f67de3c
Test keyed creates and re-runs writing no per-user column (failing)
anth-volk Nov 13, 2026
c2e4396
Write no per-user column on keyed creates and re-runs
anth-volk Nov 13, 2026
fa1e4bd
Test a report request's label and description as optional and unstore…
anth-volk Nov 13, 2026
8fef28c
Accept an economy or household report's label and description without…
anth-volk Nov 13, 2026
01b4b09
Test finding or creating budget windows by key (failing)
anth-volk Nov 13, 2026
17ac16f
Find or create budget windows by key
anth-volk Nov 13, 2026
e4b5f51
Test window re-runs that join a keyed window's run or force an extra …
anth-volk Nov 13, 2026
ca67663
Join a keyed window's run on re-run, or force an extra one
anth-volk Nov 13, 2026
0f69b17
Test budget windows found by key and keyed window re-runs in the serv…
anth-volk Nov 13, 2026
405ed0b
Find or create budget windows by key in the service, and join keyed w…
anth-volk Nov 13, 2026
bddcb2d
Test a budget window's label and description as optional and unstored…
anth-volk Nov 13, 2026
c7b6a66
Accept a budget window's label and description without storing them
anth-volk Nov 13, 2026
176ed55
Describe budget windows found by key, and window re-runs that join or…
anth-volk Nov 13, 2026
b62fc04
Say the staging check's report is found by key, in the deployment notes
anth-volk Nov 13, 2026
df7efa1
Remove what no re-run reaches any more, after review round 5
anth-volk Nov 14, 2026
11c95ff
Say what re-runs, windows and requests do now, after review round 5
anth-volk Nov 14, 2026
3e3e4a1
Test two identical window requests at once ending on one window run
anth-volk Nov 14, 2026
cb503bd
Fix review round 6's findings: last stale passages, an unused paramet…
anth-volk Nov 14, 2026
9a24543
Fix review round 7's findings: wording, a docstring, a stale comment,…
anth-volk Nov 14, 2026
314a130
Fix review round 8's findings: the last passages on the output bucket
anth-volk Nov 14, 2026
91a9c05
Add the changelog fragments for finding or creating records by key
anth-volk Nov 14, 2026
0b1e7d0
Pin the Public API schema to PolicyEngine/policyengine-api#4303's hea…
anth-volk Nov 14, 2026
56ba811
Drop the removed 409 run_in_progress from the generated client's re-r…
anth-volk Nov 14, 2026
691b49a
Merge main into the find-or-create-by-key branch
anth-volk Nov 16, 2026
9c5ab3a
Remove the create functions without keys, the run-reuse search and th…
anth-volk Nov 16, 2026
81ee633
Test that the keyed creators name a refused reference's column, and c…
anth-volk Nov 16, 2026
d28d41c
Merge main into the find-or-create-by-key branch
anth-volk Nov 17, 2026
4d6844f
Merge main into the find-or-create-by-key branch
anth-volk Nov 17, 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
7 changes: 0 additions & 7 deletions .github/scripts/deploy-cloud-run-simulation-entry.sh
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,6 @@ required_variables=(
SIMULATION_SERVICE_DATABASE_URL_SECRET_NAME
MODAL_TOKEN_ID_SECRET_NAME
MODAL_TOKEN_SECRET_SECRET_NAME
V2_SIMULATION_OUTPUT_BUCKET_VALUE
OBSERVABILITY_SERVICE_NAMESPACE
OBSERVABILITY_TRACE_PROJECT_ID
OTEL_EXPORTER_OTLP_ENDPOINT
Expand All @@ -129,11 +128,6 @@ esac
|| fail "TAG is invalid"
[[ "${ENTRYPOINT_RUNTIME_SERVICE_ACCOUNT}" =~ ^[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.gserviceaccount\.com$ ]] \
|| fail "ENTRYPOINT_RUNTIME_SERVICE_ACCOUNT is invalid"
# The bucket that keeps v2 simulation output files for good: a report
# reuses only a succeeded run whose file is in it. The service compares
# output URIs with it and never reads it.
[[ "${V2_SIMULATION_OUTPUT_BUCKET_VALUE}" =~ ^[a-z0-9][a-z0-9._-]{1,61}[a-z0-9]$ ]] \
|| fail "V2_SIMULATION_OUTPUT_BUCKET_VALUE is invalid"
[[ "${ENTRYPOINT_MIN_INSTANCES}" =~ ^[0-9]+$ ]] \
|| fail "ENTRYPOINT_MIN_INSTANCES must be a non-negative integer"
[[ "${ENTRYPOINT_MAX_INSTANCES}" =~ ^[0-9]+$ ]] \
Expand Down Expand Up @@ -201,7 +195,6 @@ jq -n '
POLICYENGINE_OTEL_GOOGLE_AUDIENCE: env.POLICYENGINE_OTEL_GOOGLE_AUDIENCE,
SIMULATION_V2_MODAL_ENVIRONMENT: env.MODAL_ENVIRONMENT,
SIMULATION_V2_MANIFEST_NAME: "simulation-api-v2-version-manifest",
V2_SIMULATION_OUTPUT_BUCKET: env.V2_SIMULATION_OUTPUT_BUCKET_VALUE,
STAGE12_ENABLED: (
if env.DEPLOY_STAGE12_V2 == "true" then env.STAGE12_ENABLED_VALUE else "0" end
)
Expand Down
39 changes: 27 additions & 12 deletions .github/scripts/simulation-staging-economy-check.sh
Original file line number Diff line number Diff line change
@@ -1,17 +1,21 @@
#!/bin/bash
# Create a small economy report through a deployed Simulation Entrypoint, and
# require its run to succeed: current law against current law for Wales in
# 2026, which needs no stored policy.
# Send a small economy report request through a deployed Simulation
# Entrypoint, force a new run of the report, and require that run to succeed:
# current law against current law for Wales in 2026, which needs no stored
# policy. The request reuses the simulation runs an earlier check on the same
# versions calculated (and, once reports are found by key, ends on that
# check's report run), so only a forced run, which nothing joins or reuses,
# calculates both simulations on every deploy.
# Usage: simulation-staging-economy-check.sh <base-url>
# Required env vars: the test client's SIMULATION_TEST_AUTH_ISSUER,
# SIMULATION_TEST_AUTH_AUDIENCE, SIMULATION_TEST_AUTH_CLIENT_ID and
# SIMULATION_TEST_AUTH_CLIENT_SECRET.
# Optional: ECONOMY_CHECK_DEADLINE_SECONDS (1800) and
# ECONOMY_CHECK_POLL_SECONDS (15).
# The access token is sent from a file and the client secret on standard
# input, so neither appears on a command line. The submission, which isn't
# asked again, may take 60 seconds, Cloud Run's own limit; every other
# request 30. A read that gets no answer, a 429 or any 5xx is asked again
# input, so neither appears on a command line. The submission and the forced
# re-run, neither asked again, may each take 60 seconds, Cloud Run's own
# limit; every other request 30. A read that gets no answer, a 429 or any 5xx is asked again
# until the deadline.

set -euo pipefail
Expand Down Expand Up @@ -86,12 +90,23 @@ submission_status="$(
|| fail "POST /reports answered ${submission_status}: $(cat "${work_directory}/submission.json")"
submission="${work_directory}/submission.json"
report_id="$(jq -r '.report_id // empty' "${submission}")"
report_run_id="$(jq -r '.report_run_id // empty' "${submission}")"
found_run_id="$(jq -r '.report_run_id // empty' "${submission}")"
[[ "${report_id}" =~ ${uuid_pattern} ]] || fail "the submission named no report"
[[ "${report_run_id}" =~ ${uuid_pattern} ]] || fail "the submission named no report run"
printf 'Created report %s, run %s (baseline reused: %s, reform reused: %s)\n' \
"${report_id}" "${report_run_id}" \
"$(jq -r '.baseline_reused' "${submission}")" "$(jq -r '.reform_reused' "${submission}")"
[[ "${found_run_id}" =~ ${uuid_pattern} ]] || fail "the submission named no report run"
printf 'Report request answered report %s, run %s (%s)\n' \
"${report_id}" "${found_run_id}" "$(jq -r '.status' "${submission}")"

rerun_url="${base_url}/reports/${report_id}/runs"
rerun_status="$(
jq -n '{force: true}' \
| send rerun "${submission_timeout_seconds}" --request POST --header "@${authorization_header}" \
--header 'Content-Type: application/json' --data @- "${rerun_url}"
)" || fail "POST /reports/${report_id}/runs got no answer; it may have created a run"
[[ "${rerun_status}" == "201" ]] \
|| fail "POST /reports/${report_id}/runs answered ${rerun_status}: $(cat "${work_directory}/rerun.json")"
report_run_id="$(jq -r '.report_run_id // empty' "${work_directory}/rerun.json")"
[[ "${report_run_id}" =~ ${uuid_pattern} ]] || fail "the forced re-run named no report run"
printf 'Started forced run %s of report %s\n' "${report_run_id}" "${report_id}"

started_at="${SECONDS}"
# What the last read found, for the deadline's failure message.
Expand All @@ -107,7 +122,7 @@ while true; do
elif [[ "${read_status}" == "200" ]]; then
newest_run_id="$(jq -r '.run.run_id // empty' "${report_body}")"
[[ "${newest_run_id}" == "${report_run_id}" ]] \
|| fail "report ${report_id}'s newest run is ${newest_run_id:-missing}, not the created run ${report_run_id}"
|| fail "report ${report_id}'s newest run is ${newest_run_id:-missing}, not the forced run ${report_run_id}"
run_status="$(jq -r '.run.status' "${report_body}")"
last_read="the run was ${run_status}"
case "${run_status}" in
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/simulation-deploy.reusable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,6 @@ jobs:
STAGE12_DATABASE_URL_SECRET_NAME: ${{ vars.STAGE12_DATABASE_URL_SECRET_NAME }}
MODAL_TOKEN_ID_SECRET_NAME: ${{ vars.MODAL_TOKEN_ID_SECRET_NAME }}
MODAL_TOKEN_SECRET_SECRET_NAME: ${{ vars.MODAL_TOKEN_SECRET_SECRET_NAME }}
V2_SIMULATION_OUTPUT_BUCKET_VALUE: ${{ vars.V2_SIMULATION_OUTPUT_BUCKET }}
run: .github/scripts/deploy-cloud-run-simulation-entry.sh

- name: Resolve exact candidate metadata
Expand Down
1 change: 1 addition & 0 deletions changelog.d/1073.changed.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Identical simulation, report and budget-window requests now end on the same rows, sent together or apart. `POST /reports` (economy, budget-window and household reports), `POST /simulations` and the re-run routes find or create each simulation and report by a key of its definition and join its run on the default worker's versions when one hasn't failed and wasn't forced, so the service starts a Modal calculation only for a run its own request created; a budget-window year and a single-year report of that year share their simulation runs. A re-run with `force`, and every re-run of a report created before keys, calculates an extra run marked forced that nothing joins. No re-run answers 409 `run_in_progress` any more. The service stores no report label, description or user and no run trigger on these shared rows: `label` and `description` are accepted, optional, and not stored.
1 change: 1 addition & 0 deletions changelog.d/1073.removed.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
`POST /reports` refuses `include_cliffs: true` with 422 `cliffs_not_available`, and so does a re-run of a stored report that asked for cliffs, until cliff impacts are calculated for each simulation run.
1 change: 1 addition & 0 deletions changelog.d/1081.removed.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
The Simulation Entrypoint's deployment no longer sets `V2_SIMULATION_OUTPUT_BUCKET` on its Cloud Run service or requires the `beta` and `prod` GitHub variable of that name for the entrypoint's deploy step; the service never used it. The Stage 12 deployment steps still pass it to the Modal coordinator and workers, which write simulation output files to that bucket. The simulation persistence library drops the create functions that use no definition keys, the search for an earlier succeeded simulation run to reuse, and the `reuse` parameters of the economy store's input reads, none of which the service has called since reports, simulations and runs are found or created by key. Requests and answers are unchanged.
65 changes: 39 additions & 26 deletions docs/migration/stage-12-modal-worker-foundation.md
Original file line number Diff line number Diff line change
Expand Up @@ -288,12 +288,15 @@ creates or claims a `stage12_evaluation_*` record. Only comparison-path calls,
which pass an evaluation record, write those, until the comparison path is
removed. The household functions work the same way on `household_jobs`.

**A report run.** The simulation service creates, in one transaction, the
`simulations` and `reports` rows, a `simulation_runs` row for the baseline and
one for the reform (pending, with no `modal_call_id`; or a run that already
succeeded, to reuse it), and the `report_runs` row naming both (pending, with no
`modal_call_id`). It then starts the manifest's `report_coordinator_callable`
(`coordinate_report`) with two arguments and no evaluation record:
**A report run.** The simulation service finds or creates by definition key,
in one transaction, the `simulations` and `reports` rows, a `simulation_runs`
row for the baseline and one for the reform (pending, with no `modal_call_id`;
or a run of the same simulation on the same versions that it joins, which may
have succeeded already), and the `report_runs` row naming both (pending, with
no `modal_call_id`, or a run on the same versions that it joins). For a report
run it created, it then starts the manifest's `report_coordinator_callable`
(`coordinate_report`) with two arguments and no evaluation record; a joined
report run gets no call:

- the report input, a `ReportExecutionInput` whose `evaluation_id` is the report
run's ID and whose baseline and reform `simulation_execution_id`s are their
Expand All @@ -313,7 +316,7 @@ run row naming other simulation runs, fails the report run with
`report_run_input_mismatch`. If a worker it starts finds its run held by
another call, the coordinator waits for that run instead (see "Shared
simulation runs" below). It uses the stored output of each simulation run
that already succeeded (see the reuse of succeeded runs above), fails the
that already succeeded (see the joined runs above), fails the
report run with the run's own recorded failure if a run it must calculate
already failed (`simulation_run_failed` if it recorded none), and starts a
worker for each other one with a context naming only that
Expand All @@ -327,8 +330,10 @@ once. It returns
`{"report_run_id", "status"}`, or the same marked `deduplicated` without running
when another call holds the report run or it has finished.

**A simulation run on its own.** The service creates the `simulations` row and
its `simulation_runs` row (pending, no call), starts the country's
**A simulation run on its own.** The service finds or creates by definition
key the `simulations` row and its `simulation_runs` row (pending, no call, or
a run on the same versions that it joins, which gets no call). For a run it
created, it starts the country's
`single_simulation_callable` with a `SimulationExecutionInput` (role
`standalone`, no output plan, `evaluation_id` and `simulation_execution_id`
both the run's ID) and a context naming the run in `simulation_run_id`, with
Expand All @@ -338,15 +343,20 @@ call as for a report run. A prefix without it fails the run. The worker plans th
outputs with its stored plan, as a report run's coordinator does (below).

**A re-run.** The service re-runs a stored report or simulation with the same
two calls, by run ID. It creates the record's new run (a report run with
trigger `manual`) and, for a report, a new `simulation_runs` row of each side's
own simulation, or names that simulation's run that already succeeded on the
same versions, unless the re-run is forced. The new runs record the catalog
version, dataset and region of the current .py version's catalog; the
`simulations` and `reports` rows are unchanged. A budget-window report's
re-run is a new `budget_window_runs` row (trigger `manual`) with a report run
per year, each on its year's own simulations, started as a new window's
first years are. The coordinator and workers claim and calculate them as
two calls, by run ID. A simulation's re-run, which takes no `force`, joins
the simulation's run on the current versions, catalog version and year that
hasn't failed and wasn't forced, which gets no call, or else creates one. A
report's re-run, for a report created by key and unless forced, joins the
report's run on the current versions the same way, or else creates the
report's new run naming each side's simulation run on those versions, found
or inserted (C1 · 24's answers 3 and 8); a forced re-run, and every re-run
of a report created before keys, creates an extra run on a new run of each
side, all marked forced. No new run names a trigger (answer 6). The new runs record the
catalog version, dataset and region of the current .py version's catalog;
the `simulations` and `reports` rows are unchanged. A budget-window report's
re-run joins or creates a `budget_window_runs` row with a report run per
year, each on its year's own simulations, a new one started as a new
window's first years are. The coordinator and workers claim and calculate them as
they would a new record's: nothing on the Modal side tells a re-run apart.

**Each worker** claims its simulation run under its own Modal call ID: a pending
Expand Down Expand Up @@ -435,9 +445,11 @@ window of 1 to 75 consecutive years. It is an economy report whose
the year, with its own simulation runs of that year, so a year can reuse a
single-year report's runs, and the reverse.

- **Creating and starting.** The simulation service creates every year's runs
in one transaction, all pending with no call, then starts the earliest
years within one ten-second wait for Modal, counted from the first start;
- **Creating and starting.** The simulation service finds or creates the
window and its window run by key, in one transaction; a window run it
creates names every year's report run, each on its year's simulation runs,
found or created, and every run it creates is pending with no call. For a
window run it created, it then starts the earliest years within one ten-second wait for Modal, counted from the first start;
a later year not confirmed within it is deferred (`YearStartDeferred`)
and waits for a started year's coordinator. The contract's
`year_calculation` derives each year's coordinator
Expand Down Expand Up @@ -921,11 +933,12 @@ pre-emption records nothing. An error in the report run's claim, or in the
read of its simulation runs, fails the report run if the claim applied
before the error, and leaves its simulation runs to the stuck-run sweep.

A household report's re-run (`POST /reports/{report_id}/runs`) is a new
report run, trigger `manual`, naming a new run of each side's own household
simulation on the current catalog version, in the report's year. The
service starts one call for it, as for a new household report, and the
function claims and calculates it as it would a new report's run.
A household report's re-run (`POST /reports/{report_id}/runs`) joins or
creates its report run as an economy report's does, each side's run of its
own household simulation on the current catalog version, in the report's
year. The service starts one call for a run it created, as for a new
household report, and the function claims and calculates it as it would a
new report's run.

The stuck-run sweep (`src/modal/run_sweep_app.py`) fails household jobs
nothing will finish by the rule it applies to report runs and simulation
Expand Down
Loading
Loading