mirror of
https://github.com/harvard-edge/cs249r_book.git
synced 2026-05-07 10:08:50 -05:00
[PR #1351] [MERGED] refactor(labs/lab_06): migrate fault-tolerance lab to Pattern C (proof lab) #9044
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/1351
Author: @profvjreddi
Created: 4/16/2026
Status: ✅ Merged
Merged: 4/16/2026
Merged by: @profvjreddi
Base:
dev← Head:refactor/lab06-pattern-c📝 Commits (1)
3470afdrefactor(labs/lab_06): migrate to Pattern C widget-cell pattern📊 Changes
1 file changed (+4 additions, -14 deletions)
View changed files
📝
labs/vol2/lab_06_fault_tolerance.py(+4 -14)📄 Description
first of 14 labs to migrate per #1347. this is the proof-of-pattern PR; once CI validates and you sign off, the remaining 13 can follow the same template (or be batched).
bug fixed
two experts independently flagged a dangling
mo.stop(partA_prediction.value is None, ...)in the LEDGER_HUD cell at the bottom of this lab. the message "Make your prediction above to unlock this part" has no sensible referent at the bottom of the page, and the HUD's own logic (_a1_ok = partA_prediction.value == "C") already handles None-value correctly. this PR removes it.the pattern
applies the canonical pattern from
vol2/lab_05_dist_train(the only lab that currently XPASSes the widget-gated-cell check). widget cells become pure widget definitions; gating lives insidebuild_part_X()functions viaif partX_prediction.value is None: items.append(mo.callout(...)); return. the internal gates were already written in lab_06 (lines 413, 652, etc.) — the cell-levelmo.stopcalls were redundant gating on top.what changes for the student
before: tabs don't render until student answers predictions A → B → C → D in sequence (cell-level gates cascade).
after: all 5 tabs (A, B, C, D, Synthesis) render immediately on load. each tab still shows its own unlock message until that part's prediction is answered. synthesis tab is accessible at any time as an advance organizer, matching the TEMPLATE intent.
5 mo.stop calls removed
cell signatures simplified where the gate dep was only used in the removed
mo.stop.verification
marimo check— cleanpytest labs/tests/test_engine.py -k lab_06_fault— 2/2 passed (cells execute, produce outputs)pytest labs/tests/test_static.py -k lab_06_fault— 20 passed;test_no_widget_defined_in_gated_cellXPASSED (lab no longer has the pattern)app.run()— 12 cell outputs, 49 definitions, all 18 expected widgets + tabs cell definedmarimo export html-wasm— valid HTML producednet diff
4 insertions(+), 14 deletions(-)— small and mechanical.related
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.