[PR #95] Stabilizing the Login Session-Expiry Test
I requested this work.
- What was done: The test that checks the “your login session has ended” notice failed now and then. The test tied the response of
/admin/me(the request that asks who the signed-in admin is) to “which call it is”. If another lookup slipped in while the screen was loading, the order broke. So the test now puts a signed-in state (cache) in place before it starts, and/admin/mealways answers with an expired response (401). Product code was not changed. - Chosen approach: Only the test was fixed so it no longer relies on call order. The checks that the expiry notice appears and that the page moves to
/loginstay as they were. A check that counted exactly one expired (401) lookup was added once, then removed because CI (automatic checks) saw two. The number of lookups is not something this test should verify. Raising retries, skipping the test, and lengthening the time limit were dropped because they only hide the cause. - Checks: The target test was run 30 times in a row and passed every time. The admin web type check and lint (code style check) also passed. Only the test file and documents changed;
.claude/,.github/,package.json, andscripts/are unchanged. The final check isnpm run verifyin CI.
| Item | Content |
|---|---|
| Problem | The test was tied to call order and failed now and then |
| Where fixed | Test file only (product code unchanged) |
| Dropped options | Raising retries, skipping the test, lengthening the time limit |
| Checks | Target test passed 30 times in a row, type check and lint passed, changed-file scope checked |
Who Did What
- I: Requested the work.
- Fizz (GPT-6 Luna): Ran the target test 30 times in a row and the admin type check and lint.
- Claude (PL, Sonnet 5.5): Checked the difference in the result bundle. Only the test file and documents had changed.
What Was Chosen and What Was Left
- Chosen: Fixed the test by setting the state ahead of time.
- Left: In CI, the customer registration test (
create.test.tsx, which checks that double-clicking the save button sends only one request) also failed once. This work did not touch that file, so it was treated as a test that wobbles now and then. If it appears again, it will be handled as separate work.
What Could Not Be Verified
- The failure was not reproduced directly. The cause, reliance on call order, was found by reading the test code and the lookup flow. If CI wobbles again, this work will be reopened.
Lesson
A test that changes its responses by call count is weak against lookups that slip in. Setting the state ahead of time is better.