commit ec2ff203594277b698f630bb5ae70e4004086461
parent 8d849a204b0b67865603f5c877ad7409fc922d30
Author: triesap <tyson@radroots.org>
Date: Thu, 30 Jul 2026 20:02:23 +0000
studio: govern host build and launch readiness
- add a canonical debug and release host build adapter
- require fresh structured events for launch readiness
- cover stale daily log events in the macOS host test
- align contributor commands with the pinned Rust toolchain
Diffstat:
4 files changed, 58 insertions(+), 5 deletions(-)
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
@@ -13,8 +13,8 @@ Keep the filetree small and direct until a larger application boundary is justif
Install the pinned Rust toolchain:
```bash
-rustup toolchain install 1.92.0
-rustup override set 1.92.0
+rustup toolchain install 1.97.0
+rustup override set 1.97.0
```
Confirm your environment:
@@ -34,6 +34,8 @@ cargo check -p radroots_studio_app
cargo test
cargo run -p radroots_studio_app
./scripts/check.sh
+./scripts/build.sh
+./scripts/build.sh --release
./scripts/run.sh
```
diff --git a/platforms/macos/Scripts/run_host.sh b/platforms/macos/Scripts/run_host.sh
@@ -29,7 +29,8 @@ forward_signal() {
fi
}
-require_command grep
+require_command awk
+require_command wc
require_command /usr/libexec/PlistBuddy
require_env RADROOTS_APP_LOCAL_LOG_ROOT
require_env RADROOTS_APP_NOSTR_RELAY_URLS
@@ -54,6 +55,12 @@ startup_attempts="${RADROOTS_APP_HOST_STARTUP_ATTEMPTS:-300}"
mkdir -p "${app_log_root}/raw"
export RUST_LOG="${RADROOTS_APP_RUST_LOG:-info}"
+structured_log_first_fresh_line=1
+if [[ -f "${structured_log_file}" ]]; then
+ existing_structured_log_lines="$(wc -l < "${structured_log_file}")"
+ structured_log_first_fresh_line="$((existing_structured_log_lines + 1))"
+fi
+
trap 'forward_signal TERM' TERM
trap 'forward_signal INT' INT
trap 'forward_signal HUP' HUP
@@ -70,12 +77,23 @@ stop_app_with_error() {
exit 1
}
+fresh_log_contains_event() {
+ local expected_event="$1"
+
+ [[ -f "${structured_log_file}" ]] || return 1
+ awk \
+ -v first_line="${structured_log_first_fresh_line}" \
+ -v event="\"event\":\"${expected_event}\"" \
+ 'NR >= first_line && index($0, event) { found = 1 } END { exit found ? 0 : 1 }' \
+ "${structured_log_file}"
+}
+
"${executable_path}" "$@" >>"${stdout_file}" 2>>"${stderr_file}" &
app_pid="$!"
launch_confirmed=false
for _ in $(seq 1 "${startup_attempts}"); do
- if [[ -f "${structured_log_file}" ]] && grep -q '"event":"runtime.launch"' "${structured_log_file}" 2>/dev/null; then
+ if fresh_log_contains_event "runtime.launch"; then
launch_confirmed=true
break
fi
@@ -92,7 +110,7 @@ if [[ "${launch_confirmed}" != "true" ]]; then
stop_app_with_error "app launch did not emit runtime.launch within startup timeout"
fi
-grep -q '"event":"logging.initialized"' "${structured_log_file}" 2>/dev/null || {
+fresh_log_contains_event "logging.initialized" || {
stop_app_with_error "app launch did not emit logging.initialized in ${structured_log_file}"
}
diff --git a/platforms/macos/Scripts/test_host.sh b/platforms/macos/Scripts/test_host.sh
@@ -163,6 +163,12 @@ latest_log_path="${local_log_root}/apps/local/app/app-macos-native/latest.jsonl"
stdout_file="${local_log_root}/apps/local/app/app-macos-native/raw/stdout.${date_utc}.log"
stderr_file="${local_log_root}/apps/local/app/app-macos-native/raw/stderr.${date_utc}.log"
+mkdir -p "$(dirname "${structured_log_file}")"
+printf '%s\n' \
+ '{"event":"logging.initialized","source":"stale-test-fixture"}' \
+ '{"event":"runtime.launch","source":"stale-test-fixture"}' \
+ >"${structured_log_file}"
+
RADROOTS_APP_RUNTIME_MODE="${runtime_mode}" \
RADROOTS_APP_NOSTR_RELAY_URLS="${nostr_relay_urls}" \
RADROOTS_APP_LOCAL_LOG_ROOT="${local_log_root}" \
@@ -173,6 +179,10 @@ runner_pid="$!"
wait_for_log_event "${structured_log_file}" "runtime.launch" "${runner_pid}"
wait_for_log_event "${structured_log_file}" "logging.initialized" "${runner_pid}"
+[[ "$(grep -c '"event":"runtime.launch"' "${structured_log_file}")" -ge 2 ]] || {
+ echo "run_host.sh accepted a stale runtime.launch event" >&2
+ exit 1
+}
assert_latest_alias "${latest_log_path}"
assert_raw_logs_exist "${stdout_file}" "${stderr_file}"
terminate_runner "${runner_pid}"
diff --git a/scripts/build.sh b/scripts/build.sh
@@ -0,0 +1,23 @@
+#!/usr/bin/env bash
+set -euo pipefail
+
+script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd -P)"
+repo_root="$(git -C "${script_dir}" rev-parse --show-toplevel)"
+configuration="Debug"
+
+if [[ "${1:-}" == "--release" ]]; then
+ configuration="Release"
+ shift
+fi
+
+if [[ "$#" -ne 0 ]]; then
+ echo "usage: ./scripts/build.sh [--release]" >&2
+ exit 2
+fi
+
+if [[ "$(uname -s)" != "Darwin" ]]; then
+ echo "radroots_studio_app host builds currently require macOS" >&2
+ exit 1
+fi
+
+exec env CONFIGURATION="${configuration}" "${repo_root}/platforms/macos/Scripts/build_host.sh"