T14.2 (D27): the offline sign-in window follows the server

/api/auth/me returns session_expires_at (the session token exp, UTC). The browser
keeps it and never extends it: the fixed 12 hours and the sliding reset are gone.
Offline before that time the app opens as normal. Offline after it the app opens in
read-and-queue mode: no redirect, one mode line, changes are queued and held until
a page load gets a good answer from the server. wpCacheAuth refreshes the cached
user without moving the end time.

D26 and D27 recorded as Accepted. tests/session_expiry_check.py (22 checks) fails
against the old 12 hour rule.
This commit is contained in:
2026-10-17 14:18:53 -07:00
parent 73f0b5e69d
commit 40827d5371
7 changed files with 314 additions and 29 deletions

View File

@@ -1,8 +1,13 @@
# Decisions: October 17, 2026
Status key: **Proposed** means the text is a recommendation. It needs Matt's OK before any build starts.
**Accepted** means Matt approved it and the work may start.
## D26: a sign-in problem never destroys a queued change (Proposed)
Matt accepted D26 and D27 as written on 2026-10-17 (open questions 1, 2 and 3 in `wave-14.md`: hold the changes of
another person, the offline window ends with the session and then works in read-and-queue mode, and a full device
keeps the change in memory and tells the person). The idle time (question 4) was not decided. It belongs to `T13.1`.
## D26: a sign-in problem never destroys a queued change (Accepted)
**Why:** The outbox (`html/project-data.js`) marks any `4xx` answer except `429` as dead. A `401` means the session ended, and it
gets the same treatment. With a session limit (D25, 8 hours) or an idle timeout (T13.1), a crew that works offline past the limit
@@ -18,7 +23,7 @@ change under whoever is signed in, not under the person who made it.
**Tasks:** `T14.1`, `T14.3`. **Needs Matt:** open questions 1 and 3 in `wave-14.md`.
## D27: the offline sign-in window follows the server (Proposed)
## D27: the offline sign-in window follows the server (Accepted)
**Why:** `auth-guard.js` allows the app to open offline for a fixed 12 hours after the last good check, and every page load resets that
time. The server session lasts 8 hours (D25). The two do not agree.

View File

@@ -2,7 +2,7 @@
**Items:** `D26`, `D27`, `BL-061` (`B5` is context only: its wording rules stay, and this wave does not widen it)
**Depends on:** wave 13 merged (it is, except T13.1). Independent of wave 15.
**Decision record:** `docs/waves/decisions-2026-10-17.md` (D26 and D27 are **proposed**; they need Matt's OK, see "Open questions")
**Decision record:** `docs/waves/decisions-2026-10-17.md` (D26 and D27 are **accepted** as of 2026-10-17, see "Open questions")
**Unblocks:** `T13.1` (idle timeout). T13.1 must not reach `main` before T14.1 and T14.2 are done.
**Branch rule:** one task for each pull request. Cut each branch from `main`.
@@ -63,13 +63,15 @@ badge is a `div` with `pointer-events:none`. A badge that must ask a person to s
**Done when:**
- [ ] a queue of N changes meets a `401`: all N are still in the queue, none is dead, `tries` did not change, and the badge state is "held"
- [ ] after a good sign-in, all N changes reach the server in their original order, and the queue is empty
- [ ] a `403` marks only that change dead, with a reason that names the cause
- [ ] a full device store (a forced `QuotaExceededError`) is reported to the caller and the badge. No change disappears silently
- [ ] a change queued by person A is not sent when person B is signed in; it is sent after A signs in
- [ ] `tests/outbox_check.py` covers each case above and fails when `flush()` is put back to the old rule (a mutation check)
- [ ] the full suite passes, at 390 px and 1440 px
- [x] a queue of N changes meets a `401`: all N are still in the queue, none is dead, `tries` did not change, and the badge state is "held"
- [x] after a good sign-in, all N changes reach the server in their original order, and the queue is empty
- [x] a `403` marks only that change dead, with a reason that names the cause
- [x] a full device store (a forced `QuotaExceededError`) is reported to the caller and the badge. No change disappears silently
- [x] a change queued by person A is not sent when person B is signed in; it is sent after A signs in
- [x] `tests/outbox_check.py` covers each case above and fails when `flush()` is put back to the old rule (a mutation check)
- [x] the full suite passes (2026-10-17: 52 of 54 checks pass; the 2 others are `generalinfo_check` and `token_check`, known and not regressions). `mobile_check` covers 390 px. No before and after screenshots were taken: the badge looks the same until T14.3. The badge words for the new states are plain text. T14.3 gives them their final wording and the Sign in control.
**Built (2026-10-17):** commit `73f0b5e`. Open question 1 as accepted: another person's changes are held and the badge names the owner. A change queued before the sign-in check finished has no owner and can be sent by anyone, as before.
---
@@ -99,12 +101,14 @@ badge is a `div` with `pointer-events:none`. A badge that must ask a person to s
**Done when:**
- [ ] `/api/auth/me` returns `session_expires_at`, and it matches the token (`tests/` check, no database change)
- [ ] the fixed 12 hours is gone from `auth-guard.js`
- [ ] opening the app offline before the time works; opening it offline after the time gives read-and-queue mode and does not redirect
- [ ] online with a dead session: redirect to `login.html?next=...`, queue kept, changes sent after sign-in
- [ ] a page load does not extend the cached window
- [ ] the mode line is announced by a screen reader (`aria-live`) and fits at 390 px
- [x] `/api/auth/me` returns `session_expires_at`, and it matches the token (`tests/session_expiry_check.py`, no database change)
- [x] the fixed 12 hours is gone from `auth-guard.js`
- [x] opening the app offline before the time works; opening it offline after the time gives read-and-queue mode and does not redirect
- [x] online with a dead session: redirect to `login.html?next=...`, queue kept, changes sent after sign-in (the send after sign-in is the T14.1 test, section 3)
- [x] a page load does not extend the cached window
- [ ] the mode line is announced by a screen reader (`aria-live`) and fits at 390 px. The line is in the badge, which has `role="status"` (checked). It is **not** checked at 390 px or with a real screen reader. Do this in T14.3, which rebuilds the badge.
**Built (2026-10-17):** `tests/session_expiry_check.py` (22 checks) fails when the old 12 hour rule is put back (7 failures). The mode line shows only in read-and-queue mode, not when the app opens offline before the session ends, because "sign in again" would be wrong while the session is still good. In read-and-queue mode the outbox does not send at all until a page load gets a good answer from the server. Saving display preferences refreshes the cached user and keeps the end time (`wpCacheAuth`).
---
@@ -160,7 +164,9 @@ T13.1 (`6cde6e3`) onto `main`, run `tests/session_idle_check.py` and the same ha
---
## Open questions (needs Matt before T14.1 and T14.2 start)
## Open questions
**Answered 2026-10-17 (Matt accepted the proposal for questions 1, 2 and 3).** Question 4 is still open and belongs to `T13.1`.
1. **Shared devices.** If person B signs in on a device that holds unsent changes from person A, what must happen?
Proposed: hold A's changes, name A in the badge, send them when A signs in. Do not send them as B and do not discard them.