[PR #40] Building Kakao and Apple Login Overnight and Fixing It in the Morning
- What changed: The Kakao and Apple login implementation was given to an overnight run. The morning full test had 9 failures out of 146, and the overnight check had marked six items as correct when they were not.
- Decision: The writer of the tests and the writer of the implementation were kept apart, and a read-only check step was added for the first time.
- Still unknown: Real Kakao response conversion and the 5-second limit cannot be checked with a fake client, so they must be checked on a real device.
Overnight, several agents worked in turn. In the morning, Claude Opus 5.5 ran the full test suite, checked the results, and fixed them. PR #40 is the record of building Kakao and Apple login and adding login methods.
What was done and why
- Following the order from PR #39, task 9 was handed to run overnight. Task 9 covers Kakao and Apple login, linking a social account when an invitation is accepted, and adding login methods.
- One new thing this time was a read-only review step, placed as its own stage.
- The work had four stages: build the skeleton, write the tests, implement, and review. The person or agent who wrote the tests was kept separate from the one who implemented.
What happened overnight
- The skeleton, test, and implementation stages were all reported as finished. The review stage listed six checks as “matches”.
- In the morning, the full test suite was run. Out of 146 tests, 9 failed. New tests failing in the test-only commit was expected. Failures remaining in the implementation commit were not.
What the morning check found and fixed
- One-time use of link tickets was silently broken. The SQL statement that consumes a link ticket was read in the wrong shape. The library returns
[rows, row count], not a plain list of rows. An empty result still looked like a valid array, so a ticket that had already been used was not rejected. Fix: read only the rows from the result. - The guard on the add-login-method route did not match the plan. The plan’s API table allowed only a code ticket on this route, but the implementation required a login pass. Someone who had not yet logged in could never reach the route. Fix: remove the pass requirement, and find the user from the user ID inside the code.
- After the fixes,
npm run verifypassed: 16 files, 146 tests.
Options considered
- The bugs were fixed on this machine instead of sent back to the overnight run. The fixes touched three files and a few lines. The cause was already confirmed from the error log. Sending it back would have taken another night, and the overnight setup has no database, so the same kind of failure could go unseen again.
- The controller lives in the social-login folder and imports the auth module. The two modules do not import each other, so there is no circular dependency.
- The Apple token rejection code follows the plan’s wording. The other test lines describe the same kind of case, so the choice was judged correct.
How it was checked
- Tests written without an implementation were confirmed to fail, for the expected reasons: not implemented yet, or the route missing.
- The final commit was checked to pass
npm run verify. - The plan’s test lines and the lines the order added were matched one to one. This covers the Apple token audience check, the Kakao app ID check, and the 503 on a failed Apple code exchange.
- The code was checked for skipped tests and for tokens leaking into logs or responses.
Not yet checked
- The real Kakao response codes and the 5-second limit cannot be checked with fake clients. A real-device check is still needed.
- If the Apple key download fails with a network error rather than a timeout, the response is 401, not 503. Whether this happens in practice has not been checked.
Lessons
- The biggest weakness of overnight work is that database tests cannot run in the sandbox. This time the tests caught both failures exactly, but they ran in the morning.
- A read-only review cannot tell what a library actually returns. A check that only looks at the shape of the code will pass a wrong result.
- The next order should include two things: a check that each new route’s guard matches the plan’s API table, and a rule that database updates must use a form whose result shape is clear.