mirror of
https://github.com/harvard-edge/cs249r_book.git
synced 2026-05-06 17:49:07 -05:00
[PR #1346] [MERGED] feat(ci): tooling to catch fork-PR variable leaks and marimo dataflow bugs #6488
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/1346
Author: @profvjreddi
Created: 4/16/2026
Status: ✅ Merged
Merged: 4/16/2026
Merged by: @profvjreddi
Base:
dev← Head:feat/ci-sanity-tooling📝 Commits (1)
31d2f5efeat(ci): tooling to catch fork-PR variable leaks and marimo dataflow bugs📊 Changes
7 files changed (+454 additions, -9 deletions)
View changed files
➕
.github/scripts/check_workflow_fork_safety.py(+223 -0)➕
.github/workflows/ci-sanity.yml(+57 -0)📝
.github/workflows/kits-validate-dev.yml(+12 -3)📝
.github/workflows/labs-validate-dev.yml(+12 -3)📝
.github/workflows/mlsysim-validate-dev.yml(+12 -3)📝
.pre-commit-config.yaml(+14 -0)📝
labs/tests/test_static.py(+124 -0)📄 Description
adds static checks for two bug classes we hit in the last week, each of which produced silent, long-lived failures:
bug classes
1. workflow fork-safety (the #1344 incident). any
pull_request-triggered workflow that references${{ vars.* }}or non-GITHUB_TOKEN${{ secrets.* }}breaks silently on fork PRs, because repository variables and secrets are not exposed in that context by GitHub's security default. the token resolves to empty string, the working directory is wrong, and the final validation step looks for a file at the wrong path. one week of broken fork CI on #1306, #1331, #1339 before anyone noticed.2. marimo widget-in-gated-cell (the lab_01 incident, fixed by #1339). when an
@app.cellfunction containsmo.stop()AND definesmo.ui.*widgets that appear in its return tuple, those widgets don't exist until the gate unblocks. every cell that depends on them cascades to undefined state.what's in this PR
.github/scripts/check_workflow_fork_safety.pysecrets.GITHUB_TOKENwhich is always available..github/workflows/ci-sanity.yml.github/**changes. runs the fork-safety check so contributors without pre-commit still get caught..pre-commit-config.yamllabs/tests/test_static.pyTestMarimoDataflowclass withtest_no_widget_defined_in_gated_cell. AST-based. markedxfailbecause 32 of 33 labs currently have the pattern; a systematic refactor is separate scope. once labs are converted (seevol2/lab_05_dist_trainfor the proper pattern), remove the xfail.labs-validate-dev.yml,kits-validate-dev.yml,mlsysim-validate-dev.ymlverification
python3 .github/scripts/check_workflow_fork_safety.py— ok, scanned 47 workflows, 8 trigger on pull_request, 0 violationsmarimo check labs/vol{1,2}/*.py— clean across all 33 labs (after #1345)pytest labs/tests/test_static.py— 656 passed, 4 skipped, 33 xfailed, 1 xpassedvol2/lab_05_dist_train— it's the canonical reference for the proper patternnot in this PR
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.