Eight linked review decisions
Core time: about 4 minutes to compare your four strongest findings. Studying every detail is optional and adds about 6 minutes.
These are linked decisions, not isolated style comments. The contract sets the standard; boundary controls protect entry; database controls protect invariants; and tests make the claims repeatable.
| Finding | Requirement | Classification | Control and evidence requested |
|---|---|---|---|
| Response contract is not implemented | R5 | Blocking | Return each required status and test every branch. |
| Authorization gate is absent | R1 | Blocking; security-relevant | Use the standard route guard and prove unauthorized callers receive 403. |
| Invalid input can fail unpredictably | R2, R5 | Blocking | Control JSON parsing, validate required email, return 400, and test failures. |
| Log exposes email and authorization header | R6 | Blocking; security-relevant | Remove token logging, minimize identifying data, and verify secret absence. |
| String-built SQL creates an injection path | R2, R4 | Blocking; security-relevant | Use parameterized access and test hostile-looking input as data. |
| Capacity is off by one and not atomic | R3 | Blocking | Protect check and write as one authoritative operation; test simultaneous requests. |
| Duplicate prevention has the same race | R4, R5 | Blocking | Enforce a database uniqueness constraint and map conflicts to 409. |
| Test does not establish requirements | R7 and R1–R6 | Blocking before merge | Add a requirement-linked test set covering rejection, concurrency, response, and logging behavior. |
Why each decision is defensible
1 — Response contract
The function always returns 200 and {"ok": True}, even when no registration is created. Exact interface outcomes are correctness, not polish.
2 — Authorization
No visible check establishes authentication or the coordinator role. Do not assume another layer provides the control unless the pull request links to evidence.
3 — Input validation
request.get_json() may return no object, and data["email"] assumes a present, valid field. Validate before logging or building any data operation.
4 — Sensitive logging
The log records a full email and the authorization header, which may contain a bearer token. Never repeat a real secret in a review comment, ticket, or screenshot.
5 — Query safety
The email is interpolated into both statements. Validation and parameterization solve different problems; validation alone is not the injection control.
6 — Capacity
<= permits one extra registration when count equals capacity. Even with <, two requests can both observe one remaining place unless the database protects the invariant.
7 — Duplicate registration
A check followed by an insert can race. An authoritative uniqueness constraint protects the invariant regardless of request timing.
8 — Test evidence
The single happy-path test expects the wrong status and proves none of the required rejection or concurrency behavior. Approval needs evidence tied to each material requirement.
Scope statement: These decisions apply to the supplied excerpt. They do not claim that unseen application code is safe or unsafe.