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
+27
View File
@@ -0,0 +1,27 @@
#!/usr/bin/env bash
set -euo pipefail
# Renders the headless panel PNGs and a sample review PDF for visual verification.
#
# ./scripts/render-panels.sh [output-directory]
#
# Builds nothing: run `swift build` (or ./scripts/build-app.sh) first. The output
# directory is printed at the end; nothing outside it is touched, and the isolated
# model means the real Application Support spool and the real age-limit preference
# are never read or written.
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
OUT_DIR="${1:-$(mktemp -d /tmp/redline-panels.XXXXXX)}"
BINARY="${ROOT}/.build/Redline.app/Contents/MacOS/Shotdeck"
if [[ ! -x "${BINARY}" ]]; then
BINARY="${ROOT}/.build/debug/Shotdeck"
fi
if [[ ! -x "${BINARY}" ]]; then
echo "No Shotdeck binary found. Run swift build or ./scripts/build-app.sh first." >&2
exit 1
fi
mkdir -p "${OUT_DIR}"
SHOTDECK_SNAPSHOT_DIR="${OUT_DIR}" "${BINARY}"
echo "Panels written to ${OUT_DIR}"
+66
View File
@@ -0,0 +1,66 @@
#!/usr/bin/env bash
set -euo pipefail
# End-to-end UI run: the real panel, in the ACTIVE app, typed into with the keyboard
# and clicked with the mouse. Launched through LaunchServices ("open -n") because a
# background shell launch can never get a key window — macOS will not let it activate.
#
# ./scripts/run-e2e-ui.sh
#
# Builds a throwaway copy of the signed app under a separate bundle identifier
# (ai.flowmaster.shotdeck.e2e) so it can run alongside the installed Redline without
# touching /Applications, Ben's real captures, or his real preferences. It writes its
# results to a file and exits.
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
SOURCE_APP="${ROOT}/.build/Redline.app"
E2E_APP="${ROOT}/.build/RedlineE2E.app"
IDENTITY="Apple Development: ben@flow-master.ai (QH2H9G2LK5)"
BUNDLE_ID="ai.flowmaster.shotdeck.e2e"
WORK_DIR="$(mktemp -d /tmp/redline-e2e.XXXXXX)"
RESULT="${WORK_DIR}/result.txt"
if [[ ! -d "${SOURCE_APP}" ]]; then
echo "No ${SOURCE_APP} found. Run ./scripts/build-app.sh first." >&2
exit 1
fi
# A leftover instance from an interrupted run would hold the bundle identifier and
# make "open -n" a no-op.
pkill -f "RedlineE2E.app/Contents/MacOS/Shotdeck" >/dev/null 2>&1 || true
for _ in $(seq 1 20); do
pgrep -f "RedlineE2E.app/Contents/MacOS/Shotdeck" >/dev/null 2>&1 || break
sleep 0.2
done
rm -rf "${E2E_APP}"
ditto "${SOURCE_APP}" "${E2E_APP}"
/usr/libexec/PlistBuddy -c "Set :CFBundleIdentifier ${BUNDLE_ID}" "${E2E_APP}/Contents/Info.plist"
/usr/libexec/PlistBuddy -c "Set :CFBundleName Redline E2E" "${E2E_APP}/Contents/Info.plist"
# A menu-bar app (LSUIElement) is never activated by LaunchServices, and macOS only
# lets an active app own the key window the keyboard goes to. The test copy is a
# regular app for the duration of the run; the shipped app keeps LSUIElement.
/usr/libexec/PlistBuddy -c "Set :LSUIElement false" "${E2E_APP}/Contents/Info.plist"
codesign --force --options runtime \
--sign "${IDENTITY}" \
--identifier "${BUNDLE_ID}" \
"${E2E_APP}"
open -n "${E2E_APP}" --args --selftest e2e --root "${WORK_DIR}/storage" --result "${RESULT}"
for _ in $(seq 1 120); do
if [[ -f "${RESULT}" ]] && grep -qE "^E2E (PASS|FAIL)$" "${RESULT}"; then
break
fi
sleep 0.25
done
sleep 0.5
osascript -e "tell application id \"${BUNDLE_ID}\" to quit" >/dev/null 2>&1 || true
if [[ ! -f "${RESULT}" ]]; then
echo "E2E FAIL: no result file was written (${RESULT})" >&2
exit 1
fi
cat "${RESULT}"
grep -q "^E2E PASS$" "${RESULT}"
+24
View File
@@ -0,0 +1,24 @@
#!/usr/bin/env bash
set -euo pipefail
# Runs one in-process self-test phase against the built binary.
#
# ./scripts/run-selftest.sh panel
# ./scripts/run-selftest.sh onedrive
# ./scripts/run-selftest.sh sendtruth
#
# Prints the phase's PASS/FAIL lines and exits with the binary's status.
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
PHASE="${1:-panel}"
BINARY="${ROOT}/.build/Redline.app/Contents/MacOS/Shotdeck"
if [[ ! -x "${BINARY}" ]]; then
BINARY="${ROOT}/.build/debug/Shotdeck"
fi
if [[ ! -x "${BINARY}" ]]; then
echo "No Shotdeck binary found. Run swift build or ./scripts/build-app.sh first." >&2
exit 1
fi
REDLINE_SELFTEST_PHASE="${PHASE}" "${BINARY}"