hex/scripts/test-annotation-files.sh
Kit Langton e088e95035
feat(annotate): save new annotations as Hex packages (#1944)
Write new Annotate captures as atomic .hexannotation packages under Hex's machine-local annotations folder (<support>/annotations, %LOCALAPPDATA%\hex\annotations on Windows) while reading existing .scrawl libraries in place without copying, mutating, pruning, or retrying them.

- Preserve unknown additive v1 fields on both Package and ScrawlBundle plus validated cleanFrames paths for non-destructive ink editing without a formatVersion break
- Bind .hex-annotate-v1 Paste Last receipts to canonical path, directory (dev, ino), generation, ready_at, and manifest identity while accepting pre-cutover .scrawl receipts in place and rejecting copies across Unified History and Paste Last
- Isolate private retry receipts under RouterDirs::retries with deterministic per-bundle keys and immediate forget on redirect or undo
- Support .hexannotation across annotate_read inspect --json, screenshots recording audio muxing, delayed speech re-transcription, router eval, and editor trim
2026-11-25 02:13:50 -08:00

28 lines
1.7 KiB
Shell

#!/usr/bin/env bash
# Only file fixtures, never the user's library, clipboard, microphone or router.
set -eu
fixture=$(mktemp -d "${TMPDIR:-/tmp}/hex-annotation-check.XXXXXX")
trap 'rm -rf "$fixture"' EXIT
export RUSTUP_HOME="${RUSTUP_HOME:-$HOME/.rustup}" CARGO_HOME="${CARGO_HOME:-$HOME/.cargo}"
export HOME="$fixture" USERPROFILE="$fixture" HEX_APPLICATION_SUPPORT_DIR="$fixture/hex"
export APPDATA="$fixture/roaming" LOCALAPPDATA="$fixture/local" XDG_CONFIG_HOME="$fixture/config"
export XDG_DATA_HOME="$fixture/data" XDG_STATE_HOME="$fixture/state" XDG_CACHE_HOME="$fixture/cache"
export HEX_DISABLE_UPDATES=1 SCRAWL_NO_OPENCODE=1 SCRAWL_CONFIG="$fixture/no-config.json"
export SCRAWL_HELPER="$fixture/no-helper" SCRAWL_UI_HELPER="$fixture/no-ui-helper"
if [[ "${1:-}" == --editor-media ]]; then
# Hex's bundled AVFoundation decoder, resolved relative to our test
# executable. helper::path neither searches PATH nor opens another app.
unset SCRAWL_HELPER
pkgid=$(cargo pkgid)
cargo nextest run --locked -p "hex@${pkgid##*[#@]}" --bin hex --run-ignored only annotation_packages_open_in_the_editor
exit
fi
filters=(hex_annotation history::annotations::tests capture_host::library::tests capture_host::annotate_read::tests paste::recent::tests screenshots::recording::tests slim_zip::tests rune_ui::history::unified::proof::one_history)
if git rev-parse --is-inside-work-tree >/dev/null 2>&1; then
scripts/check "${filters[@]}"
else
# A synced worker has sources but no Git metadata. Run the same scoped
# nextest stage; run the Git-based code shape and pin checks in the checkout.
pkgid=$(cargo pkgid)
cargo nextest run --locked -p "hex@${pkgid##*[#@]}" -p scrawl-router -p scrawl-capture "${filters[@]}"
fi