Skip to content

Stage validated dashboard bytes and parse freeze payloads strictly - #307

Draft
MaxGhenis wants to merge 3 commits into
mainfrom
lane/dashboard-strict-bytes
Draft

MaxGhenis wants to merge 3 commits into
mainfrom
lane/dashboard-strict-bytes

Conversation

@MaxGhenis

@MaxGhenis MaxGhenis commented Dec 3, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #293 and #292, two follow-ups from the round-2 review of #281, and part 1 of #315.

  • Upload the dashboard bytes publish-dashboard validated #293: publish_dashboard now stages the exact bytes it validated and hashed (raw), instead of copying the source path again. If an export replaced the source between the two reads, the release used to get bytes nothing had checked.
  • Read dashboard payloads strictly in the snapshot freeze scripts #292: scripts/freeze_snapshot.py and scripts/freeze_adds0928.py now parse the dashboard payload with load_dashboard_json (strict UTF-8, no NaN or Infinity), so every gate reads it the way the publisher does. freeze_snapshot.freeze_run also checks the payload before it replaces the existing frozen run directory.
  • Freeze scripts mutate or re-read before validating (from #307 review) #315 part 1: freeze_snapshot.main() now removes stale artifacts only after freeze_run() succeeds. The strict parser can now reject a hash-pinned payload inside freeze_run(); with the old order, that rejection left the snapshot without its top-level US CSVs while the manifest still named them.
  • Review fixes: publish_dashboard refuses an asset name that isn't a single file name (separators, a drive, "", ., .., NUL) before any write or gh call. The new tests stage under tmp_path, and the freeze_preflight fixture restores sys.path, pandas' future.infer_string and OPENBLAS_NUM_THREADS.

Tests:

  • test_upload_rejects_invalid_asset_names and test_freeze_preflight_restores_process_state cover the review fixes.
  • test_upload_uses_validated_bytes_when_source_is_replaced swaps the source file mid-publish and checks that the uploaded bytes and the pointer's sha256 and size match the validated payload.
  • test_freeze_run_rejects_nonstandard_dashboard_json and test_freeze_rejects_nonstandard_dashboard_json give each freezer a hash-matched payload containing NaN and expect PublishError. The first now runs freeze_snapshot.main() against a temporary snapshot directory and checks that the previous frozen run, the top-level US CSVs and the older run directories are left intact.

Codex lanes (GPT-6.2 Sol) wrote the patch and its two fix commits, and Claude read each against the PR head before applying it. The tests were not run locally; CI runs pytest -m "not slow". ruff check and ruff format --check pass on the changed files.

🤖 Generated with Claude Code

- publish_dashboard uploads the bytes it validated and hashed, instead of
  copying the source path again (#293).
- freeze_snapshot.py and freeze_adds0928.py read the dashboard payload with
  load_dashboard_json (strict UTF-8, no NaN or Infinity), as the publisher
  does; freeze_snapshot checks it before replacing the frozen run (#292).
- Tests: a source replaced mid-publish still uploads the validated bytes;
  both freeze gates refuse a payload with NaN.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@vercel

vercel Bot commented Dec 3, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated
policybench-site Ready Ready Preview Dec 3, 2026 5:08am UTC

Request Review

Fixes from review round 1:
- publish_dashboard refuses an asset name that isn't a single file name
  (POSIX or Windows separators, a drive, "", ".", "..", NUL) before any
  write or gh call. The base's same-file copy refused one such case; the
  staged write would have overwritten the source.
- The staged-bytes test stages under its tmp_path.
- freeze_preflight restores sys.path, pandas' future.infer_string and
  OPENBLAS_NUM_THREADS after each test; a new test checks all three.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Fix from review round 2: freeze_snapshot's main() now calls
remove_stale_artifacts() after freeze_run() returns and before
freeze_committed_artifacts() copies the new CSVs. A dashboard that the
strict parser rejects (NaN under a matching pin) no longer leaves the
snapshot without its top-level US CSVs or its other run directories.
freeze_run() writes only under runs/<RUN_LABEL>, which the cleanup keeps.

The NaN rejection test now runs main() against a temporary snapshot
directory and checks that the CSVs, the older run directories and the
previous payload survive. The call-order tests expect the new order.

This is part 1 of #315.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch was successfully deployed

1 active deployment
Preview — d1a33e9b Deployed Dec 3, 2026 by vercel[bot]
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.

Upload the dashboard bytes publish-dashboard validated

1 participant