Repository navigation
Conversation
A run that loads a dataset other than the image's default downloads it from Hugging Face in each new container, and policyengine.py makes one request per file. One read timeout from the CDN failed release run 42040665530. The main path and Stage 12 now each make up to three attempts at the load, with a jittered wait that doubles, on connection errors, timeouts, truncated response bodies and 5xx responses; 401, 403, 404, other 4xx responses and SHA-256 mismatches are never retried. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The routes job now adds the release's routes and bundle manifest without moving latest, and completes its own publication. A new job, after every check and the Cloud Run promotion, moves latest when the release is newer, checks that unpinned requests reach the release, and puts latest back if a later step fails. No check is upstream of the routes job, so rerunning only the failed jobs completes a deploy without republishing routes, and the latest job always journals a new state, so no restored outcome from an earlier attempt remains. The rollback restores each attempt's routes plan and latest plan. Registers the behaviour as rule sim.deploy.latest-moves-after-checks. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…fragments Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…yengine.py's download The Modal images install only the modal-simulation-image group, so the retry's direct requests import needs it there too. A new test drives the real UK ensure_datasets to show policyengine.py passes a download error to the retry unwrapped. The retry's docstrings now say a 429 is not retried and a TLS failure is. (Review round 1, part 1.) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…k latest through the custom hostname A rerun's job list shows every job it carried over from the attempt before, with its original start time, though it uploaded no plan; the rollback now requires an attempt's plan only for a job that started in that attempt (run 42040665530 lists its routes job in both attempts). The latest job also checks the configured custom hostname, which the promotion's smoke checked for latest before. Updates the comments, the two rule statements and the README for the first publication into an empty routing state and for which job completes each publication. (Review round 1, part 2.) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…show undone GitHub stops listing an attempt's artifact once the job that uploaded it reruns (run 41703573393 lists only attempt 3's plans). After a failed latest move was put back and the latest job reran, the rollback refused because attempt 1's latest plan could not be downloaded, though nothing it published can be live. A kept plan may now be missing only when the nearest downloaded plans before and after it show its change undone: the later plan replaced exactly the state the earlier one published. Updates the restore and completion wording, the rollback header and the README. (Review round 2.) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…oaded one Restoring the downloaded plans without such a plan is still exact: if its change, or anything built on it, is live, the live state matches no downloaded plan and the restore refuses as a conflict. Adds tests for several missing plans in a row, a neighbouring plan without digests, and a check that the script's job and step names are the deploy workflow's. The refusal now names policyengine_version as the fallback. Corrects the README, the workflow comment and rule sim.deploy.latest-moves-after-checks: no job that runs after the routes job is upstream of it (rather than no check), shared model-version pins stay on a failed release, and the promotion stays when latest is put back. (Review round 3.) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…s without project labels Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
test_deployment_uses_gcloud_workflow_without_terraform counts the jobs that declare the GitHub release environment; with the latest job the count is 16, and its comment now says every job but stage12_v2_ready declares it. test_deploy_workflow_threads_force_latest_to_routing_publisher now finds force_latest in the latest job's routing-plan-latest.sh, and checks the routes plan's routing-plan.sh takes no --force-latest. (The first failed on CI; the second would have failed there once the executor tests ran.) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
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.
Fixes #1022
Same-Repository Draft PR Check
PolicyEngine/policyengine-sim-api, not a personal fork.Changelog
changelog.d/<name>.<type>.md, whose type is breaking, added, changed, fixed or removed. It adds two:retry-dataset-downloads.fixed.mdandmove-latest-after-checks.changed.md.Summary
Retry run-time dataset downloads.
dataset_download_retry(main path) and its own Stage 12 copy,stage12_runtime.dataset_download_retry, wrap the run-time dataset load. Both main-path loads insimulation_runtimeand the Stage 12 load incalculate_simulation_framesare wrapped.DatasetMaterializationErrorfor 401, 403, 404 and a SHA-256 mismatch. Other 4xx responses (including 429) are not retried either.requestsis now a direct dependency, including inmodal-simulation-image, the only group the Modal images install.Publish a release's routes before its checks, and move
latestafter them."Publish routing after all services pass" (
update_routing) now adds only the release's routes and bundle manifest (--plan-outplans routes only), then completes its own journal entry. The routes are its policyengine.py version and its US and UK model versions, mapped to the deployed app.latestis left alone, except on the first publication into a routing state with no latest version.A new job, "Move latest to the release after every check" (
publish_latest), runs after the stack verification, the authenticated tests and the Cloud Run promotion. It:--plan-latest-out, solatestmoves only to a newer release, or withforce_latest;/versionswith the entrypoint smoke at the URL callers use, and at the custom hostname when one is configured. This is theEXPECTED_LATESTcheck that previously ran in the stack verification and the promotion;If a step after recording fails, it restores the state its plan replaced. It journals a new state even when
lateststays, so a rerun's attempt replaces an earlier attempt's recorded outcome.No job that runs after the routes job is upstream of it, so "Re-run failed jobs" after a failed check reruns the checks, the latest job and the finalizer, and does not republish the routes. A failed check leaves the routes in place.
finalize_routingandsimulation-deployment-ready.shnow also wait for, and require, the latest job.A Stage 12-only deploy (
stage12-deploy.yml,deploy_existing_stack: false) skips both routing jobs, as before.Rollback with
deploy_run_id(rollback-restore-routing.sh):New rule
sim.deploy.latest-moves-after-checks, enforced bytest_deployment_assets_latest.py. Rulesim.deploy.routing-publication-journaled's statement is updated, and one node ofsim.deploy.release-identity-smokepoints at the moved test. These touch the rule files, which need approval from a core developer other than the author (sim.process.rule-machinery-code-owned).Decided: removing a failed release's routes. Nothing removes them automatically, because a rerun of the failed jobs needs them. When a failed release will not be rerun, an operator runs
simulation-rollback.ymlwithdeploy_run_id, which restores the run's plans only while the routing state is still what that run published.Effects to be aware of
deploy_run_idrollback removes its routes.latestmoves. If the latest job fails,latestis put back but stable traffic stays on the new entrypoint revision.Not changed here
uk_area_hdf_dataset_path) still has no retry.deploy_run_idrollback of a run whose routes job reran after uploading its plan (for example after "Re-run all jobs") still refuses, because GitHub no longer lists the earlier routes plan. Roll back withpolicyengine_versioninstead.latestback and the finalizer fail in one attempt, the first rerun's record step refuses and a second rerun completes the deploy.mainbehaves the same way for the routes job.latestin one write:plan_routing_publication,build_next_routing_stateand the direct publish mode of the CLI) remains available; no workflow uses it.Testing
Written test-first. Each new or changed test was run on its own by pytest node ID; full suites were not run locally.
projects/policyengine-simulation-executor: 85 test cases. These are the newtest_dataset_download_retry.py,test_stage12_dataset_download_retry.pyandversion_registry/test_routing_split_publication.py, plus the updated CLI, writer and rollback tests inversion_registry/.projects/policyengine-simulation-entry: 152 test cases. These are the newtest_deployment_assets_latest.pyand the updated routing, readiness, release-check, identity-smoke, promotion, script, invariant and rollback tests.test_deployment_uses_gcloud_workflow_without_terraform, which counts the jobs that declare the release environment (16 with the new job, not 15). Fixed and run by node ID.python3 scripts/run_quality_guards.py,.github/scripts/check-uv-locks.shand.github/scripts/check-changelog-fragment.sh.🤖 Generated with Claude Code