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.
This commit is contained in:
@@ -85,9 +85,20 @@ enum PanelSnapshot {
|
||||
try render(
|
||||
PastSubmissionsView().environment(model),
|
||||
to: directory.appendingPathComponent("panel-06b-past-submissions.png"),
|
||||
width: 440
|
||||
width: 480
|
||||
)
|
||||
|
||||
// 15 — the session details editor open, on the same real model: lane, deployed
|
||||
// build, commit, reviewer and note are the values panel 04's session carries.
|
||||
try render(
|
||||
MenuBarView(showsContextEditor: true).environment(model),
|
||||
to: directory.appendingPathComponent("panel-15-session-details.png")
|
||||
)
|
||||
|
||||
// A real PDF built by the production composer, so the reference footer and the
|
||||
// document info can be inspected (and opened) rather than assumed.
|
||||
try writeSamplePDF(to: directory.appendingPathComponent("sample-review.pdf"), model: model)
|
||||
|
||||
// 07/08/09 — OneDrive-mode Settings + menu bar, on a SEPARATE isolated model so
|
||||
// this transport switch never bleeds into the AirDrop-mode panels above.
|
||||
try await captureOneDrivePanels(to: directory)
|
||||
@@ -210,7 +221,12 @@ enum PanelSnapshot {
|
||||
_ = try await model.spool.append(
|
||||
pngData: try makePNGData(width: 192, height: 108, red: 0.25, green: 0.7, blue: 0.6),
|
||||
pixelWidth: 192, pixelHeight: 108, scale: 2.0, capturedAt: Date())
|
||||
let sentName = "Redline-\(DubaiTime.fileStamp(Date())).pdf"
|
||||
let sentSession = try await model.spool.setContext(
|
||||
ReviewContext(
|
||||
lane: "DEV03", deployedVersion: "v1.4.2 (41)", commit: "a1b2c3d4",
|
||||
reviewer: "Ben Hippler", note: "checkout flow"))
|
||||
let sentName = PDFFileName.make(
|
||||
builtAt: Date(), lane: sentSession.context.lane, sessionID: sentSession.id)
|
||||
_ = try await model.spool.archiveCurrent(pdfFileName: sentName)
|
||||
// The real send writes the PDF to the outbox; the fixture does the same so the
|
||||
// row's PDF action is genuinely live in the snapshot.
|
||||
@@ -220,7 +236,37 @@ enum PanelSnapshot {
|
||||
_ = try await model.spool.append(
|
||||
pngData: try makePNGData(width: 160, height: 90, red: 0.9, green: 0.55, blue: 0.2),
|
||||
pixelWidth: 160, pixelHeight: 90, scale: 2.0, capturedAt: Date())
|
||||
_ = try await model.spool.setContext(
|
||||
ReviewContext(
|
||||
lane: "OMS test lane", deployedVersion: "v2.0.0-rc3", commit: "9f3e2d1",
|
||||
reviewer: "Ben Hippler"))
|
||||
_ = try await model.spool.closeCurrentSession()
|
||||
|
||||
// The live session shown in panels 03/04/05/15 carries details too.
|
||||
_ = try await model.spool.setContext(
|
||||
ReviewContext(
|
||||
lane: "DEV03", deployedVersion: "v1.4.2 (41)", commit: "a1b2c3d4",
|
||||
reviewer: "Ben Hippler", note: "dashboard review"))
|
||||
model.replaceSession(try await model.spool.currentSession())
|
||||
// Both seeded sessions are really on disk by now; load them into the model so
|
||||
// the panel's recent list is live rather than empty.
|
||||
model.setPastSessions(try await model.spool.archivedSessions())
|
||||
}
|
||||
|
||||
/// A real PDF from the production composer: one page per capture, header reference
|
||||
/// line and the review footer. Written next to the panels so it can be opened.
|
||||
@MainActor
|
||||
private static func writeSamplePDF(to url: URL, model: AppModel) throws {
|
||||
let session = model.session
|
||||
guard !session.isEmpty else { return }
|
||||
let sourceDir = model.paths.sessionDirectory(session.id)
|
||||
_ = try PDFComposer().compose(
|
||||
session: session,
|
||||
imageURL: { capture in sourceDir.appendingPathComponent(capture.fileName) },
|
||||
title: "Redline – \(session.context.lane) – \(DubaiTime.stamp(session.createdAt))",
|
||||
to: url,
|
||||
toolVersion: model.appVersion
|
||||
)
|
||||
}
|
||||
|
||||
@MainActor
|
||||
@@ -296,6 +342,9 @@ enum PanelSnapshot {
|
||||
watchFolder: root.appendingPathComponent("watch", isDirectory: true)
|
||||
)
|
||||
let ledger = try ReturnLedger(paths: paths)
|
||||
// Isolated defaults: rendering a panel must never read or write the real
|
||||
// age-limit preference.
|
||||
let suite = try makeIsolatedDefaultsSuite()
|
||||
let model = AppModel(
|
||||
paths: paths,
|
||||
spool: try SpoolStore(paths: paths),
|
||||
@@ -304,7 +353,8 @@ enum PanelSnapshot {
|
||||
hotkeys: HotkeyCenter(),
|
||||
picker: RegionPickerController(),
|
||||
ledger: ledger,
|
||||
watcher: ReturnWatcher(paths: paths, ledger: ledger)
|
||||
watcher: ReturnWatcher(paths: paths, ledger: ledger),
|
||||
retentionDefaults: suite.defaults
|
||||
)
|
||||
model.setFolderURLs(outbox: paths.outbox, watch: paths.watchFolder)
|
||||
return (model, root)
|
||||
|
||||
Reference in New Issue
Block a user