test(api): pin the resume-rewind contract
Release / build-and-push (push) Successful in 3m2s

TestAudioResumeRewind drives the whole surface against the shared dev
DB with the fresh per-test regular user (the live admin is never
touched; the fixture book lives in a test-named library that cascades
away): default 0, profile PUT "5" rides the chapters payload,
non-allow-listed values 400 without side effects, explicit "0"
resets everywhere, and an omitted JSON key leaves the column
untouched.

Changelog entry in docs/contract_pins.md (additive chapters key +
the profile field's string-shaped PUT, keep_screen_awake precedent)
and the get_profile.md example gains the preference keys.

Debug note for the next agent: the first runs here 401'd with
'Ghost session rejected' — NOT a harness or auth bug. The tests never
execute schema.sql; the shared dev DB gets its schema from the app
container's boot. The rebuilt tests image ran the new GetUser
(selecting audio_resume_rewind_seconds) against a DB whose schema
came from the old app image — every GetUser errored, and the
ghost-session guard turned that into 401s. Applying the schema.sql
ALTER to the dev DB (what the next app rebuild does anyway) turned
the suite green. Until make rebuild-app runs, the running app
container serves the old binary.
This commit is contained in:
John O'Keefe committed 2026-11-01 19:38:08 -05:00
1 parent 7b7ce39826
commit ef827a3a05
3 files changed
+142

No files matched your search

+17
View File
@@ -720,3 +720,20 @@ the briefing acceptance now starts from the page's FIRST card (feed
position 5 — the born-reversed default's book order) and chains into
feed position 1. The acceptance meaning is unchanged: play from what
you see, chained back-to-back within the live briefing set.
## 2026-11-01 — audio resume rewind setting
- `GET /api/media-items/:id/chapters` gained one ADDITIVE response key:
`resume_rewind_seconds` (int, the requesting user's setting; 0 for
anonymous). Existing keys unchanged. The web player and the Android
app both gate the value through the 0/5/10 allow-list, so servers
without the key (absent → 0) degrade to exact resume.
- `GET /api/auth/profile` now always carries
`audio_resume_rewind_seconds` (int, never omitted — 0 is a real
value, exact resume). `PUT /api/auth/profile` accepts the key as the
keep_screen_awake-style STRING ("0"/"5"/"10") so the profile form's
select can send an explicit Off; JSON clients that omit it leave the
column untouched, and anything outside {0,5,10} is 400.
Pinned (TestAudioResumeRewind): default 0, PUT "5" rides the
chapters payload, non-allow-listed rejections change nothing,
explicit "0" resets everywhere, omitted key leaves it untouched.
+2
View File
@@ -36,6 +36,8 @@ Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...
"first_name": "John",
"last_name": "Doe",
"role": "user",
"default_audio_speed": 1.5,
"audio_resume_rewind_seconds": 5,
"keep_screen_awake": true
}
```