Repository navigation
obr_shock: household lever no longer fails when the shock is shorter than the solve window - #283
Open
vahid-ahmadi wants to merge 1 commit into
Open
vahid-ahmadi wants to merge 1 commit into
vahid-ahmadi wants to merge 1 commit into
Conversation
… of raising obr_shock(var='HHDI_ADDFACTOR') with periods < 12 raised TypeError after both solves: the model leaves gdp_per_revenue_* None in post-shock quarters and the adapter rounded them with float(). The lists now keep None there and stay aligned with the result rows. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This was referenced Nov 25, 2026
Closed
Contributor
Author
|
Coverage note: the new slow test ( 🤖 Generated with Claude Code |
This was referenced Nov 26, 2026
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.
What was wrong
obr_shock(var="HHDI_ADDFACTOR", ...)fails for anyperiodsbelow 12, locally and on the hosted server:The model always solves to 2027Q4 at least (12 quarters from 2025Q1). It leaves the GDP-per-pound ratio undefined (
None) in the quarters after the shock ends, because there is no revenue to divide by. The adapter rounded every entry withfloat(), so the call raised after both solves had finished. The household lever is the costing channelscore_reformuses and the one lever the tool text recommends reading, so a short household shock is an ordinary request.The ratio was added on 16 Nov 2026 (
9b2c8e1d). The existing test patched the solve window down to the two shocked quarters, so it never saw a post-shock quarter.Evidence
0e44ec8(the pin):core.obr_shock("HHDI_ADDFACTOR", 1000, periods=8)raises the error above.run_reformitself returnsgdp_per_revenue_real = [0.0931, ..., 0.2793, None, None, None, None].start_job(tool="obr_shock", arguments={"var": "HHDI_ADDFACTOR", "shock": 1000, "periods": 8}), jobfc-01M87ZTT0D4QEQB69M51NSAWFE, ran for about four minutes and thenget_job_resultreturned the samefloat()error.periods=12is unaffected, which is why the drift canary and the site's worked example (both 12 quarters) pass.What changed
core.obr_shock:gdp_per_revenue_current_price,gdp_per_revenue_realandcpi_pct_deltago through one helper that keepsNonefor an undefined quarter (Noneor NaN from the model). The lists stay the same length asresults, so index i is still quarter i. I kept theNoneentries and did not truncate the lists, so a caller cannot misalign them with the rows.mcp_server.obr_shockdocstring: says the ratio is null after the shock ends.Noneand a NaN tail, which also checks the payload is strict JSON; and aslowtest that runs the installed model withperiods=4.No published number changes. Every site figure from this lever uses 12 shocked quarters, where each ratio is defined.
How verified
core.pyand passes with the fix.pytest tests -qinintegration/: 496 passed, 80 skipped (obr-macro-model0e44ec8and boe_var17f5d82installed).pytest tests/test_wiring.py --runslow -k real_solve_shorter: passed against the real model (75 s).pytest tests -q3281 passed;site_contract.pyandsite_nav.pyclean.Note for the merge
Merging redeploys the hosted MCP server (
deploy-mcp.ymlruns onintegration/**), which is what clears the hosted failure.🤖 Generated with Claude Code