Repository navigation
v3 run bar: hold the time estimate inside the API's reported stage - #1285
Merged
Merged
Conversation
When the economy API reports a run's stage (policyengine-sim-api#781, relayed by policyengine-api#3916), the v3 bar holds its time estimate between progress (where the stage starts) and progress_max (just before the next one), names the stage under the title, and never moves backwards. Without the fields, nothing changes. The strategy passes the fields on as CalcStatus.runStage for opted-in v3 runs only (estimateByRegion); legacy v2 statuses are unchanged. Both v3 report pages now use the region duration estimate. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
anth-volk
added a commit
that referenced
this pull request
Oct 15, 2026
…audit and report re-runs Brought over from main: the v3 audit fixes (#1273, #1274, #1277, #1278, #1280, #1281, #1283, #1284, #1285), run progress from the API, a report that opens from its stored output and records a failed run, a wait for the reform policy, the report year switcher and All years view (#1292), dated edits in the adjust panel (#1294), each country's own draft, and Your reforms' read-only reform detail with a parameters table, "View results", "Re-run" and the delete prompt (#1288), with the other merged fixes (#1289, #1290, #1293, #1295, #1296). How the conflicts were resolved: - Report page: a link is still a saved report's ID, read through the credential-free shared-report route, with the v1 report's number only without accounts. The v1 report it names (the shared row's legacy_report_id) gets main's run lifecycle: stored output, recorded failures, the household guard, the wait for the reform policy (for any link that resolved), the unknown-baseline state and the year switcher. - Reforms page and ReformReports: main's read-only detail, parameters table, delete prompt, View results and Re-run, on this session's stores and session-scoped query keys. "View results", "Open" and "View full impact report" go to reportLink(report), never the v1 report's number. The detail keeps this branch's guards: a reform whose changes did not load cannot run and says so, a reform that changes nothing cannot run, and the run sends what Build would. A record without a year reads it from the API's record. - Build's run bar: still "Save and run", which saves first and runs nothing when the save fails; it now saves only the values that differ from current law, leaves a reused reform (and its name) as it is, and names a budget window's years. A new reform has nothing to save when nothing differs. - Adjust panel: main's dated edits, budget window and unknown-baseline guard on this session's reform store; recompute still waits until a value differs from current law. - draftReform: loadProvisionsIntoDraft takes both the saved reform it edits and main's window and source. - Tests: main's run-hook tests sit beside this branch's store tests; the run bar test that ran a report after a failed save is dropped, as a failed save runs nothing here. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch was successfully 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.
The v3 report bar divides elapsed time by a typical duration. PolicyEngine/policyengine-sim-api#781 adds the run's real stage to the job status, and PolicyEngine/policyengine-api#3916 relays it on the economy response (
stage,progress,progress_max,segments). This PR uses those fields in the v3 bar. Until they deploy, nothing changes.Behaviour
progress(where the current stage starts) andprogress_max(just before the next stage). A run inreformcannot show less than 67% or more than 96%.RunProgresskeeps the highest value shown. While a run is queued the API cannot know its path, so the next stage's range can start lower.getDurationForRegion, the follow-up from Estimate society-wide run time by region #1257.Why a time estimate inside the stage, not the API's
progressalone: a backtest on the 6–13 October production timings gave the stage-only bar 10–32 points of mean error when one stage is long, and the time estimate held inside the stage 3–15.Changes
SocietyWideCalculationResponse: optional stage fields.SocietyWideCalcStrategy: passes them on asCalcStatus.runStage(stage,floor,max,segments) for opted-in v3 runs only (estimateByRegion). Legacy v2 statuses are unchanged.useCalculationStatusanduseBillEconomy: exposerunStage.RunProgress:runStageprop,runProgressValue,runStageCaption, high-water mark.Report.pageandBillReport.page: passrunStage; region duration estimate.Checks
runStageonly for v3 runs with stage fields.bun run vitest: 4,930 passed, 10 skipped.bun run typecheckandbun run prettier: pass.bun run lint: eslint passes; stylelint reports one existing error insrc/app.css, which this PR does not touch.Merge order
Safe to merge before the API PRs: without the stage fields the bar behaves as it does today.
🤖 Generated with Claude Code