Redline: past submissions list + start-new-session with 10-session retention (MMDB-2925) #29

Merged
kua-agent merged 3 commits from feat/redline-sessions-history-20261011 into main 2026-10-11 10:01:23 +00:00
Member

What

Two new functions in the Redline macOS menu-bar app, per Ben 2026-10-11.

  1. Start new session (menu row): keeps the current screenshots as a past session — the session folder moves into the one archive folder and is never deleted on close — and opens a fresh empty session. A session that was never sent keeps pdfFileName nil and is listed as "Not sent".
  2. Past submissions… (menu row): a window listing every retained session with timestamp, page count and what was sent for it (PDF name), plus actions to reveal the exact sent PDF and the session screenshot folder, and to open the sessions folder.

Retention

Ben 2026-10-11: "by default, retain the past 10 sessions. keep them in one folder."

Both archive paths (successful send and Start new session) keep the newest 10 archived session folders under ~/Library/Application Support/Shotdeck/archive/ and remove the rest. Any PDF a pruned session produced is not touched — it lives in the outbox (or the OneDrive folder) it was sent to.

Session listing/pruning order tie-breaks same-second sessions by the session folder creation date (manifest timestamps are whole-second ISO8601 by design), so retention never removes a newer session by UUID chance.

Tests

  • Tests/ShotdeckCoreTests/SessionRetentionTests.swift — 6 tests: close keeps captures as a past session (PNGs on disk, nothing deleted), empty close invents no past session, sent vs unsent distinguishable by pdfFileName, retention keeps exactly the newest 10 in one folder, explicit prune, retention on the send path.
  • Tests/ShotdeckTests/SessionWorkflowTests.swift — 3 tests driving the real AppModel menu actions through AppDelegate.makeLaunchModel().
  • swift test: 132 tests pass.
  • PanelSnapshot renders the new window as panel-06b-past-submissions.png; the rendered panels were inspected (menu rows present, sent/unsent rows correct, disabled PDF button for never-sent).

Backlog: MMDB-2925.

## What Two new functions in the Redline macOS menu-bar app, per Ben 2026-10-11. 1. **Start new session** (menu row): keeps the current screenshots as a past session — the session folder moves into the one archive folder and is never deleted on close — and opens a fresh empty session. A session that was never sent keeps `pdfFileName` nil and is listed as "Not sent". 2. **Past submissions…** (menu row): a window listing every retained session with timestamp, page count and what was sent for it (PDF name), plus actions to reveal the exact sent PDF and the session screenshot folder, and to open the sessions folder. ## Retention Ben 2026-10-11: "by default, retain the past 10 sessions. keep them in one folder." Both archive paths (successful send and Start new session) keep the newest 10 archived session folders under `~/Library/Application Support/Shotdeck/archive/` and remove the rest. Any PDF a pruned session produced is not touched — it lives in the outbox (or the OneDrive folder) it was sent to. Session listing/pruning order tie-breaks same-second sessions by the session folder creation date (manifest timestamps are whole-second ISO8601 by design), so retention never removes a newer session by UUID chance. ## Tests - `Tests/ShotdeckCoreTests/SessionRetentionTests.swift` — 6 tests: close keeps captures as a past session (PNGs on disk, nothing deleted), empty close invents no past session, sent vs unsent distinguishable by pdfFileName, retention keeps exactly the newest 10 in one folder, explicit prune, retention on the send path. - `Tests/ShotdeckTests/SessionWorkflowTests.swift` — 3 tests driving the real `AppModel` menu actions through `AppDelegate.makeLaunchModel()`. - `swift test`: 132 tests pass. - `PanelSnapshot` renders the new window as `panel-06b-past-submissions.png`; the rendered panels were inspected (menu rows present, sent/unsent rows correct, disabled PDF button for never-sent). Backlog: MMDB-2925.
kua-agent added 1 commit 2026-10-11 09:35:52 +00:00
MMDB-2925. Two new menu functions in the Redline app:

- "Start new session" keeps the current screenshots as a past session
  (moved into the single archive/ folder — never deleted on close) and
  opens a fresh empty session. Sessions closed without ever sending keep
  pdfFileName nil and show as "Not sent" in the list.
- "Past submissions…" opens a window listing every retained session
  (timestamp, page count, what was sent) with actions to reveal the sent
  PDF and the session's screenshot folder.

Retention (Ben's rule 2026-10-11: "retain the past 10 sessions"): both
archive paths (send and close) keep the newest 10 archived session
folders in archive/ and remove the rest. Any PDF a pruned session
produced is untouched — it lives in the outbox/OneDrive folder.

archivedSessions() ordering now tie-breaks same-second sessions by the
session folder's creation date, so listing and pruning are deterministic
(manifest timestamps are whole-second ISO8601 — format pinned in
AtomicFileTests).

Tests: 6 core tests in SessionRetentionTests (close/keep/reconcile,
sent-vs-unsent, retention of 10, explicit prune, send-path retention) and
3 app-target tests in SessionWorkflowTests driving the real AppModel menu
actions through AppDelegate.makeLaunchModel(). PanelSnapshot renders the
new window as panel-06b-past-submissions.png.
kua-agent added 1 commit 2026-10-11 09:48:34 +00:00
Review verdict FAIL raised 7 defects; this addresses 1-5 and 7. 6 is
accepted as-is (see below).

1. Retention failure after a COMPLETED archive no longer throws: a failed
   prune is logged loudly with the exact path and otherwise ignored, so a
   successful send can never be reported as "The screenshot could not be
   saved". The visible symptom of a failed prune is simply more than 10
   sessions listed.
2. handleDidShareItems now refreshes the current session AND the
   past-submissions list from the store on both the success and the
   failure path (previously the menu count and any open window went stale
   after every send). Any refresh problem is appended to the status line.
3. "Start new session" and send() now guard against each other
   synchronously before their first await (isStartingNewSession flag on
   both sides), instead of relying on the SwiftUI .disabled state alone —
   a queued Task could otherwise rename the session directory out from
   under an in-flight PDF compose.
4. Contract decision, documented in code: session retention prunes the
   whole session folder INCLUDING removed/ parked captures. That is the
   requested retention policy ("retain the past 10 sessions"), and the
   D-11 never-delete note on remove() now says so explicitly.
5. Session ordering tie-break chain extended: manifest createdAt, then the
   folder creation date, then the folder content-modification date, then
   the id — so retention stays on real creation order even on a volume
   that reports no creation date.
7. The PDF button's help text now distinguishes never-sent from
   sent-but-no-longer-on-disk (the button was already disabled in both).

6 (empty close leaves the old empty spool/ folder behind) is left exactly
as the pinned SpoolStoreTests contract has it (startNewSession test 16
asserts the folder remains); it is pre-existing behavior, harmless (the
store reconciles and picks the newest candidate), and out of scope here.

Tests: 2 new app-target regression tests (send refreshes past
submissions; start/send refuse to overlap) — 134 tests pass.
kua-agent added 1 commit 2026-10-11 09:58:47 +00:00
Round 2 of adversarial review confirmed defects 2,3,4,5,7 fixed and
raised three new ones; all three are fixed here, plus the guard-message
nit.

NEW-1 (the FAIL driver): the OneDrive send path overwrote the truthful
status from handleDidShareItems with its own success text, silently
dropping an archive failure and any state-refresh problem. The seam now
takes the caller's success summary and composes ONE truthful message:
summary (the share itself did complete) + archive error if any + refresh
problems if any. Both callers (AirDrop delegate, OneDrive) pass their
summary; the OneDrive text is never clobbered.

NEW-2: if the replacement open session could not be created after the
archive rename (disk full), the store kept reporting the already-archived
session as the open one. SpoolStore now has a truth guard
(ensureOpenSession): the open session is verified to really exist on disk
and be in state .open before any read/mutate; a stale one is replaced by
a genuinely fresh session, or the call fails loudly. Never a lie.

NEW-3: archivedSessions() read the folder tie-break dates AFTER
reconciliation, so a healed same-second session could bump its own
modification date and outrank a genuinely newer peer. The dates are now
read BEFORE reconciling.

Nit: the startNewSession guard now reports "A new session is already
being started." when the refusal is about a concurrent session start,
not a send.

Also added REDLINE_SELFTEST_PHASE=sendtruth (mirroring the existing
=onedrive escape hatch) so the SEND-TRUTH selftest can run without the
picker chain's display-dependent REGION-PERSIST phase.

Evidence: 136 swift tests pass (2 new: OneDrive summary survives
archiving; stale open session never returned as current).
REDLINE_SELFTEST_PHASE=sendtruth -> SEND-TRUTH PASS.
REDLINE_SELFTEST_PHASE=onedrive -> ONEDRIVE-SELFTEST PASS against the
real OneDrive sync root.
kua-agent merged commit 01252b90da into main 2026-10-11 10:01:23 +00:00
Sign in to join this conversation.
No Reviewers
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: mmd-it/shotdeck#29