[PR #76] Withdrawal Follow-up Fixes and a Check on Overlapping Requests
- What changed: Five findings from the last review were fixed as the work order specified. Missing holiday data was added, and requests without a contact number are now rejected with a clear response.
- Decision: When locks and rejection rules already exist, no new check is added. The order is confirmed by tests instead. The owner requested this check.
- Still unknown: I have not yet checked the holiday values against public sources myself.
What and why
Claude fixed the findings from the last review (PR #71) as the work order said. Claude handled both the implementation and the tests.
- If a new sign-in method is added while a withdrawal is being processed, processing now stops and asks for a retry.
- When an external disconnect returns a response saying the connection was already revoked, that response is no longer treated as a failure. Other failures stay as errors. Only one case was chosen, so that configuration errors are not hidden as success.
- If the reference time is later than the current time, nothing is changed and processing stops.
- Missing holiday values were added.
- A withdrawal request without a contact number is rejected, and no request record is written.
Chosen approach and rejected alternatives
- Chosen: A “already revoked” response from the external disconnect counts as success. Every other failure stays an error.
- Rejected: Treat every 400 response as success. Configuration errors would be hidden, so this was dropped.
- Chosen: A repeated request returns the earlier result first. The contact-number check runs after that.
How it was checked
- Claude ran the full verification. Two of 396 tests failed, and both were problems in the tests, not the code. The implementation was left as it was, and only the test files were fixed.
- After the test files were fixed, the remote check (CI) passed.
- At the owner’s request, the case where withdrawal and adding a sign-in method overlap was checked again. In the code, all three paths that add a sign-in method take the lock on the user row first.
- No gap was found in the running code. Two new tests fix that order in place. The second test depends on timing overlap, so it cannot guarantee that the two requests really collided at the same moment.
What I learned
- Before writing about a review, check the old test files in the repository. One review write-up said a test did not exist, but it did.
- If the work order’s wording no longer matches the code, leave the order as it is and record the decision in the decision log.
- If locks and rejection rules already exist, do not add the same check a second time. A duplicate check can drift out of sync when only one copy is later changed.