Commit Graph
5 Commits
Author SHA1 Message Date
Claude Fable 5 02fa791b78 feat(sessions): keep every session, record review details, name and stamp the PDF
Sessions are now the unit of the product instead of an implicit capture run.

- Nothing is deleted by default: the fixed 10-session cap is gone. An age limit
  (Never / 7 / 14 / 30 / 90 / 180 / 365 days) is chosen in Settings > Sessions and
  applied on launch, after archiving, and by "Clean up now". Sent PDFs are never
  touched.
- Each session carries review details: lane, deployed version, commit, reviewer
  (pre-filled with the Mac user) and a free note. They persist in session.json and
  are inherited by the next session, so a review run is typed once.
- PDF file names are Redline-<yyyyMMdd-HHmm>-<LANE>-<SHORTID>.pdf, and every page
  carries a two-line reference footer (tool, build time, session / lane, deployed
  build, commit, reviewer, note). The PDF document info carries the same values in
  Author and Keywords.
- Verification: 159 tests, a headless panel self-test, and a LaunchServices-driven
  end-to-end run that types and clicks the real panel.
2026-10-31 11:32:54 +04:00
Claude Fable 5 0506ce04e9 fix(sessions): re-review fixes for MMDB-2925 (PR #29 review round 2)
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.
2026-10-11 13:58:45 +04:00
Claude Fable 5 eaa5bd5884 fix(sessions): adversarial-review fixes for MMDB-2925 (PR #29 review round 1)
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.
2026-10-11 13:48:31 +04:00
Claude Fable 5 6ab398c3f2 feat(sessions): past submissions list + start-new-session with 10-session retention
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.
2026-10-11 13:35:38 +04:00
kua-agent 4c4d3d6633 WP-1: durable SpoolStore with crash reconciliation and removed/ per SPEC-A1a 2026-08-31 14:58:03 +04:00