Skip to content

Fix TRO regen in Versioning job: resolve path from script; allow empty writes#286

Merged
MaxGhenis merged 1 commit intomainfrom
fix-tro-regen-path
Apr 18, 2026
Merged

Fix TRO regen in Versioning job: resolve path from script; allow empty writes#286
MaxGhenis merged 1 commit intomainfrom
fix-tro-regen-path

Conversation

@MaxGhenis
Copy link
Copy Markdown
Contributor

Problem

The `Versioning` job keeps failing at "Regenerate bundled TRACE TROs" even after #285 added h5py. Log:

```
no release manifests found
##[error]Process completed with exit code 1.
```

Two bugs:

  1. `manifest_root = Path(str(files("policyengine").joinpath(...)))` did not glob correctly in CI's editable install context. The `importlib.resources` path returned an object whose stringification didn't round-trip through `Path(...)`/`.glob("*.json")`.
  2. When every country is skipped (current reality: `us.json` points at 1.73.0 which has no HF release manifest, `uk.json` points at a private repo that needs `HUGGING_FACE_TOKEN`), the script returns 1 on "not written", failing the entire publish flow.

Fix

  1. Resolve the manifest dir relative to the script: `Path(file).parent.parent / "src/policyengine/data/release_manifests"`.
  2. Exit 0 when every country is skipped — only real regressions (a country that previously shipped a TRO failing to regenerate) still fail.

Verified locally

```
$ python scripts/generate_trace_tros.py
skipped uk: ...HUGGING_FACE_TOKEN...
skipped us: No data release manifest was published for this data package.
no countries could be regenerated (all skipped)
$ echo $?
0
```

Why this unblocks the pipeline

Once this merges, the `Versioning` job's TRO step will succeed (0 writes, 2 skips, exit 0), the sentinel "Update package version" commit will get pushed, and the `Publish` job will ship 3.5.1 (or .6.0) to PyPI with the `policyengine-us==1.653.3` pin that policybench needs.

🤖 Generated with Claude Code

Two fixes for the Versioning CI step:

1. Use Path(__file__).parent.parent/src/... to locate the bundled
   manifests instead of importlib.resources.files(). The latter was
   returning a path that didn't .glob() properly in CI's pip install -e
   context, so the script saw zero manifests and bailed with
   'no release manifests found' (exit 1).

2. When every country is skipped (e.g., HF 404 for public us.json at
   1.73.0 and missing HUGGING_FACE_TOKEN for uk), exit 0 instead of 1.
   Nothing to do is not an error. Only real regressions (a country
   that previously had a .trace.tro.jsonld failing to regenerate)
   still fail the build.

Verified locally that the script now prints 'skipped us/uk: ...' and
exits 0, allowing the Versioning job to proceed to the PyPI publish
step.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@MaxGhenis MaxGhenis merged commit ebe8cd6 into main Apr 18, 2026
@MaxGhenis MaxGhenis deleted the fix-tro-regen-path branch April 18, 2026 17:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant