From 7a0a058085713283882aeda43add5c069a14ec77 Mon Sep 17 00:00:00 2001 From: m00t & Hermes Agent Date: Mon, 30 Nov 2026 04:49:09 +0000 Subject: [PATCH] fix(deploy): add explicit error handling to sync-vps-repos.sh without /dev/null suppression and bump to v2.0.15 --- deploy/sync-vps-repos.sh | 92 ++++++++++++++-------- package.json | 2 +- packages-js/ciphers-aq/package.json | 2 +- pyproject.toml | 2 +- scripts/build_gallery_manifest.py | 4 +- site/gallery/index.html | 2 +- site/index.html | 4 +- site/learn/index.html | 2 +- site/learn/learn-app.js | 2 +- src/hyperstitionstud_io/__init__.py | 4 +- src/hyperstitionstud_io/mcp/server.py | 4 +- src/hyperstitionstud_io/quant/collector.py | 2 +- workspace.example.toml | 2 +- 13 files changed, 76 insertions(+), 48 deletions(-) diff --git a/deploy/sync-vps-repos.sh b/deploy/sync-vps-repos.sh index dc62503..1983661 100755 --- a/deploy/sync-vps-repos.sh +++ b/deploy/sync-vps-repos.sh @@ -9,6 +9,32 @@ # ./sync-vps-repos.sh [all|] [--no-pull] [--no-caddy|--no-services] set -euo pipefail +on_error() { + local exit_code=$? + local line_no="${1:-unknown}" + echo "[ERROR] sync-vps-repos.sh failed at line ${line_no} with exit code ${exit_code} while running: ${BASH_COMMAND}" >&2 + exit "${exit_code}" +} +trap 'on_error ${LINENO}' ERR + +run_checked() { + local label="$1" + shift + local out + if ! out="$("$@" 2>&1)"; then + local rc=$? + echo "[ERROR] ${label} failed (exit code ${rc}): $*" >&2 + if [[ -n "${out}" ]]; then + echo "${out}" >&2 + fi + return "${rc}" + fi +} + +has_cmd() { + command -v "$1" >&2 +} + SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]:-$0}")" && pwd)" DEFAULT_REPOS_ROOT="$(cd "${SCRIPT_DIR}/../.." && pwd)" @@ -34,7 +60,7 @@ for arg in "$@"; do done SUDO="" -if [[ "${EUID:-$(id -u)}" -ne 0 ]] && command -v sudo >/dev/null 2>&1; then +if [[ "${EUID:-$(id -u)}" -ne 0 ]] && type -P sudo >&2; then SUDO="sudo" fi @@ -71,12 +97,12 @@ if [[ "${DO_PULL}" -eq 1 ]]; then fi if [[ -d "${REPOS_ROOT}/${repo}/.git" ]]; then remote_name="origin" - if [[ "${repo}" == "haiperdohp-jemaytreeah" ]] && git -C "${REPOS_ROOT}/${repo}" remote get-url downstream >/dev/null 2>&1; then + if [[ "${repo}" == "haiperdohp-jemaytreeah" ]] && git -C "${REPOS_ROOT}/${repo}" remote | grep -qx "downstream"; then remote_name="downstream" fi echo "[1/5] Updating ${REPOS_ROOT}/${repo} (${remote_name}/${branch})..." - git -C "${REPOS_ROOT}/${repo}" fetch --force "${remote_name}" "${branch}" --tags - git -C "${REPOS_ROOT}/${repo}" merge --ff-only "${remote_name}/${branch}" + run_checked "git fetch ${repo}" git -C "${REPOS_ROOT}/${repo}" fetch --force "${remote_name}" "${branch}" --tags + run_checked "git merge ${repo}" git -C "${REPOS_ROOT}/${repo}" merge --ff-only "${remote_name}/${branch}" fi done fi @@ -85,18 +111,18 @@ fi if [[ -d "${REPOS_ROOT}/haiperdohp-jemaytreeah" ]]; then if [[ ! -f "${REPOS_ROOT}/haiperdohp-jemaytreeah/config.js" ]] && [[ -f "${REPOS_ROOT}/haiperdohp-jemaytreeah/config.default.js" ]]; then echo "[build] Copying haiperdohp-jemaytreeah/config.default.js -> config.js..." - cp "${REPOS_ROOT}/haiperdohp-jemaytreeah/config.default.js" "${REPOS_ROOT}/haiperdohp-jemaytreeah/config.js" + run_checked "copy haiperdohp-jemaytreeah config.js" cp "${REPOS_ROOT}/haiperdohp-jemaytreeah/config.default.js" "${REPOS_ROOT}/haiperdohp-jemaytreeah/config.js" fi if [[ ! -f "${REPOS_ROOT}/haiperdohp-jemaytreeah/db_lite.json" || ! -f "${REPOS_ROOT}/haiperdohp-jemaytreeah/db.json" ]] && [[ -f "${REPOS_ROOT}/haiperdohp-jemaytreeah/tools/generate_db_json.py" ]]; then echo "[build] Generating haiperdohp-jemaytreeah/db.json and db_lite.json from db.txt..." - (cd "${REPOS_ROOT}/haiperdohp-jemaytreeah" && "${PYTHON_BIN}" tools/generate_db_json.py db.txt db.json) + (cd "${REPOS_ROOT}/haiperdohp-jemaytreeah" && run_checked "generate_db_json.py" "${PYTHON_BIN}" tools/generate_db_json.py db.txt db.json) fi fi echo "[2/5] Running hs-doctor, version_sync --check, and 6-Gate Knowledge Graph Verification..." -"${PYTHON_BIN}" -m hyperstitionstud_io.version_sync --check >/dev/null -"${PYTHON_BIN}" -m hyperstitionstud_io.ci.doctor >/dev/null -"${PYTHON_BIN}" "${REPOS_ROOT}/encyclopedia-knowledge-graph/scripts/build_encyclopedia_knowledge_graph.py" --verify-only >/dev/null +run_checked "version_sync --check" "${PYTHON_BIN}" -m hyperstitionstud_io.version_sync --check +run_checked "hs-doctor" "${PYTHON_BIN}" -m hyperstitionstud_io.ci.doctor +run_checked "build_encyclopedia_knowledge_graph.py --verify-only" "${PYTHON_BIN}" "${REPOS_ROOT}/encyclopedia-knowledge-graph/scripts/build_encyclopedia_knowledge_graph.py" --verify-only echo "[3/5] Syncing per-repository install directories into ${LIVE_REPOS}..." LIVE_SUDO="" @@ -111,7 +137,7 @@ for entry in "${REPOS[@]}"; do fi if [[ -d "${REPOS_ROOT}/${repo}" ]]; then ${LIVE_SUDO} mkdir -p "${LIVE_REPOS}/${repo}" - ${LIVE_SUDO} rsync -a --delete --exclude='.git' "${REPOS_ROOT}/${repo}/" "${LIVE_REPOS}/${repo}/" + run_checked "rsync ${repo}" ${LIVE_SUDO} rsync -a --delete --exclude='.git' "${REPOS_ROOT}/${repo}/" "${LIVE_REPOS}/${repo}/" fi done @@ -133,11 +159,11 @@ ${LIVE_SUDO} ln -sfn "ingglish-hyperdope-ci" "${LIVE_REPOS}/ci" ${LIVE_SUDO} ln -sfn "hyperstitionstudio-core/schemas" "${LIVE_REPOS}/schemas" echo "[4/5] Pre-compressing static HTML, JS, JSON, XML, Canvas, MD & CSS assets (< 5 MB) (.br / .gz)..." -${LIVE_SUDO} find "${LIVE_REPOS}" -type f -size -5M \ +run_checked "gzip pre-compression" ${LIVE_SUDO} find "${LIVE_REPOS}" -type f -size -5M \ \( -name "*.html" -o -name "*.js" -o -name "*.json" -o -name "*.graphml" -o -name "*.gexf" -o -name "*.canvas" -o -name "*.css" -o -name "*.md" \) \ -exec gzip -9 -k -f {} \; -if command -v brotli >/dev/null 2>&1; then - ${LIVE_SUDO} find "${LIVE_REPOS}" -type f -size -5M \ +if [[ -n "$(type -P brotli || true)" ]]; then + run_checked "brotli pre-compression" ${LIVE_SUDO} find "${LIVE_REPOS}" -type f -size -5M \ \( -name "*.html" -o -name "*.js" -o -name "*.json" -o -name "*.graphml" -o -name "*.gexf" -o -name "*.canvas" -o -name "*.css" -o -name "*.md" \) \ -exec brotli -q 11 -k -f {} \; fi @@ -145,42 +171,44 @@ fi # Step 5: Idempotent systemd unit & /etc/caddy/Caddyfile synchronization (enabled by default; skip with --no-caddy) if [[ "${DO_CADDY}" -eq 1 ]]; then DEPLOY_DIR="${REPOS_ROOT}/hyperstitionstudio-core/deploy" - if command -v systemctl >/dev/null 2>&1 && [[ -d "/run/systemd/system" ]]; then + if [[ -n "$(type -P systemctl || true)" ]] && [[ -d "/run/systemd/system" ]]; then UNITS_CHANGED=0 for unit_name in "hyperstition-tmpfs-sync.service" "hyperstition-mcp.service"; do src_u="${DEPLOY_DIR}/${unit_name}" dst_u="/etc/systemd/system/${unit_name}" - if [[ -f "${src_u}" ]] && ! cmp -s "${src_u}" "${dst_u}" 2>/dev/null; then - echo "[5/5] Updating systemd unit ${dst_u}..." - ${SUDO} cp "${src_u}" "${dst_u}" - UNITS_CHANGED=1 + if [[ -f "${src_u}" ]]; then + if [[ ! -f "${dst_u}" ]] || ! cmp -s "${src_u}" "${dst_u}"; then + echo "[5/5] Updating systemd unit ${dst_u}..." + run_checked "copy ${unit_name}" ${SUDO} cp "${src_u}" "${dst_u}" + UNITS_CHANGED=1 + fi fi done if [[ "${UNITS_CHANGED}" -eq 1 ]]; then - ${SUDO} systemctl daemon-reload - ${SUDO} systemctl enable hyperstition-tmpfs-sync.service >/dev/null 2>&1 || true - ${SUDO} systemctl enable --now hyperstition-mcp.service >/dev/null 2>&1 || true - ${SUDO} systemctl restart hyperstition-mcp.service >/dev/null 2>&1 || true - elif ! systemctl is-active --quiet hyperstition-mcp.service 2>/dev/null && [[ -f "/etc/systemd/system/hyperstition-mcp.service" ]]; then - ${SUDO} systemctl enable --now hyperstition-mcp.service >/dev/null 2>&1 || true + run_checked "systemctl daemon-reload" ${SUDO} systemctl daemon-reload + run_checked "systemctl enable hyperstition-tmpfs-sync.service" ${SUDO} systemctl enable hyperstition-tmpfs-sync.service + run_checked "systemctl enable --now hyperstition-mcp.service" ${SUDO} systemctl enable --now hyperstition-mcp.service + run_checked "systemctl restart hyperstition-mcp.service" ${SUDO} systemctl restart hyperstition-mcp.service + elif [[ -f "/etc/systemd/system/hyperstition-mcp.service" ]] && ! systemctl is-active --quiet hyperstition-mcp.service; then + run_checked "systemctl enable --now hyperstition-mcp.service" ${SUDO} systemctl enable --now hyperstition-mcp.service fi fi SRC_CADDY="${DEPLOY_DIR}/Caddyfile" DST_CADDY="/etc/caddy/Caddyfile" - if command -v caddy >/dev/null 2>&1 && [[ -d "/etc/caddy" ]] && [[ -f "${SRC_CADDY}" ]]; then - if cmp -s "${SRC_CADDY}" "${DST_CADDY}" 2>/dev/null; then + if [[ -n "$(type -P caddy || true)" ]] && [[ -d "/etc/caddy" ]] && [[ -f "${SRC_CADDY}" ]]; then + if [[ -f "${DST_CADDY}" ]] && cmp -s "${SRC_CADDY}" "${DST_CADDY}"; then echo "[5/5] /etc/caddy/Caddyfile is already identical to deploy/Caddyfile (no reload needed)." else echo "[5/5] Validating and updating ${DST_CADDY} from ${SRC_CADDY}..." - ${SUDO} caddy validate --config "${SRC_CADDY}" --adapter caddyfile >/dev/null - ${SUDO} cp "${SRC_CADDY}" "${DST_CADDY}" - if command -v systemctl >/dev/null 2>&1 && [[ -d "/run/systemd/system" ]]; then - if systemctl is-active --quiet caddy 2>/dev/null; then - ${SUDO} systemctl reload caddy + run_checked "caddy validate ${SRC_CADDY}" ${SUDO} caddy validate --config "${SRC_CADDY}" --adapter caddyfile + run_checked "copy Caddyfile" ${SUDO} cp "${SRC_CADDY}" "${DST_CADDY}" + if [[ -n "$(type -P systemctl || true)" ]] && [[ -d "/run/systemd/system" ]]; then + if systemctl is-active --quiet caddy; then + run_checked "systemctl reload caddy" ${SUDO} systemctl reload caddy echo "[5/5] Reloaded Caddy with updated /etc/caddy/Caddyfile." else - ${SUDO} systemctl enable --now caddy + run_checked "systemctl enable --now caddy" ${SUDO} systemctl enable --now caddy echo "[5/5] Started Caddy with updated /etc/caddy/Caddyfile." fi fi diff --git a/package.json b/package.json index 0fe116e..9666e60 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@hyperstitionstud.io/workspace-core", - "version": "2.0.14", + "version": "2.0.15", "private": true, "description": "Offline-first ESM & browser global (@hyperstitionstud.io/* / window.HyperstitionStudio.*) packages for Base-36 AQ ciphers and interactive knowledge graph workbenches.", "license": "MIT", diff --git a/packages-js/ciphers-aq/package.json b/packages-js/ciphers-aq/package.json index 80d3989..eba7283 100644 --- a/packages-js/ciphers-aq/package.json +++ b/packages-js/ciphers-aq/package.json @@ -1,6 +1,6 @@ { "name": "@hyperstitionstud.io/ciphers-aq", - "version": "2.0.14", + "version": "2.0.15", "type": "module", "main": "index.js", "license": "MIT" diff --git a/pyproject.toml b/pyproject.toml index 4234765..a4a2720 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "hyperstitionstudio-core" -version = "2.0.14" +version = "2.0.15" description = "Shared PEP 420 common library (hyperstitionstud_io.*) for Base-36 AQ ciphers, offline CMUdict Ingglish phonetics, ReportLab/Pillow publishing, SHA-256 glossary isolation guards, local-config citation verification, and multi-format knowledge graphs." readme = "README.md" requires-python = ">=3.10" diff --git a/scripts/build_gallery_manifest.py b/scripts/build_gallery_manifest.py index 5bfbb74..eb1a4b6 100755 --- a/scripts/build_gallery_manifest.py +++ b/scripts/build_gallery_manifest.py @@ -144,8 +144,8 @@ def main() -> int: }) manifest = { - "version": "2.0.14", - "namespace_urn": "urn:io:hyperstitionstud:gallery:2.0.14", + "version": "2.0.15", + "namespace_urn": "urn:io:hyperstitionstud:gallery:2.0.15", "total_items": len(items), "items": items, } diff --git a/site/gallery/index.html b/site/gallery/index.html index f3f1a26..0b18783 100644 --- a/site/gallery/index.html +++ b/site/gallery/index.html @@ -217,7 +217,7 @@
-
hyperstitionstud.io/gallery • Powered by hyperstitionstudio-core (urn:io:hyperstitionstud:gallery:2.0.14)
+
hyperstitionstud.io/gallery • Powered by hyperstitionstudio-core (urn:io:hyperstitionstud:gallery:2.0.15)
Made with ♥ by Lemurs.
diff --git a/site/index.html b/site/index.html index f60308d..8ea24a6 100644 --- a/site/index.html +++ b/site/index.html @@ -131,7 +131,7 @@

HYPERSTITIONSTUD.IO // TECHNOCAPITAL SINGULARITY ZOOLOGY WORKBENCH

-

100% Offline-Portable & HTTP/3 Edge-Ready Research Corpus • Namespace Authority: urn:io:hyperstitionstud (v2.0.14)

+

100% Offline-Portable & HTTP/3 Edge-Ready Research Corpus • Namespace Authority: urn:io:hyperstitionstud (v2.0.15)

Start Learning Track (/learn/) @@ -253,7 +253,7 @@
-
hyperstitionstud.io • Powered by hyperstitionstudio-core (hyperstitionstud_io.* / urn:io:hyperstitionstud v2.0.14) • Zero External Network Dependencies
+
hyperstitionstud.io • Powered by hyperstitionstudio-core (hyperstitionstud_io.* / urn:io:hyperstitionstud v2.0.15) • Zero External Network Dependencies
Made with ♥ by Lemurs.
diff --git a/site/learn/index.html b/site/learn/index.html index b90ba6a..9bcc53b 100644 --- a/site/learn/index.html +++ b/site/learn/index.html @@ -413,7 +413,7 @@ diff --git a/site/learn/learn-app.js b/site/learn/learn-app.js index 98f3d7f..6ccb058 100644 --- a/site/learn/learn-app.js +++ b/site/learn/learn-app.js @@ -265,7 +265,7 @@ const base = { $schema: "../schemas/v1/learn-progress-state.schema.json", $id: SCHEMA_ID, - version: "2.0.14", + version: "2.0.15", updated_at_utc: new Date().toISOString(), preferred_register: "fund_manager", completed_modules: [], diff --git a/src/hyperstitionstud_io/__init__.py b/src/hyperstitionstud_io/__init__.py index a862d53..1459393 100644 --- a/src/hyperstitionstud_io/__init__.py +++ b/src/hyperstitionstud_io/__init__.py @@ -1,3 +1,3 @@ -"""hyperstitionstud_io — Shared Common Library for the hyperstitionstud.io workspace (v2.0.14).""" -__version__ = "2.0.14" +"""hyperstitionstud_io — Shared Common Library for the hyperstitionstud.io workspace (v2.0.15).""" +__version__ = "2.0.15" NAMESPACE_URN = "urn:io:hyperstitionstud" diff --git a/src/hyperstitionstud_io/mcp/server.py b/src/hyperstitionstud_io/mcp/server.py index f2a1054..9cecbbe 100755 --- a/src/hyperstitionstud_io/mcp/server.py +++ b/src/hyperstitionstud_io/mcp/server.py @@ -32,8 +32,8 @@ from hyperstitionstud_io.mcp.tools import MCP_TOOLS_SCHEMA, call_mcp_tool # noq SERVER_INFO = { "name": "hyperstitionstudio-mcp", - "version": "2.0.14", - "namespace_urn": "urn:io:hyperstitionstud:mcp:2.0.14", + "version": "2.0.15", + "namespace_urn": "urn:io:hyperstitionstud:mcp:2.0.15", } diff --git a/src/hyperstitionstud_io/quant/collector.py b/src/hyperstitionstud_io/quant/collector.py index dd81e08..d136582 100755 --- a/src/hyperstitionstud_io/quant/collector.py +++ b/src/hyperstitionstud_io/quant/collector.py @@ -496,7 +496,7 @@ def build_financial_quant_harvest( payload: dict[str, Any] = { "$schema": "./schemas/v1/financial-aq-harvest.schema.json", "$id": "urn:io:hyperstitionstud:schema:v1:financial-aq-harvest", - "version": "2.0.14", + "version": "2.0.15", "target_date_utc": datetime.datetime.now(datetime.timezone.utc).strftime("%Y-%m-%d"), "harvest_mode": harvest_mode, "regime_summary": { diff --git a/workspace.example.toml b/workspace.example.toml index edfa481..e6ce1a0 100644 --- a/workspace.example.toml +++ b/workspace.example.toml @@ -1,6 +1,6 @@ # workspace.example.toml — Location-Independent Workspace Configuration Template (v1.2.0) # Copy to your parent workspace folder: cp hyperstitionstudio-core/workspace.example.toml ./workspace.toml -schema_version = "2.0.14" +schema_version = "2.0.15" namespace_urn = "urn:io:hyperstitionstud" [paths]