Code RoomAllowlist lookup linear search
MediumPrep Room Coding #1917

Allowlist lookup linear search

Code reviewCode quality & reviewMid–Senior~18 min

Review this Python function that filters incoming events to those whose user is on an allowlist. The allowlist is loaded from config and can hold tens of thousands of ids.

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 18 min
Mark a line and say what kind of problem it is.0 findings
1def filter_allowed(events, allowlist):
2 # allowlist is a list of user_ids loaded from config
3 allowed = []
4 for e in events:
5 if e.user_id in allowlist:
6 allowed.append(e)
7 return allowed
Which questions mattered is sealed until you submit. Telling you now would just be handing over the edge cases.