-
Notifications
You must be signed in to change notification settings - Fork 345
[WIP] Rebase lessonIndex drift #4292
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
base: master
Are you sure you want to change the base?
[WIP] Rebase lessonIndex drift #4292
Conversation
|
@leslieyip02 is attempting to deploy a commit to the modsbot's projects Team on Vercel. A member of the Team first needs to authorize it. |
ee9e10a to
bf1e0e3
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #4292 +/- ##
==========================================
+ Coverage 54.52% 56.93% +2.40%
==========================================
Files 274 297 +23
Lines 6076 6959 +883
Branches 1455 1678 +223
==========================================
+ Hits 3313 3962 +649
- Misses 2763 2997 +234 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
One of the potential issue I can see with continuing to use a index based schema is that configs will not remain stable across timetable changes. I am worried that this might cause issues at the beginning of the semesters when people are most likely going to be sharing timetables with each other. If we stick with the current serialization method, and thus the current schema, we are always going to run into this problem with sharing timetables with the share link. While it is possible for us to create some kind of dialog that alerts the user that their previous config has become invalid, I think it will greatly affect the user experience if their shared link cannot automatically map lessons to the new ones when timetables are modified. Move this logic to scraper?If we choose to map lessons from the current timetable to the modified timetable, we might want to consider moving this logic into the scraper instead, and we can represent the configs entirely with a key that the scraper generates, either a uuid or a hash of the details. A problem with this approach is that it is stateful, which would make it a bit more complicated and harder to maintain. I would also prefer not to touch the API, given that it is used by other apps as well.
Still, as a sidenote, in either case we are going to have to inform users that the lessons have been modified. Custom lessonsAnother thing that I am thinking about is custom lessons, which I know is not directly related to this, but is something I am considering too, since we would probably run into the question of how to serialize custom lessons in the future. Separating serialization format and config schema?We could potentially store the config schema by serializing all of the details of each lesson, and we serialize it differently from how we represent it internally. Personally, I think this is more trouble than it's worth, and we should probably change the schema to keep it consistent with the serialization format. I realize it will be painful for us to introduce a yet another new config schema, since the previous migration caused quite a few issues, but I think it might better for us to rip the bandaid off and fix this once and for all, instead of retrofitting fixed atop of the current schema.
Personally, I would favor the partial details approach, because it makes it a lot easier for debugging and thus improve maintainability. It should be considerably smaller than serializing all lesson details, but I think there are very few instances whereby we need every single one of the details of a lesson in order to disambiguate it. My proposal is that we use the minimum partial details possible to disambiguate lessons For non-TA modules, this will be effectively be the class number, For TA modules, the simplest method is to identify each lesson with a minimum details required to separate it from other lessons SidenoteThough I guess it's also possible to further reduce serialization string length if lessons in the config don't have to be disambiguated so the above would just be `?CS1010E=TUT:(01)` but we probably want to leave this for the future, since it's just further optimizationI thought about using a fixed set of details, which will make the logic straightforward, like class number/day of week/start time, but I realize this will run into issues:
|
|
+1 on ripping off the band-aid. I don't think there's a good way to solve this without significant rewrites. While I agree partial serialization would be good, I'm not confident that we can come up with a foolproof way of disambiguating mods:
It's inelegant, but I personally feel a full serialization might be the safest way to implement this. The only downside I see is that the exported URLs would be verbose but most users probably wouldn't even notice. |
Context
Fixes #4283.
Implementation
RawLesson) because the signature lets us look up the new indexOther Information
I've written unit tests but I haven't figured out how to actually test this.