Fix UC Requirements disappearing on plans with fewer than 3 Fall/Spring terms - #1214
Open
ethanransing wants to merge 2 commits into
Open
ethanransing wants to merge 2 commits into
ethanransing wants to merge 2 commits into
Conversation
…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
force-pushed
the
ethan/uc-req-senior-residence-guard
branch
from
September 13, 2026 18:56
636e155 to
ff2b801
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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_BTLLagainst a two-semester plan; fails onmain, passes here.The frontend evaluates
PlanRequirement.codefrom Mongo, so the UC doc needs to be re-seeded (npm run seed:requirementsinpackages/BtLL) for this to take effect.