mirror of
https://github.com/ksyasuda/SubMiner.git
synced 2026-03-29 18:12:06 -07:00
* chore(backlog): add mining workflow milestone and tasks
* refactor: split character dictionary runtime modules
* refactor: split shared type entrypoints
* refactor: use bun serve for stats server
* feat: add repo-local subminer workflow plugin
* fix: add stats server node fallback
* refactor: split immersion tracker query modules
* chore: update backlog task records
* refactor: migrate shared type imports
* refactor: compose startup and setup window wiring
* Add backlog tasks and launcher time helper tests
- Track follow-up cleanup work in Backlog.md
- Replace Date.now usage with shared nowMs helper
- Add launcher args/parser and core regression tests
* test: increase launcher test timeout for CI stability
* fix: address CodeRabbit review feedback
* refactor(main): extract remaining inline runtime logic from main
* chore(backlog): update task notes and changelog fragment
* refactor: split main boot phases
* test: stabilize bun coverage reporting
* Switch plausible endpoint and harden coverage lane parsing
- update docs-site tracking to use the Plausible capture endpoint
- tighten coverage lane argument and LCOV parsing checks
- make script entrypoint use CommonJS main guard
* Restrict docs analytics and build coverage input
- limit Plausible init to docs.subminer.moe
- build Yomitan before src coverage lane
* fix(ci): normalize Windows shortcut paths for cross-platform tests
* Fix verification and immersion-tracker grouping
- isolate verifier artifacts and lease handling
- switch weekly/monthly tracker cutoffs to calendar boundaries
- tighten boot lifecycle and zip writer tests
* fix: resolve CI type failures in boot and immersion query tests
* fix: remove strict spread usage in Date mocks
* fix: use explicit super args for MockDate constructors
* Factor out mock date helper in tracker tests
- reuse a shared `withMockDate` helper for date-sensitive query tests
- make monthly rollup assertions key off `videoId` instead of row order
* fix: use variadic array type for MockDate constructor args
TS2367: fixed-length tuple made args.length === 0 unreachable.
* refactor: remove unused createMainBootRuntimes/Handlers aggregate functions
These functions were never called by production code — main.ts imports
the individual composeBoot* re-exports directly.
* refactor: remove boot re-export alias layer
main.ts now imports directly from the runtime/composers and runtime/domains
modules, eliminating the intermediate boot/ indirection.
* refactor: consolidate 3 near-identical setup window factories
Extract shared createSetupWindowHandler with a config parameter.
Public API unchanged.
* refactor: parameterize duplicated getAffected*Ids query helpers
Four structurally identical functions collapsed into two parameterized
helpers while preserving the existing public API.
* refactor: inline identity composers (stats-startup, overlay-window)
composeStatsStartupRuntime was a no-op that returned its input.
composeOverlayWindowHandlers was a 1-line delegation.
Both removed in favor of direct usage.
* chore: remove unused token/queue file path constants from main.ts
* fix: replace any types in boot services with proper signatures
* refactor: deduplicate ensureDir into shared/fs-utils
5 copies of mkdir-p-if-not-exists consolidated into one shared module
with ensureDir (directory path) and ensureDirForFile (file path) variants.
* fix: tighten type safety in boot services
- Add AppLifecycleShape and OverlayModalInputStateShape constraints
so TAppLifecycleApp and TOverlayModalInputState generics are bounded
- Remove unsafe `as { handleModalInputStateChange? }` cast — now
directly callable via the constraint
- Use `satisfies AppLifecycleShape` for structural validation on the
appLifecycleApp object literal
- Document Electron App.on incompatibility with simple signatures
* refactor: inline subtitle-prefetch-runtime-composer
The composer was a pure pass-through that destructured an object and
reassembled it with the same fields. Inlined at the call site.
* chore: consolidate duplicate import paths in main.ts
* test: extract mpv composer test fixture factory to reduce duplication
* test: add behavioral assertions to composer tests
Upgrade 8 composer test files from shape-only typeof checks to behavioral
assertions that invoke returned handlers and verify injected dependencies are
actually called, following the mpv-runtime-composer pattern.
* refactor: normalize import extensions in query modules
* refactor: consolidate toDbMs into query-shared.ts
* refactor: remove Node.js fallback from stats-server, use Bun only
* Fix monthly rollup test expectations
- Preserve multi-arg Date construction in mock helper
- Align rollup assertions with the correct videoId
* fix: address PR 36 CodeRabbit follow-ups
* fix: harden coverage lane cleanup
* fix(stats): fallback to node server when Bun.serve unavailable
* fix(ci): restore coverage lane compatibility
* chore(backlog): close TASK-242
* fix: address latest CodeRabbit review round
* fix: guard disabled immersion retention windows
* fix: migrate discord rpc wrapper
* fix(ci): add changelog fragment for PR 36
* fix: stabilize macOS visible overlay toggle
* fix: pin installed mpv plugin to current binary
* fix: strip inline subtitle markup from sidebar cues
* fix(renderer): restore subtitle sidebar mpv passthrough
* feat(discord): add configurable presence style presets
Replace the hardcoded "Mining and crafting (Anki cards)" meme message
with a preset system. New `discordPresence.presenceStyle` option
supports four presets: "default" (clean bilingual), "meme" (the OG
Minecraft joke), "japanese" (fully JP), and "minimal". The default
preset shows "Sentence Mining" with 日本語学習中 as the small image
tooltip. Existing users can set presenceStyle to "meme" to keep the
old behavior.
* fix: finalize v0.10.0 release prep
* docs: add subtitle sidebar guide and release note
* chore(backlog): mark docs task done
* fix: lazily resolve youtube playback socket path
* chore(release): build v0.10.0 changelog
* Revert "chore(release): build v0.10.0 changelog"
This reverts commit 9741c0f020.
525 lines
15 KiB
Bash
Executable File
525 lines
15 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
usage() {
|
|
cat <<'EOF'
|
|
Usage: verify_subminer_change.sh [options] [path ...]
|
|
|
|
Options:
|
|
--lane <name> Force a verification lane. Repeatable.
|
|
--artifact-dir <dir> Use an explicit artifact directory.
|
|
--allow-real-runtime Allow explicit real-runtime execution.
|
|
--allow-real-gui Deprecated alias for --allow-real-runtime.
|
|
--dry-run Record planned steps without executing commands.
|
|
--help Show this help text.
|
|
|
|
If no lanes are supplied, the script classifies the provided paths. If no paths are
|
|
provided, it classifies the current local git changes.
|
|
|
|
Authoritative real-runtime verification should be requested with explicit path
|
|
arguments instead of relying on inferred local git changes.
|
|
EOF
|
|
}
|
|
|
|
timestamp() {
|
|
date +%Y%m%d-%H%M%S
|
|
}
|
|
|
|
timestamp_iso() {
|
|
date -u +%Y-%m-%dT%H:%M:%SZ
|
|
}
|
|
|
|
generate_session_id() {
|
|
local tmp_dir
|
|
tmp_dir=$(mktemp -d "${TMPDIR:-/tmp}/subminer-verify-$(timestamp)-XXXXXX")
|
|
basename "$tmp_dir"
|
|
rmdir "$tmp_dir"
|
|
}
|
|
|
|
has_item() {
|
|
local needle=$1
|
|
shift || true
|
|
local item
|
|
for item in "$@"; do
|
|
if [[ "$item" == "$needle" ]]; then
|
|
return 0
|
|
fi
|
|
done
|
|
return 1
|
|
}
|
|
|
|
normalize_lane_name() {
|
|
case "$1" in
|
|
real-gui)
|
|
printf '%s' "real-runtime"
|
|
;;
|
|
*)
|
|
printf '%s' "$1"
|
|
;;
|
|
esac
|
|
}
|
|
|
|
add_lane() {
|
|
local lane
|
|
lane=$(normalize_lane_name "$1")
|
|
if ! has_item "$lane" "${SELECTED_LANES[@]:-}"; then
|
|
SELECTED_LANES+=("$lane")
|
|
fi
|
|
}
|
|
|
|
add_blocker() {
|
|
BLOCKERS+=("$1")
|
|
BLOCKED=1
|
|
}
|
|
|
|
validate_artifact_dir() {
|
|
local candidate=$1
|
|
if [[ ! "$candidate" =~ ^[A-Za-z0-9._/@:+-]+$ ]]; then
|
|
echo "Invalid characters in --artifact-dir path" >&2
|
|
exit 2
|
|
fi
|
|
}
|
|
|
|
append_step_record() {
|
|
printf '%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\n' \
|
|
"$1" "$2" "$3" "$4" "$5" "$6" "$7" "$8" >>"$STEPS_TSV"
|
|
}
|
|
|
|
record_env() {
|
|
{
|
|
printf 'repo_root=%s\n' "$REPO_ROOT"
|
|
printf 'session_id=%s\n' "$SESSION_ID"
|
|
printf 'artifact_dir=%s\n' "$ARTIFACT_DIR"
|
|
printf 'path_selection_mode=%s\n' "$PATH_SELECTION_MODE"
|
|
printf 'dry_run=%s\n' "$DRY_RUN"
|
|
printf 'allow_real_runtime=%s\n' "$ALLOW_REAL_RUNTIME"
|
|
printf 'session_home=%s\n' "$SESSION_HOME"
|
|
printf 'session_xdg_config_home=%s\n' "$SESSION_XDG_CONFIG_HOME"
|
|
printf 'session_mpv_dir=%s\n' "$SESSION_MPV_DIR"
|
|
printf 'session_logs_dir=%s\n' "$SESSION_LOGS_DIR"
|
|
printf 'session_mpv_log=%s\n' "$SESSION_MPV_LOG"
|
|
printf 'pwd=%s\n' "$(pwd)"
|
|
git rev-parse --short HEAD 2>/dev/null | sed 's/^/git_head=/' || true
|
|
git status --short 2>/dev/null || true
|
|
if [[ ${#PATH_ARGS[@]} -gt 0 ]]; then
|
|
printf 'requested_paths=\n'
|
|
printf ' %s\n' "${PATH_ARGS[@]}"
|
|
fi
|
|
} >"$ARTIFACT_DIR/env.txt"
|
|
}
|
|
|
|
run_step() {
|
|
local lane=$1
|
|
local name=$2
|
|
local command=$3
|
|
local note=${4:-}
|
|
local lane_slug=${lane//[^a-zA-Z0-9_-]/-}
|
|
local slug=${name//[^a-zA-Z0-9_-]/-}
|
|
local step_slug="${lane_slug}--${slug}"
|
|
local stdout_rel="steps/${step_slug}.stdout.log"
|
|
local stderr_rel="steps/${step_slug}.stderr.log"
|
|
local stdout_path="$ARTIFACT_DIR/$stdout_rel"
|
|
local stderr_path="$ARTIFACT_DIR/$stderr_rel"
|
|
local status exit_code
|
|
|
|
COMMANDS_RUN+=("$command")
|
|
printf '%s\n' "$command" >"$ARTIFACT_DIR/steps/${step_slug}.command.txt"
|
|
|
|
if [[ "$DRY_RUN" == "1" ]]; then
|
|
printf '[dry-run] %s\n' "$command" >"$stdout_path"
|
|
: >"$stderr_path"
|
|
status="dry-run"
|
|
exit_code=0
|
|
else
|
|
if HOME="$SESSION_HOME" \
|
|
XDG_CONFIG_HOME="$SESSION_XDG_CONFIG_HOME" \
|
|
SUBMINER_SESSION_LOGS_DIR="$SESSION_LOGS_DIR" \
|
|
SUBMINER_SESSION_MPV_LOG="$SESSION_MPV_LOG" \
|
|
bash -c "cd \"$REPO_ROOT\" && $command" >"$stdout_path" 2>"$stderr_path"; then
|
|
status="passed"
|
|
exit_code=0
|
|
EXECUTED_REAL_STEPS=1
|
|
else
|
|
exit_code=$?
|
|
status="failed"
|
|
FAILED=1
|
|
fi
|
|
fi
|
|
|
|
append_step_record "$lane" "$name" "$status" "$exit_code" "$command" "$stdout_rel" "$stderr_rel" "$note"
|
|
printf '%s\t%s\t%s\n' "$lane" "$name" "$status"
|
|
|
|
if [[ "$status" == "failed" ]]; then
|
|
FAILURE_STEP="$name"
|
|
FAILURE_COMMAND="$command"
|
|
FAILURE_STDOUT="$stdout_rel"
|
|
FAILURE_STDERR="$stderr_rel"
|
|
return "$exit_code"
|
|
fi
|
|
}
|
|
|
|
record_nonpassing_step() {
|
|
local lane=$1
|
|
local name=$2
|
|
local status=$3
|
|
local note=$4
|
|
local lane_slug=${lane//[^a-zA-Z0-9_-]/-}
|
|
local slug=${name//[^a-zA-Z0-9_-]/-}
|
|
local step_slug="${lane_slug}--${slug}"
|
|
local stdout_rel="steps/${step_slug}.stdout.log"
|
|
local stderr_rel="steps/${step_slug}.stderr.log"
|
|
printf '%s\n' "$note" >"$ARTIFACT_DIR/$stdout_rel"
|
|
: >"$ARTIFACT_DIR/$stderr_rel"
|
|
append_step_record "$lane" "$name" "$status" "0" "" "$stdout_rel" "$stderr_rel" "$note"
|
|
printf '%s\t%s\t%s\n' "$lane" "$name" "$status"
|
|
}
|
|
|
|
record_skipped_step() {
|
|
record_nonpassing_step "$1" "$2" "skipped" "$3"
|
|
}
|
|
|
|
record_blocked_step() {
|
|
add_blocker "$3"
|
|
record_nonpassing_step "$1" "$2" "blocked" "$3"
|
|
}
|
|
|
|
record_failed_step() {
|
|
FAILED=1
|
|
FAILURE_STEP=$2
|
|
FAILURE_COMMAND=${FAILURE_COMMAND:-"(validation)"}
|
|
local lane_slug=${1//[^a-zA-Z0-9_-]/-}
|
|
local step_slug=${2//[^a-zA-Z0-9_-]/-}
|
|
FAILURE_STDOUT="steps/${lane_slug}--${step_slug}.stdout.log"
|
|
FAILURE_STDERR="steps/${lane_slug}--${step_slug}.stderr.log"
|
|
add_blocker "$3"
|
|
record_nonpassing_step "$1" "$2" "failed" "$3"
|
|
}
|
|
|
|
find_real_runtime_helper() {
|
|
local candidate
|
|
for candidate in \
|
|
"$SCRIPT_DIR/run_real_runtime_smoke.sh" \
|
|
"$SCRIPT_DIR/run_real_mpv_smoke.sh"; do
|
|
if [[ -x "$candidate" ]]; then
|
|
printf '%s' "$candidate"
|
|
return 0
|
|
fi
|
|
done
|
|
return 1
|
|
}
|
|
|
|
acquire_real_runtime_lease() {
|
|
local lease_root="$REPO_ROOT/.tmp/skill-verification/locks"
|
|
local lease_dir="$lease_root/exclusive-real-runtime"
|
|
mkdir -p "$lease_root"
|
|
if mkdir "$lease_dir" 2>/dev/null; then
|
|
REAL_RUNTIME_LEASE_DIR="$lease_dir"
|
|
printf '%s\n' "$SESSION_ID" >"$lease_dir/session_id"
|
|
return 0
|
|
fi
|
|
|
|
local owner=""
|
|
if [[ -f "$lease_dir/session_id" ]]; then
|
|
owner=$(cat "$lease_dir/session_id")
|
|
fi
|
|
REAL_RUNTIME_LEASE_ERROR="real-runtime lease already held${owner:+ by $owner}"
|
|
return 1
|
|
}
|
|
|
|
release_real_runtime_lease() {
|
|
if [[ -n "$REAL_RUNTIME_LEASE_DIR" && -d "$REAL_RUNTIME_LEASE_DIR" ]]; then
|
|
if [[ -f "$REAL_RUNTIME_LEASE_DIR/session_id" ]]; then
|
|
local owner
|
|
owner=$(cat "$REAL_RUNTIME_LEASE_DIR/session_id")
|
|
if [[ "$owner" != "$SESSION_ID" ]]; then
|
|
return 0
|
|
fi
|
|
fi
|
|
rm -rf "$REAL_RUNTIME_LEASE_DIR"
|
|
fi
|
|
}
|
|
|
|
compute_final_status() {
|
|
if [[ "$FAILED" == "1" ]]; then
|
|
FINAL_STATUS="failed"
|
|
elif [[ "$BLOCKED" == "1" ]]; then
|
|
FINAL_STATUS="blocked"
|
|
elif [[ "$EXECUTED_REAL_STEPS" == "1" ]]; then
|
|
FINAL_STATUS="passed"
|
|
else
|
|
FINAL_STATUS="skipped"
|
|
fi
|
|
}
|
|
|
|
write_summary_files() {
|
|
local lane_lines
|
|
lane_lines=$(printf '%s\n' "${SELECTED_LANES[@]}")
|
|
printf '%s\n' "$lane_lines" >"$ARTIFACT_DIR/lanes.txt"
|
|
printf '%s\n' "${BLOCKERS[@]}" >"$ARTIFACT_DIR/blockers.txt"
|
|
printf '%s\n' "${PATH_ARGS[@]}" >"$ARTIFACT_DIR/requested-paths.txt"
|
|
|
|
ARTIFACT_DIR_ENV="$ARTIFACT_DIR" \
|
|
SESSION_ID_ENV="$SESSION_ID" \
|
|
FINAL_STATUS_ENV="$FINAL_STATUS" \
|
|
PATH_SELECTION_MODE_ENV="$PATH_SELECTION_MODE" \
|
|
ALLOW_REAL_RUNTIME_ENV="$ALLOW_REAL_RUNTIME" \
|
|
SESSION_HOME_ENV="$SESSION_HOME" \
|
|
SESSION_XDG_CONFIG_HOME_ENV="$SESSION_XDG_CONFIG_HOME" \
|
|
SESSION_MPV_DIR_ENV="$SESSION_MPV_DIR" \
|
|
SESSION_LOGS_DIR_ENV="$SESSION_LOGS_DIR" \
|
|
SESSION_MPV_LOG_ENV="$SESSION_MPV_LOG" \
|
|
STARTED_AT_ENV="$STARTED_AT" \
|
|
FINISHED_AT_ENV="$FINISHED_AT" \
|
|
FAILED_ENV="$FAILED" \
|
|
FAILURE_COMMAND_ENV="${FAILURE_COMMAND:-}" \
|
|
FAILURE_STDOUT_ENV="${FAILURE_STDOUT:-}" \
|
|
FAILURE_STDERR_ENV="${FAILURE_STDERR:-}" \
|
|
bun -e '
|
|
const fs = require("fs");
|
|
const path = require("path");
|
|
|
|
const lines = fs
|
|
.readFileSync(path.join(process.env.ARTIFACT_DIR_ENV, "steps.tsv"), "utf8")
|
|
.trim()
|
|
.split("\n")
|
|
.filter(Boolean)
|
|
.slice(1)
|
|
.map((line) => {
|
|
const [lane, name, status, exitCode, command, stdout, stderr, note] = line.split("\t");
|
|
return { lane, name, status, exitCode: Number(exitCode), command, stdout, stderr, note };
|
|
});
|
|
|
|
const payload = {
|
|
sessionId: process.env.SESSION_ID_ENV,
|
|
startedAt: process.env.STARTED_AT_ENV,
|
|
finishedAt: process.env.FINISHED_AT_ENV,
|
|
status: process.env.FINAL_STATUS_ENV,
|
|
pathSelectionMode: process.env.PATH_SELECTION_MODE_ENV,
|
|
allowRealRuntime: process.env.ALLOW_REAL_RUNTIME_ENV === "1",
|
|
sessionHome: process.env.SESSION_HOME_ENV,
|
|
sessionXdgConfigHome: process.env.SESSION_XDG_CONFIG_HOME_ENV,
|
|
sessionMpvDir: process.env.SESSION_MPV_DIR_ENV,
|
|
sessionLogsDir: process.env.SESSION_LOGS_DIR_ENV,
|
|
sessionMpvLog: process.env.SESSION_MPV_LOG_ENV,
|
|
failed: process.env.FAILED_ENV === "1",
|
|
failure: process.env.FAILURE_COMMAND_ENV
|
|
? {
|
|
command: process.env.FAILURE_COMMAND_ENV,
|
|
stdout: process.env.FAILURE_STDOUT_ENV,
|
|
stderr: process.env.FAILURE_STDERR_ENV,
|
|
}
|
|
: null,
|
|
blockers: fs
|
|
.readFileSync(path.join(process.env.ARTIFACT_DIR_ENV, "blockers.txt"), "utf8")
|
|
.split("\n")
|
|
.filter(Boolean),
|
|
lanes: fs
|
|
.readFileSync(path.join(process.env.ARTIFACT_DIR_ENV, "lanes.txt"), "utf8")
|
|
.split("\n")
|
|
.filter(Boolean),
|
|
requestedPaths: fs
|
|
.readFileSync(path.join(process.env.ARTIFACT_DIR_ENV, "requested-paths.txt"), "utf8")
|
|
.split("\n")
|
|
.filter(Boolean),
|
|
steps: lines,
|
|
};
|
|
|
|
fs.writeFileSync(
|
|
path.join(process.env.ARTIFACT_DIR_ENV, "summary.json"),
|
|
JSON.stringify(payload, null, 2) + "\n",
|
|
);
|
|
|
|
const summaryLines = [
|
|
`status: ${payload.status}`,
|
|
`session: ${payload.sessionId}`,
|
|
`artifacts: ${process.env.ARTIFACT_DIR_ENV}`,
|
|
`lanes: ${payload.lanes.join(", ") || "(none)"}`,
|
|
];
|
|
|
|
if (payload.requestedPaths.length > 0) {
|
|
summaryLines.push("requested paths:");
|
|
for (const entry of payload.requestedPaths) {
|
|
summaryLines.push(`- ${entry}`);
|
|
}
|
|
}
|
|
|
|
if (payload.failure) {
|
|
summaryLines.push(`failure command: ${payload.failure.command}`);
|
|
summaryLines.push(`failure stdout: ${payload.failure.stdout}`);
|
|
summaryLines.push(`failure stderr: ${payload.failure.stderr}`);
|
|
}
|
|
|
|
if (payload.blockers.length > 0) {
|
|
summaryLines.push("blockers:");
|
|
for (const blocker of payload.blockers) {
|
|
summaryLines.push(`- ${blocker}`);
|
|
}
|
|
}
|
|
|
|
summaryLines.push("steps:");
|
|
for (const step of payload.steps) {
|
|
summaryLines.push(`- ${step.lane}/${step.name}: ${step.status}`);
|
|
}
|
|
|
|
fs.writeFileSync(
|
|
path.join(process.env.ARTIFACT_DIR_ENV, "summary.txt"),
|
|
summaryLines.join("\n") + "\n",
|
|
);
|
|
'
|
|
}
|
|
|
|
SCRIPT_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
|
|
SKILL_DIR=$(cd "$SCRIPT_DIR/.." && pwd)
|
|
REPO_ROOT=$(git rev-parse --show-toplevel 2>/dev/null || pwd)
|
|
|
|
declare -a PATH_ARGS=()
|
|
declare -a SELECTED_LANES=()
|
|
declare -a COMMANDS_RUN=()
|
|
declare -a BLOCKERS=()
|
|
|
|
ALLOW_REAL_RUNTIME=0
|
|
DRY_RUN=0
|
|
FAILED=0
|
|
BLOCKED=0
|
|
EXECUTED_REAL_STEPS=0
|
|
FAILURE_STEP=""
|
|
FAILURE_COMMAND=""
|
|
FAILURE_STDOUT=""
|
|
FAILURE_STDERR=""
|
|
REAL_RUNTIME_LEASE_DIR=""
|
|
REAL_RUNTIME_LEASE_ERROR=""
|
|
PATH_SELECTION_MODE="auto"
|
|
|
|
trap 'release_real_runtime_lease' EXIT
|
|
|
|
while [[ $# -gt 0 ]]; do
|
|
case "$1" in
|
|
--lane)
|
|
shift
|
|
[[ $# -gt 0 ]] || {
|
|
echo "Missing value for --lane" >&2
|
|
exit 2
|
|
}
|
|
add_lane "$1"
|
|
PATH_SELECTION_MODE="explicit-lanes"
|
|
;;
|
|
--artifact-dir)
|
|
shift
|
|
[[ $# -gt 0 ]] || {
|
|
echo "Missing value for --artifact-dir" >&2
|
|
exit 2
|
|
}
|
|
ARTIFACT_DIR=$1
|
|
;;
|
|
--allow-real-runtime|--allow-real-gui)
|
|
ALLOW_REAL_RUNTIME=1
|
|
;;
|
|
--dry-run)
|
|
DRY_RUN=1
|
|
;;
|
|
--help|-h)
|
|
usage
|
|
exit 0
|
|
;;
|
|
*)
|
|
PATH_ARGS+=("$1")
|
|
;;
|
|
esac
|
|
shift || true
|
|
done
|
|
|
|
if [[ -z "${ARTIFACT_DIR:-}" ]]; then
|
|
SESSION_ID=$(generate_session_id)
|
|
ARTIFACT_DIR="$REPO_ROOT/.tmp/skill-verification/$SESSION_ID"
|
|
else
|
|
validate_artifact_dir "$ARTIFACT_DIR"
|
|
SESSION_ID=$(basename "$ARTIFACT_DIR")
|
|
fi
|
|
|
|
mkdir -p "$ARTIFACT_DIR/steps"
|
|
STEPS_TSV="$ARTIFACT_DIR/steps.tsv"
|
|
printf 'lane\tstep\tstatus\texit_code\tcommand\tstdout\tstderr\tnote\n' >"$STEPS_TSV"
|
|
|
|
STARTED_AT=$(timestamp_iso)
|
|
SESSION_HOME="$REPO_ROOT/.tmp/skill-verification/runtime/$SESSION_ID/home"
|
|
SESSION_XDG_CONFIG_HOME="$REPO_ROOT/.tmp/skill-verification/runtime/$SESSION_ID/xdg-config"
|
|
SESSION_MPV_DIR="$SESSION_XDG_CONFIG_HOME/mpv"
|
|
SESSION_LOGS_DIR="$REPO_ROOT/.tmp/skill-verification/runtime/$SESSION_ID/logs"
|
|
SESSION_MPV_LOG="$SESSION_LOGS_DIR/mpv.log"
|
|
mkdir -p "$SESSION_HOME" "$SESSION_MPV_DIR" "$SESSION_LOGS_DIR"
|
|
|
|
CLASSIFIER_OUTPUT="$ARTIFACT_DIR/classification.txt"
|
|
if [[ ${#SELECTED_LANES[@]} -eq 0 ]]; then
|
|
if [[ ${#PATH_ARGS[@]} -gt 0 ]]; then
|
|
PATH_SELECTION_MODE="explicit-paths"
|
|
fi
|
|
if "$SCRIPT_DIR/classify_subminer_diff.sh" "${PATH_ARGS[@]}" >"$CLASSIFIER_OUTPUT"; then
|
|
while IFS= read -r line; do
|
|
case "$line" in
|
|
lane:*)
|
|
add_lane "${line#lane:}"
|
|
;;
|
|
esac
|
|
done <"$CLASSIFIER_OUTPUT"
|
|
else
|
|
record_failed_step "meta" "classify" "classification failed"
|
|
fi
|
|
else
|
|
: >"$CLASSIFIER_OUTPUT"
|
|
fi
|
|
|
|
record_env
|
|
|
|
if [[ ${#SELECTED_LANES[@]} -eq 0 ]]; then
|
|
add_lane "core"
|
|
fi
|
|
|
|
for lane in "${SELECTED_LANES[@]}"; do
|
|
case "$lane" in
|
|
docs)
|
|
run_step "$lane" "docs-kb" "bun run test:docs:kb" || break
|
|
;;
|
|
config)
|
|
run_step "$lane" "config" "bun run test:config" || break
|
|
;;
|
|
core)
|
|
run_step "$lane" "typecheck" "bun run typecheck" || break
|
|
run_step "$lane" "fast-tests" "bun run test:fast" || break
|
|
;;
|
|
launcher-plugin)
|
|
run_step "$lane" "launcher" "bun run test:launcher" || break
|
|
run_step "$lane" "plugin-src" "bun run test:plugin:src" || break
|
|
;;
|
|
runtime-compat)
|
|
run_step "$lane" "runtime-compat" "bun run test:runtime:compat" || break
|
|
;;
|
|
real-runtime)
|
|
if [[ "$ALLOW_REAL_RUNTIME" != "1" ]]; then
|
|
record_blocked_step "$lane" "real-runtime" "real-runtime requested without --allow-real-runtime"
|
|
continue
|
|
fi
|
|
if ! acquire_real_runtime_lease; then
|
|
record_blocked_step "$lane" "real-runtime-lease" "$REAL_RUNTIME_LEASE_ERROR"
|
|
continue
|
|
fi
|
|
helper=$(find_real_runtime_helper || true)
|
|
if [[ -z "${helper:-}" ]]; then
|
|
record_blocked_step "$lane" "real-runtime-helper" "no real-runtime helper script available in $SCRIPT_DIR"
|
|
continue
|
|
fi
|
|
run_step "$lane" "real-runtime" "\"$helper\" \"$SESSION_ID\" \"$ARTIFACT_DIR\"" || break
|
|
;;
|
|
*)
|
|
record_blocked_step "$lane" "unknown-lane" "unknown lane: $lane"
|
|
;;
|
|
esac
|
|
done
|
|
|
|
release_real_runtime_lease
|
|
FINISHED_AT=$(timestamp_iso)
|
|
compute_final_status
|
|
write_summary_files
|
|
|
|
printf 'summary:%s\n' "$ARTIFACT_DIR/summary.txt"
|
|
cat "$ARTIFACT_DIR/summary.txt"
|