Skip to content

Fix UC Requirements disappearing on plans with fewer than 3 Fall/Spring terms - #1214

Open
ethanransing wants to merge 2 commits into
mainfrom
ethan/uc-req-senior-residence-guard
Open

ethanransing wants to merge 2 commits into
mainfrom
ethan/uc-req-senior-residence-guard

Conversation

@ethanransing

@ethanransing ethanransing commented Sep 13, 2026

Copy link
Copy Markdown
Contributor

Before #1173 this threw and made all course requirements vanish. After #1173, only the UC Requirements group vanished. The root cause is an indexing error, since we get the columns with get_element(only_spring_fall, length - 3), which breaks when the course plan only has 1-2 semesters. However this is in an if/else block that shouldn't be evaluated with 1-2 course semesters.

The root cause is that BtLL evaluates both blocks in if/else statements, rather than lazily like every other language. We need to evaluate only the block that will run to make get_element for this application safe.

Added unit tests that verify that we don't evaluate something that would throw in if/else and elseif blocks. Also added a BtLL test that runs UC_REQ_BTLL against a two-semester plan; fails on main, passes here.

The frontend evaluates PlanRequirement.code from Mongo, so the UC doc needs to be re-seeded (npm run seed:requirements in packages/BtLL) for this to take effect.

…ring terms

The Senior Residence block picked the 3rd-from-last Fall/Spring column as
the divider via get_element with a negative index, which yields an undefined
Column. findIndex then called get_attr on it and threw, taking the whole UC
Requirements group down with it (and, before #1173, the entire panel).

There was no way to guard this in BtLL because if_else evaluated both
branches. Make if_else and elseifs evaluate only the taken branch, then move
the divider lookup into a helper that the UC program only calls when there
are at least 3 Fall/Spring terms; otherwise the whole plan is senior year.

Add BtLL tests for branch laziness and for the UC program on a two-semester
plan.
@ethanransing
ethanransing force-pushed the ethan/uc-req-senior-residence-guard branch from 636e155 to ff2b801 Compare September 13, 2026 18:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant