Skip to content

One-command HF publish for Cross-dataset evaluation bundles - #169

Merged
MaxGhenis merged 11 commits into
mainfrom
publish-evaluation-bundle
Aug 23, 2026
Merged

One-command HF publish for Cross-dataset evaluation bundles#169
MaxGhenis merged 11 commits into
mainfrom
publish-evaluation-bundle

Conversation

@MaxGhenis

Copy link
Copy Markdown
Contributor

Publishing a Cross-dataset frontend bundle to policyengine/microcosm-evaluation was an ad-hoc upload for Belgium (#164). This makes it one verified, idempotent command — ready for the US bundle the moment the #159 run artifacts surface (asked on #166).

What changed

  • scripts/publish_evaluation_bundle_to_hf.py: uv run --extra publish python scripts/publish_evaluation_bundle_to_hf.py --bundle <run>/frontend --jurisdiction US [--repo …] [--dry-run] [--no-latest].
    • Verifies before touching the network: bundle schema (cross_dataset.frontend_bundle.v1), the manifest's jurisdictions contains the requested one, and a recomputed SHA-256 for every manifest-attested partition. Files the manifest does not attest are reported and never uploaded.
    • Immutable runs: re-publishing an identical bundle plans zero uploads; a differing file under an existing <cc>/<run_id>/ is refused before any commit (identity = size + LFS sha256, else git blob id).
    • Atomic: bundle files and <cc>/latest.json land in one commit (parent_commit guards concurrent writers), so the pointer never references a partial run; the previous pointer target is echoed when it moves.
    • Post-publish, it re-downloads manifest/summary (and latest.json) through the public resolve URL, checks hashes, and prints the base URL plus the env var to set (CROSS_DATASET_ARTIFACT_BASE_URL for US, _<CC> for others, matching Cross-dataset page per jurisdiction (BE bundle live; fail closed on manifest jurisdictions) #167; GB aliases to uk).
    • --dry-run needs neither a token nor huggingface_hub; the Hub client is imported lazily, so the default install stays dependency-free (publish optional group added).
  • evaluation_harness/frontend_bundle.py: the verification is now a reusable verify_frontend_bundle / frontend_bundle_partitions (safe relative paths, page sequence/count reconciliation, per-partition run/snapshot identity) shared by the script.
  • Docs: docs/cross-dataset-api.md gains the publish section; docs/chronicle-update-workflow.md links it as the publish step.

Validation

  • uv run pytest -q: 434 passed (403 baseline + 31 new; fake Hub client only, no network in tests). Without the publish extra: 433 passed, 1 skipped.
  • --dry-run against the real Belgium bundle: 12 files verified, exit 0; jurisdiction mismatch and missing-token paths exit 1 before any network.
  • Read-only check against the live dataset: the already-published BE bundle plans 0 uploads / 12 identical and latest.json byte-matches the live pointer (pinned by a test); a locally edited copy is refused as immutable.

🤖 Generated with Claude Code

MaxGhenis and others added 4 commits August 23, 2026 20:44
verify_frontend_bundle checks a published cross_dataset.frontend_bundle.v1
directory the way the web reader does: schema version, safe partition
paths, recorded SHA-256 for every listed partition, page sequence and
count reconciliation, and that each partition carries the manifest's run
and snapshot IDs. frontend_bundle_partitions exposes the descriptors in a
stable order so publishers can share the same attested file list.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Optional dependency group for uploading evaluation bundles to the Hugging
Face dataset; the default install and test suite do not need it.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
One reproducible command publishes a verified Cross-dataset frontend
bundle to the policyengine/microcosm-evaluation dataset in the layout of
the live Belgium bundle: <cc>/<run_id>/frontend/... plus <cc>/latest.json.

The script verifies the bundle locally (schema, jurisdiction, partition
hashes), compares it with the Hub by size and git blob id or LFS SHA-256
so a re-run is a no-op, refuses to overwrite a differing file under an
existing run id, uploads the missing files and the latest.json pointer in
one commit, then re-downloads manifest.json and summary.json through the
public resolve URL and prints the CROSS_DATASET_ARTIFACT_BASE_URL
variable the dashboard needs. --dry-run does the verification and prints
the plan without network calls; the token comes only from HF_TOKEN or
HUGGINGFACE_TOKEN. huggingface_hub is imported lazily so the script and
its tests (fake Hub client, no network) run without the publish extra.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@vercel

vercel Bot commented Aug 23, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
calibration-diagnostics Ready Ready Preview Aug 23, 2026 7:47pm

Request Review

@MaxGhenis
MaxGhenis merged commit 13db216 into main Aug 23, 2026
4 checks passed
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