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:
Claude Fable 5
2026-10-31 11:32:54 +04:00
parent 542aad296b
commit 02fa791b78
26 changed files with 2780 additions and 279 deletions
+64 -3
View File
@@ -105,10 +105,52 @@ struct SettingsView: View {
}
GridRow {
Button("Reveal spool folder") { model.openSpoolFolder() }
.gridCellColumns(2)
Text("Sessions")
.font(.headline)
.frame(maxWidth: .infinity, alignment: .leading)
.padding(.top, 4)
.gridCellColumns(2)
.padding(.top, 6)
}
GridRow(alignment: .center) {
fieldLabel("Delete after")
Picker("Delete after", selection: retentionBinding) {
ForEach(SessionRetention.presets, id: \.self) { preset in
Text(preset.displayName).tag(preset)
}
}
.labelsHidden()
.pickerStyle(.menu)
.frame(maxWidth: .infinity, alignment: .leading)
}
GridRow {
Text(retentionDetail)
.font(.caption)
.foregroundStyle(.secondary)
.fixedSize(horizontal: false, vertical: true)
.gridCellColumns(2)
}
GridRow {
HStack(spacing: 8) {
Button("Clean up now") {
Task { await model.cleanUpExpiredSessions() }
}
.disabled(model.retention == .never)
Spacer(minLength: 0)
Button("Sessions folder") { model.openSessionsFolder() }
}
.gridCellColumns(2)
.frame(maxWidth: .infinity, alignment: .leading)
}
GridRow {
Text("Only Redline's saved screenshots are removed. Sent PDFs are never touched.")
.font(.caption)
.foregroundStyle(.secondary)
.fixedSize(horizontal: false, vertical: true)
.gridCellColumns(2)
}
}
.padding(16)
@@ -121,6 +163,25 @@ struct SettingsView: View {
Binding(get: { model.transport }, set: { model.chooseTransport($0) })
}
private var retentionBinding: Binding<SessionRetention> {
Binding(get: { model.retention }, set: { value in
Task { await model.setRetention(value) }
})
}
/// States what the chosen limit does right now, using the real count of sessions
/// that have already expired — never a guess.
private var retentionDetail: String {
guard model.retention != .never else {
return "All sessions are kept. Nothing is deleted automatically."
}
let count = model.expiredSessionCount
if count == 0 {
return "No kept session is older than \(model.retention.displayName) yet."
}
return "\(count) session\(count == 1 ? " is" : "s are") already older than \(model.retention.displayName) and will be removed on the next launch or cleanup."
}
private func armHotkeyRecorder() {
guard !isRecordingHotkey else { return }
isRecordingHotkey = true