[PR #1385] [MERGED] fix(labs/vol1): restore slider/dropdown dataflow in lab_02 + lab_03 (#1332) #9060

Closed
opened 2026-05-03 01:17:28 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/harvard-edge/cs249r_book/pull/1385
Author: @profvjreddi
Created: 4/17/2026
Status: Merged
Merged: 4/17/2026
Merged by: @profvjreddi

Base: devHead: fix/labs-1332-sweep


📝 Commits (1)

  • 9d5c153 fix(labs/vol1): restore slider/dropdown dataflow in lab_02 + lab_03 (#1332)

📊 Changes

2 files changed (+107 additions, -37 deletions)

View changed files

📝 labs/vol1/lab_02_ml_systems.py (+68 -26)
📝 labs/vol1/lab_03_ml_workflow.py (+39 -11)

📄 Description

what

lab_02 and lab_03 in vol1 had a widespread marimo dataflow bug: widget cells defined secondary widgets (sliders, dropdowns, the Part C PM-allocation dict in lab_03) alongside the next part's prediction radio but only returned the prediction. marimo's static dataflow therefore never wired those widgets into the tabs cell, so every lever downstream of a prediction lock was missing once the student answered.

@asgalon flagged this in #1332 as "missing prediction choices" and "Part C chart stuck, does not move when changing items."

fix: split widget defs into one cell per part, each returning every widget it owns; update tabs cell signature to receive them all.

lab_02 additional fixes

  1. Part A radio label used ''$15K / $30K'' as literal dollar signs. pandoc/markdown interprets ''$...$'' as inline math and italicises. switched the label to an ''r"..."'' raw string with backslash-escaped dollars so the student sees ''$15K / $30K'' as currency.
  2. Part A feedback callout said ''The speedup at AI=5 is only ~{_speedup:.2f}x'' but ''_speedup'' was computed at the current slider value (1-400 range, default 5). moved students who slid to AI=200 away from ''AI=5'' now saw an AI=200 speedup under an ''at AI=5'' caption. added ''_speedup_at_5'' computed at the anchored question point; feedback references it instead.
  3. Part D ''data_size'' slider and ''wireless'' dropdown were defined inside the tabs cell's body but not in its parameter list, so they never reached downstream cells (@asgalon: ''move them one cell up''). pulled into their own widget cell.

lab_03 specifics

  • Part A ''stage'' slider, Part B ''cycle_a/cycle_b'' sliders, Part C ''pm-allocation'' dict of 5 sliders, Part D ''months'' slider all moved to one-cell-per-part structure with proper returns. that closes Peter's ''chart stuck'' observation since the tabs cell now re-runs when any of the 5 PM sliders changes.

test plan

  • pytest labs/tests/test_static.py + tests/test_engine.py -> 792 passed 4 skipped 1 xfailed
  • marimo check vol1/lab_02_ml_systems.py -> exit 0
  • marimo check vol1/lab_03_ml_workflow.py -> exit 0
  • browser smoke (labs/tests/browser_smoke.py) against both exported labs -> 0 captured errors
  • manual playwright click-through: after picking prediction on Part A, ''marimo-slider'' count goes 0 -> 2 in the DOM (confirming the partA_ai slider reaches the rendered tab)
  • ci green on this pr

addresses #1332 (partial; covers lab_02 + lab_03, leaves the ''1.1x vs 1.64x example values'' suggestion and later-lab items for follow-ups)


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/harvard-edge/cs249r_book/pull/1385 **Author:** [@profvjreddi](https://github.com/profvjreddi) **Created:** 4/17/2026 **Status:** ✅ Merged **Merged:** 4/17/2026 **Merged by:** [@profvjreddi](https://github.com/profvjreddi) **Base:** `dev` ← **Head:** `fix/labs-1332-sweep` --- ### 📝 Commits (1) - [`9d5c153`](https://github.com/harvard-edge/cs249r_book/commit/9d5c153be4e7f26a184447f300b0e9c7c52fbf64) fix(labs/vol1): restore slider/dropdown dataflow in lab_02 + lab_03 (#1332) ### 📊 Changes **2 files changed** (+107 additions, -37 deletions) <details> <summary>View changed files</summary> 📝 `labs/vol1/lab_02_ml_systems.py` (+68 -26) 📝 `labs/vol1/lab_03_ml_workflow.py` (+39 -11) </details> ### 📄 Description ## what lab_02 and lab_03 in vol1 had a widespread marimo dataflow bug: widget cells defined secondary widgets (sliders, dropdowns, the Part C PM-allocation dict in lab_03) alongside the next part's prediction radio but only returned the prediction. marimo's static dataflow therefore never wired those widgets into the tabs cell, so every lever downstream of a prediction lock was missing once the student answered. @asgalon flagged this in #1332 as "missing prediction choices" and "Part C chart stuck, does not move when changing items." fix: split widget defs into one cell per part, each returning every widget it owns; update tabs cell signature to receive them all. ## lab_02 additional fixes 1. Part A radio label used ''\$15K / \$30K'' as literal dollar signs. pandoc/markdown interprets ''\$...\$'' as inline math and italicises. switched the label to an ''r"..."'' raw string with backslash-escaped dollars so the student sees ''\$15K / \$30K'' as currency. 2. Part A feedback callout said ''The speedup at AI=5 is only ~{_speedup:.2f}x'' but ''_speedup'' was computed at the current slider value (1-400 range, default 5). moved students who slid to AI=200 away from ''AI=5'' now saw an AI=200 speedup under an ''at AI=5'' caption. added ''_speedup_at_5'' computed at the anchored question point; feedback references it instead. 3. Part D ''data_size'' slider and ''wireless'' dropdown were defined inside the tabs cell's body but not in its parameter list, so they never reached downstream cells (@asgalon: ''move them one cell up''). pulled into their own widget cell. ## lab_03 specifics - Part A ''stage'' slider, Part B ''cycle_a/cycle_b'' sliders, Part C ''pm-allocation'' dict of 5 sliders, Part D ''months'' slider all moved to one-cell-per-part structure with proper returns. that closes Peter's ''chart stuck'' observation since the tabs cell now re-runs when any of the 5 PM sliders changes. ## test plan - [x] pytest labs/tests/test_static.py + tests/test_engine.py -> 792 passed 4 skipped 1 xfailed - [x] marimo check vol1/lab_02_ml_systems.py -> exit 0 - [x] marimo check vol1/lab_03_ml_workflow.py -> exit 0 - [x] browser smoke (labs/tests/browser_smoke.py) against both exported labs -> 0 captured errors - [x] manual playwright click-through: after picking prediction on Part A, ''marimo-slider'' count goes 0 -> 2 in the DOM (confirming the partA_ai slider reaches the rendered tab) - [ ] ci green on this pr addresses #1332 (partial; covers lab_02 + lab_03, leaves the ''1.1x vs 1.64x example values'' suggestion and later-lab items for follow-ups) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-05-03 01:17:28 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/cs249r_book#9060