test(api): stale upload-session end-to-end acceptance — spec 070 T004 #1521

Merged
chris merged 2 commits from test/stale-upload-session-acceptance into main 2026-11-15 17:06:07 +01:00
Owner

Covers the spec 070 T004 acceptance scenario as a backend integration test instead of a live-instance script (supersedes the throwaway acceptance-t004.sh against the review instance).

One test in UploadActivityTest — clientDeathMidUploadEndsStaleAndRemainsDiscardable — mirrors the 2026-11-15 review-instance incident (session cb142fcd, battery-drained phone) end to end against real PostgreSQL (Testcontainers, existing fixture):

  1. Session created; one file through the REAL UploadReceiveService receive path → status receiving, updated_at refreshed per file (the activity-tracking touch is exercised, not assumed).
  2. Client death: fixed Clock advanced 660s (stale-timeout 10m + one 60s job tick), scheduler constructed at the later instant (established schedulerAt pattern).
  3. markStaleSessions() → DB status stale, updated_at refreshed to the job's transition instant.
  4. GET upload-activity maps it to derivedStatus stale (persisted passthrough).
  5. Cancel via the spec 049 discard path succeeds (no conflict) → cancelled.
  6. A racing commit is rejected and the terminal status is never overwritten.

Verification: :apps:api:test --tests 'dev.memories.api.upload.*' — 69 tests, 0 failures (UploadActivityTest 29/0 including the new one).

Follow-up to #1519; marks spec 070 complete (bookkeeping commit follows with this PR number).

Covers the spec 070 T004 acceptance scenario as a backend integration test instead of a live-instance script (supersedes the throwaway acceptance-t004.sh against the review instance). One test in UploadActivityTest — `clientDeathMidUploadEndsStaleAndRemainsDiscardable` — mirrors the 2026-11-15 review-instance incident (session cb142fcd, battery-drained phone) end to end against real PostgreSQL (Testcontainers, existing fixture): 1. Session created; one file through the REAL UploadReceiveService receive path → status `receiving`, updated_at refreshed per file (the activity-tracking touch is exercised, not assumed). 2. Client death: fixed Clock advanced 660s (stale-timeout 10m + one 60s job tick), scheduler constructed at the later instant (established `schedulerAt` pattern). 3. `markStaleSessions()` → DB status `stale`, updated_at refreshed to the job's transition instant. 4. GET upload-activity maps it to derivedStatus `stale` (persisted passthrough). 5. Cancel via the spec 049 discard path succeeds (no conflict) → `cancelled`. 6. A racing commit is rejected and the terminal status is never overwritten. Verification: `:apps:api:test --tests 'dev.memories.api.upload.*'` — 69 tests, 0 failures (UploadActivityTest 29/0 including the new one). Follow-up to #1519; marks spec 070 complete (bookkeeping commit follows with this PR number).
test(api): end-to-end stale acceptance for spec 070 (T004 server-side path)
All checks were successful
Wiki Sync / Sync wiki from docs (push) Has been skipped
Build and Deploy / Detect changed services and test scopes (push) Successful in 2s
Build and Deploy / Smoke API and media worker (push) Has been skipped
Build and Deploy / Smoke web (push) Has been skipped
Build and Deploy / Smoke ML worker (push) Has been skipped
Build and Deploy / Smoke people worker (push) Has been skipped
Build and Deploy / Build postgres image (push) Has been skipped
Build and Deploy / Build Android CI image (push) Has been skipped
Build and Deploy / Build plants worker image (push) Has been skipped
Build and Deploy / Build converter worker image (push) Has been skipped
Build and Deploy / Android unit tests and debug APK (push) Has been skipped
Build and Deploy / Deploy postgres (push) Has been skipped
Build and Deploy / Build API image (push) Has been skipped
Build and Deploy / Build media worker image (push) Has been skipped
Build and Deploy / Build ML worker image (push) Has been skipped
Build and Deploy / Build people worker image (push) Has been skipped
Build and Deploy / Build web image (push) Has been skipped
Build and Deploy / Deploy API (push) Has been skipped
Build and Deploy / Deploy web (push) Has been skipped
Build and Deploy / Deploy media worker (push) Has been skipped
Build and Deploy / Deploy ML worker (push) Has been skipped
Build and Deploy / Deploy plants worker (push) Has been skipped
Build and Deploy / Deploy people worker (push) Has been skipped
Build and Deploy / Deploy converter worker (push) Has been skipped
Build and Deploy / Deploy review instance (push) Has been skipped
Build and Deploy / Clean Docker build artifacts (push) Has been skipped
Build and Deploy / Run scoped PR tests (push) Successful in 7m41s
34a4565bdb
One integration test mirrors the 2026-11-15 review-instance incident:
create -> real receive path (per-file updated_at touch exercised) ->
clock advances past stale-timeout + one job tick -> scheduler persists
'stale' and refreshes updated_at -> activity feed reports derivedStatus
'stale' -> spec 049 discard still legal -> racing commit rejected.

Time advances only for the scheduler (schedulerAt pattern); the
persisted-stale deriveStatus passthrough is now-independent and the row
stays inside the 24h recent window. Supersedes the throwaway live
acceptance script against the review instance.
docs(spec): spec 070 complete — T004 via integration test
All checks were successful
Wiki Sync / Sync wiki from docs (push) Has been skipped
Build and Deploy / Detect changed services and test scopes (push) Successful in 2s
Build and Deploy / Build plants worker image (push) Has been skipped
Build and Deploy / Smoke API and media worker (push) Has been skipped
Build and Deploy / Smoke web (push) Has been skipped
Build and Deploy / Smoke ML worker (push) Has been skipped
Build and Deploy / Smoke people worker (push) Has been skipped
Build and Deploy / Build postgres image (push) Has been skipped
Build and Deploy / Build Android CI image (push) Has been skipped
Build and Deploy / Build converter worker image (push) Has been skipped
Build and Deploy / Android unit tests and debug APK (push) Has been skipped
Build and Deploy / Deploy postgres (push) Has been skipped
Build and Deploy / Build API image (push) Has been skipped
Build and Deploy / Build media worker image (push) Has been skipped
Build and Deploy / Build ML worker image (push) Has been skipped
Build and Deploy / Build people worker image (push) Has been skipped
Build and Deploy / Build web image (push) Has been skipped
Build and Deploy / Deploy API (push) Has been skipped
Build and Deploy / Deploy web (push) Has been skipped
Build and Deploy / Deploy media worker (push) Has been skipped
Build and Deploy / Deploy ML worker (push) Has been skipped
Build and Deploy / Deploy plants worker (push) Has been skipped
Build and Deploy / Deploy people worker (push) Has been skipped
Build and Deploy / Deploy converter worker (push) Has been skipped
Build and Deploy / Deploy review instance (push) Has been skipped
Build and Deploy / Clean Docker build artifacts (push) Has been skipped
Build and Deploy / Run scoped PR tests (push) Successful in 7m47s
605c9cde62
chris merged commit 69698c6ca8 into main 2026-11-15 17:06:07 +01:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
chris/memories!1521
No description provided.