Skip to content

Bug Postmortems

Eric Pedley edited this page Dec 1, 2022 · 1 revision

11/30/2022

The bug report

There was an issue that changed one of my Fall quarter classes to the Winter Quarter. I had taken ENGR 1A in Fall 2022, but upon opening the AntAlmanac, the class is gone from my Fall schedule and comes up in the Winter Schedule, which I was making tentatively. Also, when I delete that class from the schedule, it deletes some of the other classes, like ENGR 7B. I do the changes necessary and save but upon opening it every time, the changes are not there.

Diagnosis attempts

I first tried reproducing the bug in prod, where I did indeed find that deleting one course also deleted other ones. I looked at our table in MongoDB and found that the two classes had identical section codes. After that, I looked at our delete function and found the problem. I spent a while trying to reproduce locally since it was failing to fetch the schedule, and eventually I just realized that I was on the experimental TS build and it was broken because of a bug with that build, and it worked on main. To reproduce locally, I just copied the user record from our prod db to our dev db on the MongoDB Atlas console.

The root cause

image

This line stores the info for each section code. The problem is that section codes aren't unique across multiple terms. This particular bug came from Fall 22 ENGR 1A and Winter 23 ENGR 7B having the same section code. The easy fix was making this object key include both the section key and the term, like this: image