Code RoomEnum renumbering breaks clients
HardPrep Room Coding #1772

Enum renumbering breaks clients

Code reviewCode quality & reviewSenior–Staff~25 min

Review this Go enum-serialization change in a public API response.

What a strong answer looks like

Separate real bugs from style. Rank issues by severity, point at the root cause rather than the symptom, and suggest a concrete fix, specific and kind.

0:00 of about 25 min
Mark a line and say what kind of problem it is.0 findings
1type Status int
2 
3const (
4 Pending Status = iota // 0
5 Active // 1
6 Suspended // 2
7)
8 
9func (s Status) MarshalJSON() ([]byte, error) {
10 return json.Marshal(int(s)) // ships status as a number
11}
12 
13// New requirement: insert "Trialing" between Pending and Active
14const (
15 Pending Status = iota // 0
16 Trialing // 1 <-- inserted
17 Active // 2
18 Suspended // 3
19)
Which questions mattered is sealed until you submit. Telling you now would just be handing over the edge cases.