|
| 1 | +# Release Bundles |
| 2 | + |
| 3 | +Use this skill when updating or reviewing a `policyengine.py` certified release |
| 4 | +bundle for US, UK, or both countries. |
| 5 | + |
| 6 | +## Core Rules |
| 7 | + |
| 8 | +Open release-bundle implementation work on a fresh branch from current `main`. |
| 9 | +If the checkout is dirty, use a clean worktree instead of overwriting unrelated |
| 10 | +changes. |
| 11 | + |
| 12 | +Do not hand-edit bundled release manifests for normal updates. Use the existing |
| 13 | +single-country refresh script so model wheels, data artifacts, `pyproject.toml`, |
| 14 | +and TRACE TROs move together: |
| 15 | + |
| 16 | +```bash |
| 17 | +python scripts/refresh_release_bundle.py --country us --model-version 1.715.2 |
| 18 | +python scripts/refresh_release_bundle.py --country uk --model-version 2.89.0 |
| 19 | +``` |
| 20 | + |
| 21 | +When a new data release is part of the certification, pass it explicitly: |
| 22 | + |
| 23 | +```bash |
| 24 | +python scripts/refresh_release_bundle.py --country us \ |
| 25 | + --model-version 1.715.2 \ |
| 26 | + --data-version 1.115.5 |
| 27 | +``` |
| 28 | + |
| 29 | +There is no supported `all` mode. If a user asks to update both US and UK, run |
| 30 | +the single-country workflow for one country, inspect the result, then run it for |
| 31 | +the other country. |
| 32 | + |
| 33 | +UK data is private. Set `HUGGING_FACE_TOKEN` or `HF_TOKEN` before refreshing UK |
| 34 | +bundles. |
| 35 | + |
| 36 | +## Certification Order |
| 37 | + |
| 38 | +For one country, first attempt full bundle certification with the existing |
| 39 | +refresh script and a country data release manifest that supports the target |
| 40 | +model by exact build version or matching `data_build_fingerprint`. |
| 41 | + |
| 42 | +If full certification is not possible, the fallback is a country-data release |
| 43 | +manifest assertion through `compatible_model_packages`. This fallback must be |
| 44 | +created with the country data repo's release-manifest tooling, not by manually |
| 45 | +editing the `policyengine.py` bundle. Tell the user clearly that this fallback is |
| 46 | +only the data-release publisher claiming compatibility; there is currently no |
| 47 | +validation or verification proving that the setup actually works. |
| 48 | + |
| 49 | +For that fallback, use the country data repo's release-manifest builder or |
| 50 | +publishing path with `additional_compatible_specifiers` set to the target model |
| 51 | +specifier, for example `("==1.715.2",)` for US or `("==2.89.0",)` for UK. |
| 52 | +Publish the updated country data release manifest before touching the `.py` |
| 53 | +bundle. |
| 54 | + |
| 55 | +After a country-data fallback manifest is published, rerun |
| 56 | +`scripts/refresh_release_bundle.py` for that country and point at the updated |
| 57 | +data release manifest revision if needed. |
| 58 | + |
| 59 | +## Expected Files |
| 60 | + |
| 61 | +A real `.py` refresh should normally change only: |
| 62 | + |
| 63 | +- `src/policyengine/data/release_manifests/{country}.json` |
| 64 | +- `src/policyengine/data/release_manifests/{country}.trace.tro.jsonld` |
| 65 | +- `pyproject.toml` |
| 66 | +- `uv.lock`, only if the lockfile is intentionally refreshed |
| 67 | +- one Towncrier fragment under `changelog.d/` |
| 68 | + |
| 69 | +Unexpected files are a reason to stop and inspect the diff. |
| 70 | + |
| 71 | +## Testing |
| 72 | + |
| 73 | +For release-bundle script or manifest changes, run: |
| 74 | + |
| 75 | +```bash |
| 76 | +POLICYENGINE_SKIP_COUNTRY_IMPORTS=1 uv run pytest --noconftest \ |
| 77 | + tests/test_bundle_refresh.py |
| 78 | + |
| 79 | +uv run pytest \ |
| 80 | + tests/test_release_manifests.py \ |
| 81 | + tests/test_trace_tro.py |
| 82 | +``` |
| 83 | + |
| 84 | +For a real data artifact change, also run and review snapshot diffs: |
| 85 | + |
| 86 | +```bash |
| 87 | +PE_UPDATE_SNAPSHOTS=1 uv run pytest tests/test_household_calculator_snapshot.py |
| 88 | +``` |
| 89 | + |
| 90 | +Before opening a PR, run the standard repository checks from |
| 91 | +`repository-guidance.md`. |
0 commit comments