Repository navigation
Conversation
MaxGhenis
force-pushed
the
us-api-dataset-param
branch
from
November 8, 2026 20:25
d97d175 to
76b0c69
Compare
MaxGhenis
force-pushed
the
uk-data-issue-routing
branch
from
November 8, 2026 20:30
597ab30 to
b4f7854
Compare
…ts bundle
policyengine-api's economy routes reject query parameters they don't
declare, so microsim-runner's `dataset=enhanced_cps`, its budget-window
helper and model-corroborator's mirror call each got HTTP 400 "dataset:
Extra inputs are not permitted". The routes run every economy request on
the one dataset /{country}/metadata lists: Microcosm's `populace_us_2024`
for the US on 2026-11-08.
- microsim-runner: drops `dataset` from the annual and budget-window calls
and lists the parameters each route takes. `run_dataset` replaces the
advertised-dataset table and the "populace" substring check: it names the
dataset and data version from the result's `policyengine_bundle` and
falls back to the metadata default. The runner takes the local path for a
named dataset and passes it to `pe.us.ensure_datasets`. The budget-window
section describes the live result (`annualImpacts` and `totals`, no
bundle), and `run_horizon` takes a region and raises on an error status.
- model-corroborator: drops `dataset` from the mirror call.
- reform-comparator: records the dataset, data version and model version
from the runner's output and flags a run off the default.
- policyengine-api and policyengine-app skills: the economy query
parameters, the budget-window route and the status envelope.
- test_dataset_naming: example, property and differential tests of
`run_dataset`, which the test runs straight from microsim-runner.md, and a
scan that fails when any doc sends `dataset` to an economy route.
`PE_SKILLS_LIVE_API=1` checks the metadata snapshots and the 400 against
the live API.
- test_no_stale_references: drops the runner's frozen "populace" span and
the dataset test's exclusion.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…on fallback On 2026-11-08 a live two-year US budget window for policy 97853 still read "Scoring 2026, 2027 (0 of 2 complete)..." after more than half an hour, and run_horizon would have polled it forever. It now raises TimeoutError at the first poll at or after max_wait_minutes (45 by default) and sets a timeout on each request, and the runner falls back to single-year calls in that case too. - test_budget_window_polling: runs run_horizon from microsim-runner.md against scripted answers and a fake clock, with example and property tests of the polling contract. - test_dataset_naming: pins the URI-revision fallback for a missing data version and a revision with dots in it; no earlier test failed when either broke. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
"Scoring 2026, 2027 (0 of 2 complete)" first came back at 19:27Z; the 19:26Z answer still read "Queued 2026". The batch later moved on, so the comment drops "never moved". Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
One full-suite run at 905b4dd failed one test with the host at load 81, and the rerun passed; the run's log kept only the counts. These nine property tests check run_dataset's and run_horizon's logic, not their speed, so a busy host shouldn't fail them on Hypothesis's 200 ms default deadline. test_build_manifest.py already sets deadline=None the same way. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
MaxGhenis
force-pushed
the
us-api-dataset-param
branch
from
November 8, 2026 20:51
76b0c69 to
dbcbafd
Compare
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.
Builds on #110 (base
uk-data-issue-routing). Retarget tomainonce #110 merges.policyengine-api's economy routes reject any query parameter they don't declare:
StrictQueryParameterssetsextra="forbid"inpolicyengine_api/query_parameters.py. microsim-runner's US call sentdataset=enhanced_cps, as did its budget-window helper and model-corroborator's mirror call, so each got HTTP 400 "dataset: Extra inputs are not permitted". The routes build every request withdataset="default"and run it on the one dataset/{country}/metadatalists undereconomy_options.datasets. On 2026-11-08 the metadata listed Microcosm'spopulace_us_2024atpopulace-us-2024-spm-20260915for the US andmicrocosm_uk_2024_25for the UK.Plan (WIP)
mainand retarget after Route UK data issues to the repo that builds the run's dataset #110 mergesChanges
dataseton the annual or budget-window route, and lists the parameters each route takes.run_datasetreplaces the advertised-dataset table and the"populace" in data_versioncheck. It names the dataset from thehf://URI in the result'spolicyengine_bundlethe way policyengine.py'sdataset_logical_namedoes. It fills a missing data version from the URI's@revision, and anything else the bundle leaves out from the metadata default.modesays, and passes the name tope.us.ensure_datasets.BudgetWindowResult:annualImpactsrows and atotalsrow, in dollars, with no bundle.run_horizontakes a region instead of reusing the country, raises on an error status instead of returningNone, and sets a timeout on each request. It gives up once a batch keeps computing past 45 minutes, and the runner then falls back to single-year calls. On 2026-11-08 a live two-year US window was still scoring 2026 two hours after the first request, while the same reform's single-year run for 2026 took about three minutes.reform_net_income, which the live result lacks.dataset.dataset,data_versionandmodel_versionfrom the runner's output, and notes a run whosedataset_matches_defaultcomes back false.PE_SKILLS_LIVE_API=1, it also checks the metadata snapshots and the 400 against the live API.run_horizonagainst scripted answers and a fake clock."populace" in data_versionspan, bans that sample on the runner, and scans the dataset test, which names datasets by their frozen ids.Invariants
Both test files exec the functions straight from microsim-runner.md, so the agent's code and its tests can't drift apart.
run_dataset, for any bundle whosedatasetholds anhf://URI, a bare name,defaultor nothing:default, a path, an@revisionor an.h5suffix;defaultwith no data version, gives the metadata default, anddataset_matches_defaultholds;@revisionbefore the metadata;dataset_matches_defaultholds if and only if both values equal the default entry's.For any non-empty
datasetstring other thandefault,run_datasetreturns the name policyengine.py'sdataset_logical_namereturns. A differential test calls the installed package's function, or a copy of its 6.16.0 body when policyengine isn't installed.run_horizon, for any run ofcomputinganswers, any ending and any deadline:okanswer, neverNone;RuntimeErrorwith the API's reason;TimeoutErrorat the first poll at or after the deadline, never earlier, and a terminal answer on that poll still wins;dataset.test_no_agent_or_skill_sends_dataset_to_the_apireads every Markdown file underskills/,targets/anddocs/. It flagsdatasetin a query string, or as a key or keyword inside a code block that calls/economy/, and two more tests pin what it must catch and allow.Verification
uv run pytest --ignore=tests/test_skill_examples.py: 297 passed, 6 skipped (the opt-in tests), 1 xfailed.run_horizonandrun_datasetfails a test, including ones that drop the deadline, check it before the status, senddataset, ignore the URI's revision or leave it on the name.PE_SKILLS_LIVE_API=1, both metadata snapshots match api.policyengine.org, and the US annual, US budget-window and UK annual routes each answerdatasetwith HTTP 400 "dataset: Extra inputs are not permitted".run_datasetand the pinned formula agree withdataset_logical_nameon generated strings.us, 2026) returned a bundle naminghf://policyengine/populace-us/populace_us_2024.h5@populace-us-2024-spm-20260915, which the check maps topopulace_us_2024and the metadata default.scripts/build_claude_wrapper.pybuilds, and the built runner carries the check and the deadline.🤖 Generated with Claude Code