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.
This commit is contained in:
@@ -2,7 +2,7 @@ import Foundation
|
||||
|
||||
public enum SessionState: String, Codable, Sendable {
|
||||
case open // accepting captures
|
||||
case archived // its PDF has been built and sent; kept forever, never deleted
|
||||
case archived // closed and kept as a past session (sent or not); pruned by retention
|
||||
}
|
||||
|
||||
/// The manifest persisted as session.json alongside the PNGs.
|
||||
@@ -11,7 +11,9 @@ public struct CaptureSession: Codable, Sendable, Identifiable, Equatable {
|
||||
public let createdAt: Date
|
||||
public private(set) var state: SessionState
|
||||
public private(set) var captures: [Capture]
|
||||
/// Set when the PDF is built, so a re-send reuses the same file.
|
||||
/// Set when the PDF is built, so a re-send reuses the same file. nil on a
|
||||
/// session that was closed without ever sending — the Past submissions list
|
||||
/// shows that as "Not sent".
|
||||
public private(set) var pdfFileName: String?
|
||||
|
||||
public init(
|
||||
@@ -61,7 +63,8 @@ public struct CaptureSession: Codable, Sendable, Identifiable, Equatable {
|
||||
}
|
||||
|
||||
/// Value-semantic: returns a new session; does not mutate `self`.
|
||||
public func markArchived(pdfFileName: String) -> CaptureSession {
|
||||
/// `pdfFileName` is nil when the session is closed without ever sending.
|
||||
public func markArchived(pdfFileName: String?) -> CaptureSession {
|
||||
CaptureSession(
|
||||
id: id,
|
||||
createdAt: createdAt,
|
||||
|
||||
Reference in New Issue
Block a user