obr_shock allows periods up to 40 but always solves 12 quarters, so its cumulative GDP figure is mislabelled
Los mantenedores suelen responder en 9 días
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Aptitud para principiantes
- 55/100
- Tipo de issue
- Error
- Claridad
- Bastante claro
- Estado de actividad
- Activo
- Stack tecnológico
- python
- Área
- backend-api-design
Línea de trabajo
Start with integration/src/policyengine_macro/core.py around obr_shock and the MCP schema in mcp_server.py; trace how periods sets the solved window and how the cumulative GDP figure is built. Implement the recommended 12-quarter cap and carry shock_quarters_beyond_horizon into the payload as a guard. Done when requests above 12 are rejected or capped consistently and the payload cannot label a 12-quarter sum as a longer period.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Problem
obr_shock accepts periods from 1 to 40 (_OBR_MAX_PERIODS = 40, integration/src/policyengine_macro/core.py:1268-1269; MCP schema mcp_server.py:200, le=40). It then calls run_reform(...) with no start/end (core.py:262-268), so the OBR model always solves its default window, 2025Q1–2027Q4 (12 quarters, obr_macro/reform_analysis.py:613-620).
For periods > 12:
resultshas 12 rows;cumulative_delta_gdp_bn_over_shock_periodssumsrows[:periods], which is the same 12 rows, while the payload echoes"periods": 20;- the caller reads a 20-quarter cumulative figure that covers only 12 quarters.
PolicyEngine/obr-macroeconomic-model#48 makes run_reform warn in this case and record df.attrs["shock_quarters_beyond_horizon"]. That stops it being silent on the model side, but the macro payload still mislabels the sum.
Options
- Cap
periodsat the solved window. Set_OBR_MAX_PERIODS = 12and MCPle=12. This is the smallest change. - Solve the window the caller asks for. Pass
endso that the window coversperiods. The OBR data runs to 2031Q1, so the model supports at most 25 quarters from 2025Q1. Set the cap to 25 and passend = 2025Q1 + periods - 1. This costs one more template build per newend, because the template cache is keyed on (var, start, end, closure). - Keep 40, but carry
shock_quarters_beyond_horizoninto the payload and rename the headline field to "over the solved window".
Evidence on longer windows (6 Nov 2026 sweep)
run_reform machinery, window 2025Q1–2031Q1 (25 quarters):
- CGG solves cleanly over all 25 quarters. A 4-quarter +£1,000m shock gives +£1,000m for q0–q3, then at most £1m of residue. A sustained −£1,000m shock gives −£1,000m ±£1.2m to q24. (The multiplier is the known 1.0 identity, against the OBR's 0.6 tapering to zero.)
- The household channel (
HHDI_ADDFACTOR) is noise-dominated after about q12. A 12-quarter £1,616m/q tax rise lowers GDP by £552m at q11. After the shock ends, GDP does not return toward baseline: it is still −£853m at q24, and the HHDI delta comes back to about −£1.7bn to −£2.2bn in q17–q23. The equal tax cut gives −£217m at q24, the wrong sign. Rise + cut is 125% of the rise's peak, against 10.5% inside the shock window. The likely cause is the undetermined nominal-GDP/investment-deflator pair on the OBR side (PolicyEngine/obr-macroeconomic-model#42).
Recommendation
Option 1 for now: cap periods at 12, and carry shock_quarters_beyond_horizon into the payload as a guard. Option 2 (a longer window, up to 25 quarters) becomes reasonable once the closure in obr-macroeconomic-model#42 is fixed and a sweep shows the household tail returning toward baseline. obr_score_reform is affected the same way: its default 5-year window (2026Q1–2030Q4) reads household-channel quarters past the reliable range.
🤖 Generated with Claude Code
- Lenguaje dominante
- HTML
- Estrellas
- 3
- Forks
- 0
- Merge medio
- 8 d 15 h
- PR fusionados (30 d)
- 1
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Sin plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de PolicyEngine/macro
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
PolicyEngine/macro#225 · 2 comentarios ·
Los mantenedores suelen responder en 9 días
-
question
Dificultad 2/5 1-3 horas Aptitud para principiantes 67/100
PolicyEngine/macro#214 ·
Los mantenedores suelen responder en 9 días
-
bug documentation
Dificultad 1/5 1-3 horas Aptitud para principiantes 76/100
PolicyEngine/macro#211 · 1 comentario ·
Los mantenedores suelen responder en 9 días
-
Dificultad 5/5 Más de una semana Aptitud para principiantes 18/100
PolicyEngine/macro#230 ·
Los mantenedores suelen responder en 9 días
-
question
Dificultad 5/5 Más de una semana Aptitud para principiantes 22/100
PolicyEngine/macro#227 · 4 comentarios ·
Los mantenedores suelen responder en 9 días
Todos los issues de PolicyEngine/macro
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
WalletConnect/walletconnect-monorepo#7392 · 1 comentario ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 86/100
Los mantenedores suelen responder en 1 día
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
rohit746/pdf-view.nvim#109 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
Azure/azure-functions-nodejs-extensions#180 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 78/100
tidyverse/ellmer#1226 · 1 comentario ·
Los mantenedores suelen responder en 3 días