mirror of
https://github.com/harvard-edge/cs249r_book.git
synced 2026-05-07 10:08:50 -05:00
[PR #1350] [MERGED] fix(labs): relax widget-gated-cell check to catch only multi-widget leaks #6491
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/1350
Author: @profvjreddi
Created: 4/16/2026
Status: ✅ Merged
Merged: 4/16/2026
Merged by: @profvjreddi
Base:
dev← Head:fix/widget-gated-test-strictness📝 Commits (1)
888ef19fix(labs): relax widget-gated-cell check to only catch multi-widget leaks📊 Changes
1 file changed (+76 additions, -31 deletions)
View changed files
📝
labs/tests/test_static.py(+76 -31)📄 Description
corrects a mistake in #1346's
test_no_widget_defined_in_gated_cell. the check was over-strict and flagged the sequential-unlock idiom that actually works, so 32 of 33 labs were xfailed.what i got wrong
the check treated ANY widget in a gated cell's return tuple as a violation. but the sequential-unlock idiom in labs 02 through 16 looks like this:
this works: gate fires while partA is unanswered, user sees the unlock msg. once partA is answered, partB_prediction is defined and the next gated cell unblocks. test_engine.py confirms all 33 labs actually execute cleanly with this pattern (70 passed).
what the real bug was
lab_01 pre-#1339 had a gated cell defining MULTIPLE widgets:
when this cell's gate fires, THREE widgets go undefined. that cascade is what broke lab_01 visually.
changes
test_no_multi_widget_leak_in_gated_cell>=1leaked widget to>=2_KNOWN_MULTI_LEAK_LABSset pointing at [GH-ISSUE #296] Create reference labels for all sections (#1347)verification
pytest labs/tests/test_static.py— 675 passed, 18 skipped (14 grandfathered + 4 pre-existing), 1 xfailed (unrelated)related
this supersedes my abandoned attempt at a mass refactor in #1349 (closed). that attempt removed cell-level mo.stop entirely, which would have broken the sequential-unlock UX that works today.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.