-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[RFC][data-migration] selectableRequirementChoices
-> optOut
#553
Conversation
[diff-counting] Significant lines: 231. |
Visit the preview URL for this PR (updated for commit 762cdca): https://cornelldti-courseplan-dev--pr553-opt-out-data-migrati-e4k1c0sp.web.app (expires Wed, 10 Nov 2021 15:59:49 GMT) 🔥 via Firebase Hosting GitHub Action 🌎 |
This comment has been minimized.
This comment has been minimized.
cc3a137
to
51f3305
Compare
New dry-run results. I think it's correct now.
|
51f3305
to
dfbfd35
Compare
/** | ||
* The table below summerizes the type of all possible requirement-course edges before | ||
* double-counting elimination, and where they will go in the new format. | ||
* | ||
* ------------------------------------------------------------------------------------------------- | ||
* | Requirement Type | edge exists after double-counting elim | where is it in the new format | | ||
* | ---------------- | -------------------------------------- | --------------------------------- | | ||
* | selected | True | implicit (connected by default) | | ||
* | (no warning) | | | | ||
* | | | | | ||
* | selected | True | `acknowledgedCheckerWarningOptIn` | | ||
* | (has warning) | | | | ||
* | | | | | ||
* | allow double | True | implicit (connected by default) | | ||
* | counting | | | | ||
* | | | | | ||
* | not connected | False | `optOut` | | ||
* | (no warning) | | | | ||
* | | | | | ||
* | not connected | False | implicit (unconnected by default) | | ||
* | (has warning) | | | | ||
*/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it should cover everything now
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you explain where the current requirement types go in this graph? Specifically, the non-double countable courses and requirements with checker warnings?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You don't have to push this but I'm trying to understand how this graph would look:
/**
* The table below summerizes the type of all possible requirement-course edges before
* double-counting elimination, and where they will go in the new format.
*
* -------------------------------------------------------------------------------------------------
* | Requirement Type | edge exists after double-counting elim | where is it in the new format | Related Requirements |
* | ---------------- | -------------------------------------- | --------------------------------- | -------------------- |
* | selected | True | implicit (connected by default) | |
* | (no warning) | | | |
* | | | | |
* | selected | True | `acknowledgedCheckerWarningOptIn` | |
* | (has warning) | | | |
* | | | | |
* | allow double | True | implicit (connected by default) | |
* | counting | | | |
* | | | | |
* | not connected | False | `optOut` | non-double count |
* | (no warning) | | | |
* | | | | |
* | not connected | False | implicit (unconnected by default) | |
* | (has warning) | | | |
*/
const acknowledgedCheckerWarningOptIn = courseIsAPIB(course) | ||
? [] | ||
: connectedRequirementsWithDoubleCountingAccounted.filter( | ||
it => userRequirementsMap[it].checkerWarning != null | ||
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the only behavior change. I decide to do this because the old behavior that AP courses can be used to auto-fulfill requirements with checker warnings is just very wrong.
Can you explain this case to me? Why is the elective in optOut?
Actually jk let me try to answer my own question.
|
And when you say that optOut is the same as it is in the system are you referring to Ben's unused optOut code? |
How do the decisions made here affect our choice of choosing optIn or out? And if they don't affect them then why don't they? Attempt at answering my own question: |
No, I'm referring to the discussion when we first established that all user choices are modeled as opt-in/opt-out.
I intentionally mark is as deprecated. The replacement type is |
I feel we can rename |
This is still pending whether we go with default opt-in or opt-out. If we default by opt-out, there will be another kind of opt-in lol. |
dfbfd35
to
86798b9
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Honestly, I feel like I would need to look extensively through all of your previous PR's/talk with you more in person to really understand what's going on here. However, I was always very interested in the work you did on the requirement graph and wanted to take a look at what you've been working on! For now I just left some nitty suggestions/questions.
|
||
async function main() { | ||
let userEmail = process.argv[2]; | ||
if (userEmail != null) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there reason you use !=
instead of !==
here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
!= null
will check for both null
and undefined
, so it's usually used and why it's allowed by linters.
* ``` | ||
*/ | ||
const complementary = new Set(connectedRequirementsWithoutDoubleCountingAccounted); | ||
connectedRequirementsWithDoubleCountingAccounted.forEach(r => complementary.delete(r)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you change the callback for forEach
to be complementary.delete
instead of r => complementary.delete(r)
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How do the updates from #522 affect this PR? |
No change for now. The two graph approach will only be implemented after we have the design. Currently it's ok with one graph because we know existing data does not have any constraint violations. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alright I believe the logic checks out. After you address Zak's comments let's merge.
Planning to merge once the release PR is merged. |
Summary
This PR implements the data migration script that will migrate the
selectableRequirementChoices
into the new format where all the user choices are unified under the concept of override: opt-in and opt-out.We originally think everything can be categorized into opt-out and opt-in, but the running result shown above indicates that we might need 3, which I propose below:
acknowledgedCheckerWarningOptIn
is for requirements that have a checker warning. e.g. tech elective in CS. In the old flow, they are considered more like self-checks, and never picked as default choice. For example, when you add CS 4120, the following thing will happen in the old system:For the new system and the 3 category thing I proposed, the default choice would be:
which corresponds to
CS 4120
being connected toCS elective
only and not to any broad requirements. It fits the general philosophy of the new flow: during add time, we don't make complicated computation to decide eligibility, and the default choice should be safe, non-confusing.It's not only satisfying philosophically, but it's also necessary. It's important to distinguish between arbitrary opt-in and
acknowledgedCheckerWarningOptIn
, since the former is a complete escape hatch and the system knows nothing about where it should be without user intervention, the latter we do exactly know which slot it should go to (we are just unsure whether it can be safely assigned to a requirement)Test Plan
TODO
Notes
Once the data migration script is completed, it should not be run and deployed to production immediately. We need a second part of this migration project, which makes the frontend saves data to both
selectableRequirementChoices
andoptOut
while still makingselectableRequirementChoices
the source of truth, so that we can safely deploy this to prod and the prod will start consistency generating data of the new format. Then in a future deploy to prod when we are ready, we can switch to use the new format to be the source of truth.