mirror of
https://github.com/harvard-edge/cs249r_book.git
synced 2026-05-21 13:31:55 -05:00
[PR #1696] fix(labs): catch missing wheel before deploy to prevent BadZipFile in browser #10238
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/harvard-edge/cs249r_book/pull/1696
Author: @Shashank-Tripathi-07
Created: 5/7/2026
Status: 🔄 Open
Base:
dev← Head:fix/labs-wheel-missing-test📝 Commits (1)
fd6e27cfix(labs): catch missing wheel before deploy to prevent BadZipFile in browser📊 Changes
2 files changed (+42 additions, -0 deletions)
View changed files
📝
labs/tests/test_static.py(+21 -0)📝
labs/tools/build_site.sh(+21 -0)📄 Description
Summary
Fixes #1691.
Root cause:
micropip.install("../../wheels/mlsysim-0.1.1-py3-none-any.whl")in the browser resolves tomlsysbook.ai/labs/wheels/mlsysim-0.1.1-py3-none-any.whl. The live site was deployed before commit1eb30f5f8landed (which bumped the wheel and all lab references from0.1.0to0.1.1), so the URL returns a 404 HTML page.micropiphands that tozipfile, which correctly raisesBadZipFile. Every downstream cell then fails with "Ancestor raised".Immediate fix for maintainers: retrigger
labs-publish-live.ymlviaworkflow_dispatch-- no code change needed for the live site to recover.This PR prevents recurrence with two guards:
labs/tests/test_static.py-- newtest_wheel_file_exists_on_disktest that assertswheels/mlsysim-{version}-py3-none-any.whlactually exists on disk. This runs inlabs-validate-dev.yml, which gates the publish workflow via the publish guard. A deploy where the wheel file is absent will now fail CI before any WASM export happens.labs/tools/build_site.sh-- version-consistency guard added afterpython3 -m build --wheel. Reads the version frommlsysim/pyproject.toml, confirms the built wheel exists at the expected path, and spot-checkslab_01_ml_intro.pyto confirm themicropip.install()URL references the same version. Fails the build immediately with a clear error message if there is a mismatch.Test plan
python3 -m pytest labs/tests/test_static.py::TestWheelConsistency::test_wheel_file_exists_on_disk -vpasses with wheel present, fails with wheel removedlabs-validate-dev.ymlpasses on this branchlabs-publish-live.ymlto deploy the0.1.1wheel and unblock users hitting #1691🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.