Compare commits
8
Commits
fe33f7d8e8
...
808882e0a6
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
808882e0a6 | ||
|
|
0d4b2a5d27 | ||
|
|
70a69ef647 | ||
|
|
9b587d6351 | ||
|
|
d4b7502501 | ||
|
|
3945e3648a | ||
|
|
1e2968f84e | ||
|
|
d526ede701 |
No files matched your search
@@ -3,8 +3,8 @@
|
|||||||
<!-- HS-COMMIT-STATUS:START -->
|
<!-- HS-COMMIT-STATUS:START -->
|
||||||
> **Gitea Commit & Release Telemetry (`v2.17.1` • Namespace `urn:io:hyperstitionstud`)**
|
> **Gitea Commit & Release Telemetry (`v2.17.1` • Namespace `urn:io:hyperstitionstud`)**
|
||||||
> - **Repository Role & Public Route:** Shared PEP 420 Python core library (`hyperstitionstud_io.*`), MCP/REST server, `/quant/`, `/learn/`, `/engineering/`, `/math/`, & `/donate/` webroots → [`https://hyperstitionstud.io/`](https://hyperstitionstud.io/)
|
> - **Repository Role & Public Route:** Shared PEP 420 Python core library (`hyperstitionstud_io.*`), MCP/REST server, `/quant/`, `/learn/`, `/engineering/`, `/math/`, & `/donate/` webroots → [`https://hyperstitionstud.io/`](https://hyperstitionstud.io/)
|
||||||
> - **Latest Commit Scope (`hyperstitionstudio-core`):** Synchronized v2.17.1 release state across 9 tracked module/artifact surface(s)
|
> - **Latest Commit Scope (`hyperstitionstudio-core`):** Synchronized v2.17.1 release state across 3 tracked module/artifact surface(s)
|
||||||
> - **Touched Files / Surfaces:** `site/quant/daily-brief-data.js`, `site/quant/daily-brief-latest.json`, `site/quant/daily-brief-state.json`, `site/quant/financial-aq-harvest-latest.json`, `site/quant/quant-timeseries-data.js`, `site/quant/quant-timeseries.json`, `site/quant/real-macro-indicators-data.js`, `site/quant/real-macro-indicators.json` (+1 more)
|
> - **Touched Files / Surfaces:** `deploy/push-all-to-git-libre-audio.sh`, `src/hyperstitionstud_io/ci/deploy_scripts_sync.py`, `tests/test_core_suite.py`
|
||||||
> - **Live Verified Ecosystem Metrics (`v2.17.1`):** `6` Repositories • `17` CLI Entrypoints • `20` MCP/REST Tools • `14` URN Resources • `63` Verified Web Routes • `388` KG Nodes / `1,282` Edges • `282` Glossary Entries • `4,943` Offline CMUdict Phonetics • `0` Synthetic Data
|
> - **Live Verified Ecosystem Metrics (`v2.17.1`):** `6` Repositories • `17` CLI Entrypoints • `20` MCP/REST Tools • `14` URN Resources • `63` Verified Web Routes • `388` KG Nodes / `1,282` Edges • `282` Glossary Entries • `4,943` Offline CMUdict Phonetics • `0` Synthetic Data
|
||||||
<!-- HS-COMMIT-STATUS:END -->
|
<!-- HS-COMMIT-STATUS:END -->
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
[Unit]
|
[Unit]
|
||||||
Description=Hyperstition Studio US Closing-Bell Financial & FRED Macro Harvest (21:30 UTC Mon-Fri)
|
Description=Hyperstition Studio Pre-Market-Open (14:00 UTC) & US Closing-Bell (21:30 UTC) Financial & FRED Macro Harvest (Mon-Fri)
|
||||||
After=network-online.target
|
After=network-online.target
|
||||||
Wants=network-online.target
|
Wants=network-online.target
|
||||||
|
|
||||||
@@ -9,4 +9,4 @@ WorkingDirectory=/srv/hyperstitionstud.io/repos
|
|||||||
Environment="REPOS_ROOT=/srv/hyperstitionstud.io/repos"
|
Environment="REPOS_ROOT=/srv/hyperstitionstud.io/repos"
|
||||||
Environment="LIVE_REPOS=/var/www/hyperstitionstud.io/repos"
|
Environment="LIVE_REPOS=/var/www/hyperstitionstud.io/repos"
|
||||||
Environment="PYTHONPATH=/srv/hyperstitionstud.io/repos/hyperstitionstudio-core/src"
|
Environment="PYTHONPATH=/srv/hyperstitionstud.io/repos/hyperstitionstudio-core/src"
|
||||||
ExecStart=/srv/hyperstitionstud.io/repos/hyperstitionstudio-core/deploy/run-vps-data-production.sh --window=us-closing-bell
|
ExecStart=/srv/hyperstitionstud.io/repos/hyperstitionstudio-core/deploy/run-vps-data-production.sh --window=auto
|
||||||
@@ -1,7 +1,8 @@
|
|||||||
[Unit]
|
[Unit]
|
||||||
Description=Weekday 21:30 UTC (16:30 EST) Timer for Hyperstition Studio US Closing-Bell Harvest
|
Description=Weekday 14:00 UTC (09:00 EST) & 21:30 UTC (16:30 EST) Timer for Hyperstition Studio Pre-Market & Closing-Bell Harvest
|
||||||
|
|
||||||
[Timer]
|
[Timer]
|
||||||
|
OnCalendar=Mon..Fri *-*-* 14:00:00 UTC
|
||||||
OnCalendar=Mon..Fri *-*-* 21:30:00 UTC
|
OnCalendar=Mon..Fri *-*-* 21:30:00 UTC
|
||||||
Persistent=true
|
Persistent=true
|
||||||
RandomizedDelaySec=15
|
RandomizedDelaySec=15
|
||||||
|
|||||||
@@ -48,35 +48,71 @@ export PYTHONPATH="${WORKSPACE_DIR}/hyperstitionstudio-core/src${PYTHONPATH:+:${
|
|||||||
export HYPERSTITIONSTUDIO_CONFIG="${HYPERSTITIONSTUDIO_CONFIG:-${WORKSPACE_DIR}/workspace.toml}"
|
export HYPERSTITIONSTUDIO_CONFIG="${HYPERSTITIONSTUDIO_CONFIG:-${WORKSPACE_DIR}/workspace.toml}"
|
||||||
FORGE_SSH="${FORGE_SSH:-ssh://git@git.libre.audio:2222/seasharp}"
|
FORGE_SSH="${FORGE_SSH:-ssh://git@git.libre.audio:2222/seasharp}"
|
||||||
|
|
||||||
|
EXEGESIS_HOST="${EXEGESIS_HOST:-}"
|
||||||
|
EXEGESIS_UNINSTALL=0
|
||||||
|
SKIP_EXEGESIS_DEPLOY=0
|
||||||
|
|
||||||
|
while [[ $# -gt 0 ]]; do
|
||||||
|
case "$1" in
|
||||||
|
--exegesis-host=*)
|
||||||
|
EXEGESIS_HOST="${1#*=}"
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
--exegesis-host)
|
||||||
|
if [[ $# -lt 2 ]] || [[ -z "${2:-}" ]]; then
|
||||||
|
echo "[ERROR] --exegesis-host requires a <user@host> argument." >&2
|
||||||
|
exit 2
|
||||||
|
fi
|
||||||
|
EXEGESIS_HOST="$2"
|
||||||
|
shift 2
|
||||||
|
;;
|
||||||
|
--exegesis-uninstall)
|
||||||
|
EXEGESIS_UNINSTALL=1
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
--skip-exegesis-deploy)
|
||||||
|
SKIP_EXEGESIS_DEPLOY=1
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
-h|--help)
|
||||||
|
echo "Usage: $0 [--exegesis-host=<user@host>] [--exegesis-uninstall] [--skip-exegesis-deploy]"
|
||||||
|
exit 0
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "[ERROR] Unknown option: $1" >&2
|
||||||
|
echo "Usage: $0 [--exegesis-host=<user@host>] [--exegesis-uninstall] [--skip-exegesis-deploy]" >&2
|
||||||
|
exit 2
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
if [[ "${EXEGESIS_UNINSTALL}" -eq 1 ]]; then
|
||||||
|
if [[ -z "${EXEGESIS_HOST}" ]] && [[ -t 0 ]]; then
|
||||||
|
read -r -p "Enter target Fedora 41 host (user@host) to uninstall ingglish-isopsephic-exegesis: " EXEGESIS_HOST || EXEGESIS_HOST=""
|
||||||
|
fi
|
||||||
|
if [[ -z "${EXEGESIS_HOST}" ]]; then
|
||||||
|
echo "[ERROR] --exegesis-uninstall requires --exegesis-host=<user@host>." >&2
|
||||||
|
exit 2
|
||||||
|
fi
|
||||||
|
echo "[uninstall] Verifying SSH connectivity to ${EXEGESIS_HOST}..."
|
||||||
|
ssh -o BatchMode=yes -o ConnectTimeout=5 "${EXEGESIS_HOST}" true
|
||||||
|
echo "[uninstall] Uninstalling ingglish-isopsephic-exegesis on ${EXEGESIS_HOST}..."
|
||||||
|
if [[ -t 0 ]]; then
|
||||||
|
ssh -t "${EXEGESIS_HOST}" sudo rpm -e ingglish-isopsephic-exegesis
|
||||||
|
else
|
||||||
|
ssh "${EXEGESIS_HOST}" sudo rpm -e ingglish-isopsephic-exegesis
|
||||||
|
fi
|
||||||
|
echo "[OK] Cleanly uninstalled ingglish-isopsephic-exegesis from ${EXEGESIS_HOST}."
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
echo "[info] WORKSPACE_DIR=${WORKSPACE_DIR}"
|
echo "[info] WORKSPACE_DIR=${WORKSPACE_DIR}"
|
||||||
echo "[info] PYTHONPATH=${PYTHONPATH}"
|
echo "[info] PYTHONPATH=${PYTHONPATH}"
|
||||||
|
|
||||||
echo "[1/3] Running pre-push verification gates (hs-archive-rotate, hs-closeups-sync, hs-readme-sync, version_sync, hs-doctor, logrotate.d/hyperstition-sqlite-meta check, periodic harvest CI/CD flow diagram PNG test, closeups check, test_core_suite, 6-gate graph verifier)..."
|
echo "[1/3] Running pre-push verification gates (hs-archive-rotate, hs-readme-sync, version_sync --corpus-delta, periodic harvest CI/CD flow diagram PNG, Fedora 41 RPM & dry-run, test_core_suite, 6-gate graph verifier)..."
|
||||||
run_checked "hs-archive-rotate --enforce-single-compression" python3 -m hyperstitionstud_io.publishing.archive_rotator --workspace-root "${WORKSPACE_DIR}" --enforce-single-compression
|
run_checked "hs-archive-rotate --enforce-single-compression" python3 -m hyperstitionstud_io.publishing.archive_rotator --workspace-root "${WORKSPACE_DIR}" --enforce-single-compression
|
||||||
run_checked "verify docs/archive/archive-manifest.json" test -s "${WORKSPACE_DIR}/encyclopedia-knowledge-graph/docs/archive/archive-manifest.json"
|
|
||||||
run_checked "verify docs/plans/inactive/inactive-archive-manifest.json" test -s "${WORKSPACE_DIR}/encyclopedia-knowledge-graph/docs/plans/inactive/inactive-archive-manifest.json"
|
|
||||||
run_checked "hs-closeups-sync" python3 -m hyperstitionstud_io.publishing.closeups_sync
|
|
||||||
run_checked "hs-readme-sync --install-hooks" python3 -m hyperstitionstud_io.publishing.readme_sync --install-hooks
|
run_checked "hs-readme-sync --install-hooks" python3 -m hyperstitionstud_io.publishing.readme_sync --install-hooks
|
||||||
run_checked "version_sync --check" python3 -m hyperstitionstud_io.version_sync --check
|
|
||||||
run_checked "version_sync --corpus-delta" python3 -m hyperstitionstud_io.version_sync --corpus-delta
|
run_checked "version_sync --corpus-delta" python3 -m hyperstitionstud_io.version_sync --corpus-delta
|
||||||
run_checked "hs-doctor" python3 -m hyperstitionstud_io.ci.doctor
|
|
||||||
run_checked "verify deploy/logrotate.d/hyperstition-sqlite-meta" test -f "${WORKSPACE_DIR}/hyperstitionstudio-core/deploy/logrotate.d/hyperstition-sqlite-meta"
|
|
||||||
run_checked "verify site/assets/hs-matrix-coderain.js" test -s "${WORKSPACE_DIR}/hyperstitionstudio-core/site/assets/hs-matrix-coderain.js"
|
|
||||||
run_checked "verify site/assets/matrix-font.woff2" test -s "${WORKSPACE_DIR}/hyperstitionstudio-core/site/assets/matrix-font.woff2"
|
|
||||||
for q_png in \
|
|
||||||
"quadrant-1-cybermemetics-calc-graph.png" \
|
|
||||||
"quadrant-1-tab-2-graph.png" \
|
|
||||||
"quadrant-2-esoteric-finance-quant.png" \
|
|
||||||
"quadrant-2-tab-2-bayesian-fred.png" \
|
|
||||||
"quadrant-2-tab-3-leaderboard-card.png" \
|
|
||||||
"quadrant-3-info-science-novice-learn-polyglot.png" \
|
|
||||||
"quadrant-3-tab-2-math-guile.png" \
|
|
||||||
"quadrant-3-tab-3-math-ts-rust.png" \
|
|
||||||
"quadrant-4-operators-deployment-vps.png" \
|
|
||||||
"quadrant-4-tab-2-mcp-etag.png" \
|
|
||||||
"quadrant-4-tab-3-ci-gates.png"; do
|
|
||||||
run_checked "verify site/assets/closeups/${q_png}" test -s "${WORKSPACE_DIR}/hyperstitionstudio-core/site/assets/closeups/${q_png}"
|
|
||||||
done
|
|
||||||
run_checked "generate & verify periodic-harvest-cicd-to-vps-flow-diagram.png" python3 -m hyperstitionstud_io.publishing.flow_diagram
|
run_checked "generate & verify periodic-harvest-cicd-to-vps-flow-diagram.png" python3 -m hyperstitionstud_io.publishing.flow_diagram
|
||||||
run_checked "verify periodic-harvest-cicd-to-vps-flow-diagram.png exists" test -s "${WORKSPACE_DIR}/encyclopedia-knowledge-graph/docs/periodic-harvest-cicd-to-vps-flow-diagram.png"
|
run_checked "verify periodic-harvest-cicd-to-vps-flow-diagram.png exists" test -s "${WORKSPACE_DIR}/encyclopedia-knowledge-graph/docs/periodic-harvest-cicd-to-vps-flow-diagram.png"
|
||||||
run_checked "verify Fedora 41 packaging scripts & spec" "${WORKSPACE_DIR}/ingglish-hyperdope-gematria/packaging/build-fedora41-rpm.sh"
|
run_checked "verify Fedora 41 packaging scripts & spec" "${WORKSPACE_DIR}/ingglish-hyperdope-gematria/packaging/build-fedora41-rpm.sh"
|
||||||
@@ -85,12 +121,16 @@ python3 "${WORKSPACE_DIR}/hyperstitionstudio-core/tests/test_core_suite.py"
|
|||||||
run_checked "build_encyclopedia_knowledge_graph.py --verify-only" python3 "${WORKSPACE_DIR}/encyclopedia-knowledge-graph/scripts/build_encyclopedia_knowledge_graph.py" --verify-only
|
run_checked "build_encyclopedia_knowledge_graph.py --verify-only" python3 "${WORKSPACE_DIR}/encyclopedia-knowledge-graph/scripts/build_encyclopedia_knowledge_graph.py" --verify-only
|
||||||
|
|
||||||
echo "[2/3] Verifying git.libre.audio remote URLs across all repositories..."
|
echo "[2/3] Verifying git.libre.audio remote URLs across all repositories..."
|
||||||
|
CI_REPO_DIR="hyperdope-ci-build"
|
||||||
|
if [[ ! -d "${WORKSPACE_DIR}/${CI_REPO_DIR}" ]] && [[ -d "${WORKSPACE_DIR}/ingglish-hyperdope-ci" ]]; then
|
||||||
|
CI_REPO_DIR="ingglish-hyperdope-ci"
|
||||||
|
fi
|
||||||
for pair in \
|
for pair in \
|
||||||
"hyperstitionstudio-core:hyperstitionstudio-core.git" \
|
"hyperstitionstudio-core:hyperstitionstudio-core.git" \
|
||||||
"ingglish-hyperdope-gematria:ingglish-hyperdope-gematria.git" \
|
"ingglish-hyperdope-gematria:ingglish-hyperdope-gematria.git" \
|
||||||
"technocapital-singularity-zoology:technocapital-singularity-zoology.git" \
|
"technocapital-singularity-zoology:technocapital-singularity-zoology.git" \
|
||||||
"encyclopedia-knowledge-graph:encyclopedia-knowledge-graph.git" \
|
"encyclopedia-knowledge-graph:encyclopedia-knowledge-graph.git" \
|
||||||
"hyperdope-ci-build:ingglish-hyperdope-ci.git"; do
|
"${CI_REPO_DIR}:ingglish-hyperdope-ci.git"; do
|
||||||
rdir="${WORKSPACE_DIR}/${pair%%:*}"
|
rdir="${WORKSPACE_DIR}/${pair%%:*}"
|
||||||
rslug="${pair##*:}"
|
rslug="${pair##*:}"
|
||||||
ensure_remote_url "${rdir}" origin "${FORGE_SSH}/${rslug}"
|
ensure_remote_url "${rdir}" origin "${FORGE_SSH}/${rslug}"
|
||||||
@@ -108,39 +148,168 @@ push_head_tag() {
|
|||||||
|
|
||||||
echo "[3/3] Rebasing any automated VPS telemetry commits & pushing all 6 repositories and HEAD release tags in topological dependency order to ${FORGE_SSH}..."
|
echo "[3/3] Rebasing any automated VPS telemetry commits & pushing all 6 repositories and HEAD release tags in topological dependency order to ${FORGE_SSH}..."
|
||||||
echo " -> (1/6) hyperstitionstudio-core (main + HEAD tag)"
|
echo " -> (1/6) hyperstitionstudio-core (main + HEAD tag)"
|
||||||
git -C "${WORKSPACE_DIR}/hyperstitionstudio-core" pull --rebase --autostash origin main || true
|
run_checked "git pull --rebase (hyperstitionstudio-core main)" git -C "${WORKSPACE_DIR}/hyperstitionstudio-core" pull --rebase --autostash origin main
|
||||||
git -C "${WORKSPACE_DIR}/hyperstitionstudio-core" push -u origin main
|
git -C "${WORKSPACE_DIR}/hyperstitionstudio-core" push -u origin main
|
||||||
push_head_tag "${WORKSPACE_DIR}/hyperstitionstudio-core" origin
|
push_head_tag "${WORKSPACE_DIR}/hyperstitionstudio-core" origin
|
||||||
|
|
||||||
echo " -> (2/6) ingglish-hyperdope-gematria (main + HEAD tag)"
|
echo " -> (2/6) ingglish-hyperdope-gematria (main + HEAD tag)"
|
||||||
git -C "${WORKSPACE_DIR}/ingglish-hyperdope-gematria" pull --rebase --autostash origin main || true
|
run_checked "git pull --rebase (ingglish-hyperdope-gematria main)" git -C "${WORKSPACE_DIR}/ingglish-hyperdope-gematria" pull --rebase --autostash origin main
|
||||||
git -C "${WORKSPACE_DIR}/ingglish-hyperdope-gematria" push -u origin main
|
git -C "${WORKSPACE_DIR}/ingglish-hyperdope-gematria" push -u origin main
|
||||||
push_head_tag "${WORKSPACE_DIR}/ingglish-hyperdope-gematria" origin
|
push_head_tag "${WORKSPACE_DIR}/ingglish-hyperdope-gematria" origin
|
||||||
|
|
||||||
echo " -> (3/6) technocapital-singularity-zoology (main + HEAD tag)"
|
echo " -> (3/6) technocapital-singularity-zoology (main + HEAD tag)"
|
||||||
git -C "${WORKSPACE_DIR}/technocapital-singularity-zoology" pull --rebase --autostash origin main || true
|
run_checked "git pull --rebase (technocapital-singularity-zoology main)" git -C "${WORKSPACE_DIR}/technocapital-singularity-zoology" pull --rebase --autostash origin main
|
||||||
git -C "${WORKSPACE_DIR}/technocapital-singularity-zoology" push -u origin main
|
git -C "${WORKSPACE_DIR}/technocapital-singularity-zoology" push -u origin main
|
||||||
push_head_tag "${WORKSPACE_DIR}/technocapital-singularity-zoology" origin
|
push_head_tag "${WORKSPACE_DIR}/technocapital-singularity-zoology" origin
|
||||||
|
|
||||||
echo " -> (4/6) encyclopedia-knowledge-graph (main + HEAD tag)"
|
echo " -> (4/6) encyclopedia-knowledge-graph (main + HEAD tag)"
|
||||||
git -C "${WORKSPACE_DIR}/encyclopedia-knowledge-graph" pull --rebase --autostash origin main || true
|
run_checked "git pull --rebase (encyclopedia-knowledge-graph main)" git -C "${WORKSPACE_DIR}/encyclopedia-knowledge-graph" pull --rebase --autostash origin main
|
||||||
git -C "${WORKSPACE_DIR}/encyclopedia-knowledge-graph" push -u origin main
|
git -C "${WORKSPACE_DIR}/encyclopedia-knowledge-graph" push -u origin main
|
||||||
push_head_tag "${WORKSPACE_DIR}/encyclopedia-knowledge-graph" origin
|
push_head_tag "${WORKSPACE_DIR}/encyclopedia-knowledge-graph" origin
|
||||||
|
|
||||||
echo " -> (5/6) hyperdope-ci-build (feat/ingglish-aq-corpus + HEAD tag)"
|
echo " -> (5/6) hyperdope-ci-build (${CI_REPO_DIR}, feat/ingglish-aq-corpus + HEAD tag)"
|
||||||
git -C "${WORKSPACE_DIR}/hyperdope-ci-build" pull --rebase --autostash origin feat/ingglish-aq-corpus || true
|
run_checked "git pull --rebase (${CI_REPO_DIR} feat/ingglish-aq-corpus)" git -C "${WORKSPACE_DIR}/${CI_REPO_DIR}" pull --rebase --autostash origin feat/ingglish-aq-corpus
|
||||||
git -C "${WORKSPACE_DIR}/hyperdope-ci-build" push -u origin feat/ingglish-aq-corpus
|
git -C "${WORKSPACE_DIR}/${CI_REPO_DIR}" push -u origin feat/ingglish-aq-corpus
|
||||||
push_head_tag "${WORKSPACE_DIR}/hyperdope-ci-build" origin
|
push_head_tag "${WORKSPACE_DIR}/${CI_REPO_DIR}" origin
|
||||||
|
|
||||||
if [[ -d "${WORKSPACE_DIR}/haiperdohp-jemaytreeah/.git" ]]; then
|
if [[ -d "${WORKSPACE_DIR}/haiperdohp-jemaytreeah/.git" ]]; then
|
||||||
echo " -> (6/6) haiperdohp-jemaytreeah (downstream main, feat/ingglish-aq-corpus, feat/ingglish-priority-toggle + HEAD tag)"
|
echo " -> (6/6) haiperdohp-jemaytreeah (downstream main, feat/ingglish-aq-corpus, feat/ingglish-priority-toggle + HEAD tag)"
|
||||||
ensure_remote_url "${WORKSPACE_DIR}/haiperdohp-jemaytreeah" downstream "${FORGE_SSH}/haiperdohp-jemaytreeah.git"
|
ensure_remote_url "${WORKSPACE_DIR}/haiperdohp-jemaytreeah" downstream "${FORGE_SSH}/haiperdohp-jemaytreeah.git"
|
||||||
git -C "${WORKSPACE_DIR}/haiperdohp-jemaytreeah" fetch downstream || true
|
run_checked "git fetch downstream (haiperdohp-jemaytreeah)" git -C "${WORKSPACE_DIR}/haiperdohp-jemaytreeah" fetch downstream
|
||||||
git -C "${WORKSPACE_DIR}/haiperdohp-jemaytreeah" pull --rebase --autostash downstream main || true
|
run_checked "git pull --rebase (haiperdohp-jemaytreeah main)" git -C "${WORKSPACE_DIR}/haiperdohp-jemaytreeah" pull --rebase --autostash downstream main
|
||||||
git -C "${WORKSPACE_DIR}/haiperdohp-jemaytreeah" pull --rebase --autostash downstream feat/ingglish-aq-corpus || true
|
run_checked "git pull --rebase (haiperdohp-jemaytreeah feat/ingglish-aq-corpus)" git -C "${WORKSPACE_DIR}/haiperdohp-jemaytreeah" pull --rebase --autostash downstream feat/ingglish-aq-corpus
|
||||||
git -C "${WORKSPACE_DIR}/haiperdohp-jemaytreeah" pull --rebase --autostash downstream feat/ingglish-priority-toggle || true
|
run_checked "git pull --rebase (haiperdohp-jemaytreeah feat/ingglish-priority-toggle)" git -C "${WORKSPACE_DIR}/haiperdohp-jemaytreeah" pull --rebase --autostash downstream feat/ingglish-priority-toggle
|
||||||
git -C "${WORKSPACE_DIR}/haiperdohp-jemaytreeah" push downstream main feat/ingglish-aq-corpus feat/ingglish-priority-toggle
|
git -C "${WORKSPACE_DIR}/haiperdohp-jemaytreeah" push downstream main feat/ingglish-aq-corpus feat/ingglish-priority-toggle
|
||||||
push_head_tag "${WORKSPACE_DIR}/haiperdohp-jemaytreeah" downstream
|
push_head_tag "${WORKSPACE_DIR}/haiperdohp-jemaytreeah" downstream
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "[OK] All 6 repositories and release tags pushed to ${FORGE_SSH}."
|
echo "[OK] All 6 repositories and release tags pushed to ${FORGE_SSH}."
|
||||||
|
|
||||||
|
if [[ "${SKIP_EXEGESIS_DEPLOY}" -eq 1 ]]; then
|
||||||
|
echo "[info] Skipping Fedora 41 exegesis RPM over-the-wire deployment (--skip-exegesis-deploy)."
|
||||||
|
elif [[ -z "${EXEGESIS_HOST}" ]] && [[ -t 0 ]]; then
|
||||||
|
read -r -p "Deploy built Fedora 41 exegesis RPM over the wire via SSH? [y/N / enter user@host]: " EXEGESIS_INPUT || EXEGESIS_INPUT=""
|
||||||
|
EXEGESIS_INPUT="${EXEGESIS_INPUT#"${EXEGESIS_INPUT%%[![:space:]]*}"}"
|
||||||
|
EXEGESIS_INPUT="${EXEGESIS_INPUT%"${EXEGESIS_INPUT##*[![:space:]]}"}"
|
||||||
|
case "${EXEGESIS_INPUT}" in
|
||||||
|
""|n|N|no|NO)
|
||||||
|
echo "[info] Skipping Fedora 41 exegesis RPM over-the-wire deployment."
|
||||||
|
;;
|
||||||
|
y|Y|yes|YES)
|
||||||
|
read -r -p "Enter target Fedora 41 host (user@host or IP): " EXEGESIS_HOST || EXEGESIS_HOST=""
|
||||||
|
EXEGESIS_HOST="${EXEGESIS_HOST#"${EXEGESIS_HOST%%[![:space:]]*}"}"
|
||||||
|
EXEGESIS_HOST="${EXEGESIS_HOST%"${EXEGESIS_HOST##*[![:space:]]}"}"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
EXEGESIS_HOST="${EXEGESIS_INPUT}"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
elif [[ -z "${EXEGESIS_HOST}" ]]; then
|
||||||
|
echo "[info] Non-interactive session and --exegesis-host not set; skipping Fedora 41 exegesis RPM deployment."
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ "${SKIP_EXEGESIS_DEPLOY}" -eq 0 ]] && [[ -n "${EXEGESIS_HOST}" ]]; then
|
||||||
|
echo "[deploy] Verifying SSH connectivity to ${EXEGESIS_HOST}..."
|
||||||
|
ssh -o BatchMode=yes -o ConnectTimeout=5 "${EXEGESIS_HOST}" true
|
||||||
|
|
||||||
|
RPM_FILE=""
|
||||||
|
shopt -s nullglob
|
||||||
|
RPM_CANDIDATES=(
|
||||||
|
"${WORKSPACE_DIR}/ingglish-hyperdope-gematria/packaging"/ingglish-isopsephic-exegesis-*.fc41.noarch.rpm
|
||||||
|
"${WORKSPACE_DIR}/untracked/rpm-builds"/ingglish-isopsephic-exegesis-*.fc41.noarch.rpm
|
||||||
|
)
|
||||||
|
shopt -u nullglob
|
||||||
|
if [[ ${#RPM_CANDIDATES[@]} -gt 0 ]]; then
|
||||||
|
RPM_FILE="$(printf '%s\n' "${RPM_CANDIDATES[@]}" | sort -V | tail -n 1)"
|
||||||
|
fi
|
||||||
|
if [[ -z "${RPM_FILE}" ]] || [[ ! -f "${RPM_FILE}" ]]; then
|
||||||
|
echo "[ERROR] No built Fedora 41 RPM found in ${WORKSPACE_DIR}/ingglish-hyperdope-gematria/packaging/ or ${WORKSPACE_DIR}/untracked/rpm-builds/." >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
RPM_NAME="$(basename "${RPM_FILE}")"
|
||||||
|
RPM_SIZE_BYTES="$(wc -c < "${RPM_FILE}" | tr -d '[:space:]')"
|
||||||
|
MIN_STAGE_KB="$(( (RPM_SIZE_BYTES + 1023) / 1024 + 1024 ))"
|
||||||
|
echo "[deploy] Found built RPM: ${RPM_FILE} (${RPM_SIZE_BYTES} bytes)"
|
||||||
|
|
||||||
|
echo "[deploy] Resolving writable remote staging directory on ${EXEGESIS_HOST} (need >= ${MIN_STAGE_KB} KiB)..."
|
||||||
|
REMOTE_STAGE_DIR="$(
|
||||||
|
ssh -o BatchMode=yes -o ConnectTimeout=5 "${EXEGESIS_HOST}" bash -s -- "${MIN_STAGE_KB}" <<'EOF_STAGE'
|
||||||
|
set -euo pipefail
|
||||||
|
min_kb="${1:-2048}"
|
||||||
|
home_dir="${HOME:-$(pwd)}"
|
||||||
|
for cand in "/tmp" "${home_dir}/.cache/rpm-stage" "${home_dir}/rpm-stage"; do
|
||||||
|
created_parent=0
|
||||||
|
if [[ "${cand}" != "/tmp" ]]; then
|
||||||
|
if [[ ! -d "${cand}" ]]; then
|
||||||
|
mkdir -p "${cand}" || continue
|
||||||
|
created_parent=1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
if [[ ! -d "${cand}" ]] || [[ ! -w "${cand}" ]]; then
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
if mount_opts="$(findmnt -n -o OPTIONS -T "${cand}" 2>&1)"; then
|
||||||
|
mount_opts="${mount_opts//[[:space:]]/}"
|
||||||
|
case ",${mount_opts}," in
|
||||||
|
*,noexec,*)
|
||||||
|
if [[ "${created_parent}" -eq 1 ]]; then
|
||||||
|
rmdir "${cand}" || true
|
||||||
|
fi
|
||||||
|
continue
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
avail_kb="$(df -Pk "${cand}" 2>&1 | awk 'NR==2 {print $4}')"
|
||||||
|
case "${avail_kb}" in
|
||||||
|
''|*[!0-9]*) avail_kb=0 ;;
|
||||||
|
esac
|
||||||
|
if [[ "${avail_kb}" -lt "${min_kb}" ]]; then
|
||||||
|
if [[ "${created_parent}" -eq 1 ]]; then
|
||||||
|
rmdir "${cand}" || true
|
||||||
|
fi
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
if stage_dir="$(mktemp -d "${cand}/ingglish-exegesis-stage.XXXXXX" 2>&1)"; then
|
||||||
|
if [[ -d "${stage_dir}" ]] && [[ -w "${stage_dir}" ]]; then
|
||||||
|
printf '%s\n' "${stage_dir}"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
if [[ "${created_parent}" -eq 1 ]]; then
|
||||||
|
rmdir "${cand}" || true
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
echo "[ERROR] Failed to resolve a writable remote staging directory with >= ${min_kb} KiB free and without noexec." >&2
|
||||||
|
exit 1
|
||||||
|
EOF_STAGE
|
||||||
|
)"
|
||||||
|
if [[ -z "${REMOTE_STAGE_DIR}" ]]; then
|
||||||
|
echo "[ERROR] Remote staging directory resolution returned an empty path on ${EXEGESIS_HOST}." >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
REMOTE_RPM_PATH="${REMOTE_STAGE_DIR}/${RPM_NAME}"
|
||||||
|
echo "[deploy] Using remote staging directory: ${REMOTE_STAGE_DIR}"
|
||||||
|
|
||||||
|
cleanup_remote_stage() {
|
||||||
|
ssh -o BatchMode=yes -o ConnectTimeout=5 "${EXEGESIS_HOST}" "rm -rf '${REMOTE_STAGE_DIR}'; if [ -d \"\${HOME}/.cache/rpm-stage\" ]; then rmdir --ignore-fail-on-non-empty \"\${HOME}/.cache/rpm-stage\" || true; fi; if [ -d \"\${HOME}/rpm-stage\" ]; then rmdir --ignore-fail-on-non-empty \"\${HOME}/rpm-stage\" || true; fi" || true
|
||||||
|
}
|
||||||
|
|
||||||
|
echo "[deploy] Transferring ${RPM_NAME} to ${EXEGESIS_HOST}:${REMOTE_RPM_PATH}..."
|
||||||
|
if ! scp "${RPM_FILE}" "${EXEGESIS_HOST}:${REMOTE_RPM_PATH}"; then
|
||||||
|
cleanup_remote_stage
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "[deploy] Installing/upgrading ${RPM_NAME} on ${EXEGESIS_HOST}..."
|
||||||
|
INSTALL_CMD="rc=0; sudo rpm -Uvh --replacepkgs '${REMOTE_RPM_PATH}' || rc=\$?; rm -rf '${REMOTE_STAGE_DIR}'; if [ -d \"\${HOME}/.cache/rpm-stage\" ]; then rmdir --ignore-fail-on-non-empty \"\${HOME}/.cache/rpm-stage\" || true; fi; if [ -d \"\${HOME}/rpm-stage\" ]; then rmdir --ignore-fail-on-non-empty \"\${HOME}/rpm-stage\" || true; fi; exit \${rc}"
|
||||||
|
if [[ -t 0 ]]; then
|
||||||
|
ssh -t "${EXEGESIS_HOST}" "${INSTALL_CMD}"
|
||||||
|
else
|
||||||
|
ssh "${EXEGESIS_HOST}" "${INSTALL_CMD}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "[deploy] Running in-situ dry-run verification on ${EXEGESIS_HOST}..."
|
||||||
|
ssh "${EXEGESIS_HOST}" "/usr/bin/ingglish-exegesis-push --dry-run"
|
||||||
|
echo "[OK] Verified in-situ execution of /usr/bin/ingglish-exegesis-push --dry-run on ${EXEGESIS_HOST}."
|
||||||
|
echo "[rollback] To reverse this installation on ${EXEGESIS_HOST}, run: ssh ${EXEGESIS_HOST} sudo rpm -e ingglish-isopsephic-exegesis"
|
||||||
|
fi
|
||||||
@@ -69,6 +69,24 @@ for arg in "$@"; do
|
|||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
|
if [[ "${WINDOW_MODE}" == "auto" ]]; then
|
||||||
|
UTC_HOUR="$(date -u +%H)"
|
||||||
|
case "${UTC_HOUR}" in
|
||||||
|
13|14|15)
|
||||||
|
WINDOW_MODE="us-pre-market-open"
|
||||||
|
;;
|
||||||
|
21|22|23)
|
||||||
|
WINDOW_MODE="us-closing-bell"
|
||||||
|
;;
|
||||||
|
00|01|02)
|
||||||
|
WINDOW_MODE="utc-rollover"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
WINDOW_MODE="us-closing-bell"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
|
||||||
LOCK_FILE="${HYPERSTITION_HARVEST_LOCK:-/tmp/hyperstition-vps-harvest.lock}"
|
LOCK_FILE="${HYPERSTITION_HARVEST_LOCK:-/tmp/hyperstition-vps-harvest.lock}"
|
||||||
if [[ -n "$(type -P flock || true)" ]]; then
|
if [[ -n "$(type -P flock || true)" ]]; then
|
||||||
exec 9>"${LOCK_FILE}"
|
exec 9>"${LOCK_FILE}"
|
||||||
@@ -90,9 +108,9 @@ if [[ "${PUSH_ONLY}" -eq 0 ]]; then
|
|||||||
run_checked "hs-macro-harvest (live FRED CSV)" "${PYTHON_BIN}" -m hyperstitionstud_io.quant.macro
|
run_checked "hs-macro-harvest (live FRED CSV)" "${PYTHON_BIN}" -m hyperstitionstud_io.quant.macro
|
||||||
fi
|
fi
|
||||||
if [[ "${WINDOW_MODE}" == "utc-rollover" ]] && [[ -f "${REPOS_ROOT}/ingglish-hyperdope-gematria/ingglish-aq-archive/scripts/ci_provision_ingglish.py" ]]; then
|
if [[ "${WINDOW_MODE}" == "utc-rollover" ]] && [[ -f "${REPOS_ROOT}/ingglish-hyperdope-gematria/ingglish-aq-archive/scripts/ci_provision_ingglish.py" ]]; then
|
||||||
CI_OUT_DIR="${REPOS_ROOT}/ingglish-hyperdope-ci"
|
|
||||||
if [[ ! -d "${CI_OUT_DIR}" ]] && [[ -d "${REPOS_ROOT}/hyperdope-ci-build" ]]; then
|
|
||||||
CI_OUT_DIR="${REPOS_ROOT}/hyperdope-ci-build"
|
CI_OUT_DIR="${REPOS_ROOT}/hyperdope-ci-build"
|
||||||
|
if [[ ! -d "${CI_OUT_DIR}" ]] && [[ -d "${REPOS_ROOT}/ingglish-hyperdope-ci" ]]; then
|
||||||
|
CI_OUT_DIR="${REPOS_ROOT}/ingglish-hyperdope-ci"
|
||||||
fi
|
fi
|
||||||
if [[ -d "${CI_OUT_DIR}" ]]; then
|
if [[ -d "${CI_OUT_DIR}" ]]; then
|
||||||
run_checked "ci_provision_ingglish.py (--tier 2)" "${PYTHON_BIN}" "${REPOS_ROOT}/ingglish-hyperdope-gematria/ingglish-aq-archive/scripts/ci_provision_ingglish.py" \
|
run_checked "ci_provision_ingglish.py (--tier 2)" "${PYTHON_BIN}" "${REPOS_ROOT}/ingglish-hyperdope-gematria/ingglish-aq-archive/scripts/ci_provision_ingglish.py" \
|
||||||
@@ -102,7 +120,7 @@ if [[ "${PUSH_ONLY}" -eq 0 ]]; then
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
run_checked "quant.timeseries" "${PYTHON_BIN}" -m hyperstitionstud_io.quant.timeseries
|
run_checked "quant.timeseries" "${PYTHON_BIN}" -m hyperstitionstud_io.quant.timeseries
|
||||||
run_checked "hs-daily-brief" "${PYTHON_BIN}" -m hyperstitionstud_io.quant.daily_brief
|
run_checked "hs-daily-brief" "${PYTHON_BIN}" -m hyperstitionstud_io.quant.daily_brief --window "${WINDOW_MODE}"
|
||||||
run_checked "build_encyclopedia_knowledge_graph.py" "${PYTHON_BIN}" "${REPOS_ROOT}/encyclopedia-knowledge-graph/scripts/build_encyclopedia_knowledge_graph.py" --verify-only
|
run_checked "build_encyclopedia_knowledge_graph.py" "${PYTHON_BIN}" "${REPOS_ROOT}/encyclopedia-knowledge-graph/scripts/build_encyclopedia_knowledge_graph.py" --verify-only
|
||||||
|
|
||||||
echo "[2/5] Running Stage 3 transactional verification gates (hs-doctor, ReadOnlyIsolationGuard, test_core_suite)..."
|
echo "[2/5] Running Stage 3 transactional verification gates (hs-doctor, ReadOnlyIsolationGuard, test_core_suite)..."
|
||||||
|
|||||||
@@ -95,10 +95,10 @@ if [[ -f "${REPOS_ROOT}/workspace.toml" ]]; then
|
|||||||
export HYPERSTITIONSTUDIO_CONFIG="${REPOS_ROOT}/workspace.toml"
|
export HYPERSTITIONSTUDIO_CONFIG="${REPOS_ROOT}/workspace.toml"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Detect whether the CI artifact repository is cloned as ingglish-hyperdope-ci or hyperdope-ci-build
|
# Detect whether the CI artifact repository is cloned as hyperdope-ci-build (canonical) or ingglish-hyperdope-ci
|
||||||
CI_REPO_DIR="ingglish-hyperdope-ci"
|
CI_REPO_DIR="hyperdope-ci-build"
|
||||||
if [[ ! -d "${REPOS_ROOT}/${CI_REPO_DIR}" ]] && [[ -d "${REPOS_ROOT}/hyperdope-ci-build" ]]; then
|
if [[ ! -d "${REPOS_ROOT}/${CI_REPO_DIR}" ]] && [[ -d "${REPOS_ROOT}/ingglish-hyperdope-ci" ]]; then
|
||||||
CI_REPO_DIR="hyperdope-ci-build"
|
CI_REPO_DIR="ingglish-hyperdope-ci"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
REPOS=(
|
REPOS=(
|
||||||
@@ -248,8 +248,10 @@ for entry in "${REPOS[@]}"; do
|
|||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
if [[ "${CI_REPO_DIR}" == "hyperdope-ci-build" ]] && [[ -d "${LIVE_REPOS}/hyperdope-ci-build" ]] && [[ ! -e "${LIVE_REPOS}/ingglish-hyperdope-ci" ]]; then
|
if [[ "${CI_REPO_DIR}" == "hyperdope-ci-build" ]] && [[ -d "${LIVE_REPOS}/hyperdope-ci-build" ]]; then
|
||||||
${LIVE_SUDO} ln -sfn "hyperdope-ci-build" "${LIVE_REPOS}/ingglish-hyperdope-ci"
|
${LIVE_SUDO} ln -sfn "hyperdope-ci-build" "${LIVE_REPOS}/ingglish-hyperdope-ci"
|
||||||
|
elif [[ "${CI_REPO_DIR}" == "ingglish-hyperdope-ci" ]] && [[ -d "${LIVE_REPOS}/ingglish-hyperdope-ci" ]]; then
|
||||||
|
${LIVE_SUDO} ln -sfn "ingglish-hyperdope-ci" "${LIVE_REPOS}/hyperdope-ci-build"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Create relative route symlinks inside LIVE_REPOS so both Caddy and standalone HTTP servers resolve all active routes
|
# Create relative route symlinks inside LIVE_REPOS so both Caddy and standalone HTTP servers resolve all active routes
|
||||||
@@ -287,7 +289,7 @@ ${LIVE_SUDO} ln -sfn "technocapital-singularity-zoology/encyclopedia" "${LIVE_RE
|
|||||||
${LIVE_SUDO} ln -sfn "technocapital-singularity-zoology" "${LIVE_REPOS}/zoology"
|
${LIVE_SUDO} ln -sfn "technocapital-singularity-zoology" "${LIVE_REPOS}/zoology"
|
||||||
${LIVE_SUDO} ln -sfn "ingglish-hyperdope-gematria/ingglish-aq-archive" "${LIVE_REPOS}/archive"
|
${LIVE_SUDO} ln -sfn "ingglish-hyperdope-gematria/ingglish-aq-archive" "${LIVE_REPOS}/archive"
|
||||||
${LIVE_SUDO} ln -sfn "haiperdohp-jemaytreeah" "${LIVE_REPOS}/calc"
|
${LIVE_SUDO} ln -sfn "haiperdohp-jemaytreeah" "${LIVE_REPOS}/calc"
|
||||||
${LIVE_SUDO} ln -sfn "ingglish-hyperdope-ci" "${LIVE_REPOS}/ci"
|
${LIVE_SUDO} ln -sfn "${CI_REPO_DIR}" "${LIVE_REPOS}/ci"
|
||||||
${LIVE_SUDO} ln -sfn "hyperstitionstudio-core/schemas" "${LIVE_REPOS}/schemas"
|
${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) incrementally in parallel & enforcing single-layer (1x) compression..."
|
echo "[4/5] Pre-compressing static HTML, JS, JSON, XML, Canvas, MD & CSS assets (< 5 MB) (.br / .gz) incrementally in parallel & enforcing single-layer (1x) compression..."
|
||||||
|
|||||||
@@ -0,0 +1,136 @@
|
|||||||
|
# Global Plan Specification, Operational Governance & Flexibility Standard
|
||||||
|
|
||||||
|
**Document ID:** `PLAN-SPECIFICATION-AND-GOVERNANCE-STANDARD`
|
||||||
|
**Plan Reference:** `PLAN-QUANT-PRE-MARKET-OPEN-DAILY-BRIEF-AND-REGIME-CADENCE` (`Plan #72`)
|
||||||
|
**Scope:** Architectural planning, technical project management, release lifecycle governance, and operational execution across all 6 `hyperstitionstud.io` repositories.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 1. Purpose & Foundational Invariants
|
||||||
|
|
||||||
|
This standard formalizes the operational and architectural planning methodology across the `hyperstitionstud.io` ecosystem to ensure that all project management deliverables are legible, understandable, and comprehensively sound.
|
||||||
|
|
||||||
|
### Core Invariants
|
||||||
|
1. **Strict Planning vs. Implementation Boundary:** When asked to plan, the deliverable is strictly the architectural planning artifact (`.md` and compiled Dark-Mode ReportLab `.pdf` under `docs/plans/active/` or `docs/plans/piecewise/`, plus `references/roadmap-plan-ledger.md`), never unverified production code, partial stubs, or uncommitted working tree mutations.
|
||||||
|
2. **First-Resort Infrastructure Audit:** Existing automation infrastructure (systemd timers, cron rules, collector modules, cache tables) must be evaluated and prioritized before proposing net-new services or files. Creating new services or cron files is strictly a last resort.
|
||||||
|
3. **Comprehensive Lifecycle Scope:** Every plan must address end-to-end downstream impacts: data pipeline integrity, state archiving, single-layer (1x) compression, git repository commit cadence, and deployment script readiness (`DEPLOY-GATE-D01.MIRROR_PARITY` through `DEPLOY-GATE-D08.PRE_COMMIT_STAGE`).
|
||||||
|
4. **Disambiguated Prose & Comments:** All shorthand references in prose and comments must comply with `<PREFIX><NN>.<DOMAIN_TAG>` (e.g., `PANEL-P06.DAILY_BRIEF`, `REGIME-R01.BULL_RISK_ON`), while executable code remains globally exempt.
|
||||||
|
5. **Dual-Artifact Delivery:** Every active or piecewise plan is authored as version-controlled Markdown and immediately compiled to an offline-accessible Dark-Mode PDF via `hs-pdf-build`.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 2. Three-Tier Flexibility Protocol ("Strict by Default, Flexible on Demand")
|
||||||
|
|
||||||
|
To provide institutional rigor without creating bureaucratic bottlenecks during rapid prototyping or ad-hoc analysis, planning follows a 3-tier flexibility protocol:
|
||||||
|
|
||||||
|
```
|
||||||
|
Planning Tier Selection Model
|
||||||
|
+----------------------------------------------------------------------------------------------------+
|
||||||
|
| Tier 1: Standard Production Architectural Plan [DEFAULT] |
|
||||||
|
| Trigger: "plan to ...", "architect ...", or standard feature/release requests |
|
||||||
|
| Scope: Full 8-section specification, Dark-Mode PDF, ledger entry, VPS audit, gates, rollout |
|
||||||
|
| Target: docs/plans/active/PLAN-<SLUG>.{md,pdf} or docs/plans/piecewise/PLAN-<SLUG>.{md,pdf} |
|
||||||
|
+----------------------------------------------------------------------------------------------------+
|
||||||
|
|
|
||||||
|
(If explicitly requested)
|
||||||
|
v
|
||||||
|
+----------------------------------------------------------------------------------------------------+
|
||||||
|
| Tier 2: Lightweight Tactical Memo [EXPLICIT OVERRIDE] |
|
||||||
|
| Trigger: "lightweight plan", "brief plan", "memo: ...", "draft outline only" |
|
||||||
|
| Scope: Focused 1–2 page technical delta, core trade-offs, and verification commands |
|
||||||
|
| Skips: Full VPS infrastructure audit, compression analysis, PDF compilation (unless requested) |
|
||||||
|
| Target: docs/plans/active/PLAN-<SLUG>.md or inline CLI delivery |
|
||||||
|
+----------------------------------------------------------------------------------------------------+
|
||||||
|
|
|
||||||
|
(If explicitly requested)
|
||||||
|
v
|
||||||
|
+----------------------------------------------------------------------------------------------------+
|
||||||
|
| Tier 3: Exploratory Scratchpad / Spike [EXPLICIT OVERRIDE] |
|
||||||
|
| Trigger: "spike:", "scratchpad:", "throwaway spike:", "ad-hoc exploration:" |
|
||||||
|
| Scope: Unformatted notes, quick spikes, throwaway experiment scripts |
|
||||||
|
| Invariants: Written strictly to /workspace/untracked/; 0 ledger entries; 0 git commits |
|
||||||
|
+----------------------------------------------------------------------------------------------------+
|
||||||
|
```
|
||||||
|
|
||||||
|
### Protocol Rules
|
||||||
|
- **Default Behavior:** The agent always operates at **Tier 1** unless an explicit prompt marker matches Tier 2 or Tier 3.
|
||||||
|
- **Override Handling:** When an override is requested, the agent acknowledges the lighter tier in a single line (e.g., `[Tier 2 Lightweight Memo requested; skipping PDF compilation and VPS scheduling audit]`) and proceeds immediately with the focused delta.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 3. Mandatory Sections for Tier 1 Production Architectural Plans
|
||||||
|
|
||||||
|
Tier 1 Production Plans must contain the following standard sections:
|
||||||
|
|
||||||
|
### 1. Document Metadata & Header
|
||||||
|
- Document ID: `PLAN-<TOPIC-SLUG>`
|
||||||
|
- Status: `ACTIVE (docs/plans/active/)` or `PIECEWISE (docs/plans/piecewise/)`
|
||||||
|
- Target Ecosystem Version: `vX.Y.Z` (with baseline)
|
||||||
|
- Target Repositories: Specific repository slugs
|
||||||
|
- Target Surfaces: Affected web routes, CLI tools, or background timers
|
||||||
|
- Web Route: Canonical public HTTPS URL for the compiled companion PDF
|
||||||
|
- Author & Date
|
||||||
|
|
||||||
|
### 2. Operational Objective & Motivation
|
||||||
|
- Plain-statement summary of the deliverable.
|
||||||
|
- Domain motivation and measurable delta (e.g., information asymmetry advantage, memory reduction, latency bounds).
|
||||||
|
|
||||||
|
### 3. Existing Infrastructure Audit & Scheduling Hierarchy
|
||||||
|
- Exhaustive audit of all existing automation surfaces (timers, cron, modules).
|
||||||
|
- Explicit 3-stage candidate hierarchy:
|
||||||
|
- **Strategy A (First Resort):** Maximally reuses existing units (e.g., multi-calendar systemd timer).
|
||||||
|
- **Strategy B (Second Resort):** Reuses existing files (e.g., cron multiplexing).
|
||||||
|
- **Strategy C (Strict Last Resort):** Dedicated net-new services/files, evaluated only if A and B are blocked.
|
||||||
|
|
||||||
|
### 4. Data Pipeline Integrity & Transactional Rollback Safety
|
||||||
|
- End-to-end data flow: Harvesters -> Compilers -> Verification -> RAM Hydration -> Push.
|
||||||
|
- Zero-synthetic-data compliance (`PLAN-GATE-G01.EXTANT_DATA`).
|
||||||
|
- Transactional rollback on verification failure (`git checkout -- .` without touching tmpfs).
|
||||||
|
|
||||||
|
### 5. Archiving & Historical Ledger Evolution
|
||||||
|
- Ledger format, storage path, and schema definition.
|
||||||
|
- Deduplication semantics and session-window discrimination (`session_window`).
|
||||||
|
- Retention window capacity and quiescent SQLite compaction (`sqlite_meta.py --compress-archive`).
|
||||||
|
|
||||||
|
### 6. Compression Standards & Optimization Guarantees
|
||||||
|
- Single-Layer (1x) Compression Invariant (`PLAN-SINGLE-LAYER-COMPRESSION-ENFORCEMENT-AND-MULTI-COMPRESSED-FILE-REMEDIATION`).
|
||||||
|
- Webroot pre-compression (`.gz` via `gzip -9` and `.br` via `brotli -q 11`).
|
||||||
|
- Server-side bundle size caps (`--max-bundle-kb 256`).
|
||||||
|
|
||||||
|
### 7. Git Repository Commit Cadence & Telemetry Reconciliation
|
||||||
|
- Automated commit frequency and commit message templates (`chore(telemetry): ...`).
|
||||||
|
- Gating: commits occur strictly when `git diff --cached` detects substantive changes.
|
||||||
|
- Lossless telemetry reconciliation (`DEPLOY-GATE-D04.LOSSLESS_TELEMETRY` via `--snapshot-telemetry` and `--reconcile-telemetry`).
|
||||||
|
|
||||||
|
### 8. Stepwise Verification Gates & Acceptance Criteria
|
||||||
|
- Tabulated binary verification gates with explicit command-line invocations.
|
||||||
|
|
||||||
|
### 9. Implementation Rollout Sequence
|
||||||
|
- Phased, non-breaking rollout steps.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 4. 5-Tier Plan Classification & Lifecycle Hierarchy
|
||||||
|
|
||||||
|
Plans reside in designated filesystem locations under `encyclopedia-knowledge-graph/docs/plans/`:
|
||||||
|
|
||||||
|
| Tier | Classification | Filesystem Directory | PDF Compilation Policy |
|
||||||
|
| :--- | :--- | :--- | :--- |
|
||||||
|
| **Tier 1** | Active Non-Piecewise | `docs/plans/active/` | Mandatory Dark-Mode `.pdf` |
|
||||||
|
| **Tier 2** | Fully Affirmed Piecewise | `docs/plans/piecewise/` | Mandatory Dark-Mode `.pdf` |
|
||||||
|
| **Tier 3** | Partially Affirmed Piecewise | `docs/plans/piecewise/` | Mandatory Dark-Mode `.pdf` |
|
||||||
|
| **Tier 4** | Pending Audit Piecewise | `docs/plans/piecewise/` | Mandatory Dark-Mode `.pdf` |
|
||||||
|
| **Tier 5.1** | Retained Inactive / Deferred | `docs/plans/inactive/` | Zero PDF compilation/recompilation |
|
||||||
|
| **Tier 5.2** | Cold-Archived Inactive | `docs/plans/inactive/inactive-plans-archive.tar.gz` | Zero PDF; manifests record SHA-256 |
|
||||||
|
| **Tier 5.3** | Cold-Archived Completed | `docs/archive/completed-plans-archive.tar.gz` | `.md`-only tarball; manifest records SHA-256 |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 5. Automated Plan Verification (`hs-plan-lint`)
|
||||||
|
|
||||||
|
The plan specification validator (`hyperstitionstud_io.ci.plan_validator`) enforces:
|
||||||
|
1. Every `.md` in `docs/plans/active/` and `docs/plans/piecewise/` has a matching `.pdf` in the same directory.
|
||||||
|
2. Every active and piecewise plan has an entry in `references/roadmap-plan-ledger.md`.
|
||||||
|
3. All mandatory metadata fields (`Document ID:`, `Status:`, `Target Ecosystem Version:`, `Target Repositories:`) are present.
|
||||||
|
4. Shorthands comply with `hs-shorthand-lint`.
|
||||||
|
5. No bare container host paths are serialized.
|
||||||
@@ -24,7 +24,7 @@ import time
|
|||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import Any, Iterable
|
from typing import Any, Iterable
|
||||||
|
|
||||||
from hyperstitionstud_io.config import load_workspace_config
|
from hyperstitionstud_io.config import load_json_cached, load_workspace_config
|
||||||
|
|
||||||
SCHEMA_VERSION = 1
|
SCHEMA_VERSION = 1
|
||||||
|
|
||||||
@@ -100,7 +100,7 @@ def load_ledger(path: Path) -> dict[str, Any]:
|
|||||||
if not path.exists():
|
if not path.exists():
|
||||||
return {"version": SCHEMA_VERSION, "sources": []}
|
return {"version": SCHEMA_VERSION, "sources": []}
|
||||||
try:
|
try:
|
||||||
data = json.loads(path.read_text(encoding="utf-8"))
|
data = load_json_cached(path, copy_result=True)
|
||||||
except (json.JSONDecodeError, OSError) as exc:
|
except (json.JSONDecodeError, OSError) as exc:
|
||||||
raise SystemExit(f"error: ledger at {path} is unreadable ({exc}); run `reset` to start over")
|
raise SystemExit(f"error: ledger at {path} is unreadable ({exc}); run `reset` to start over")
|
||||||
if not isinstance(data, dict) or not isinstance(data.get("sources"), list):
|
if not isinstance(data, dict) or not isinstance(data.get("sources"), list):
|
||||||
|
|||||||
@@ -20,16 +20,29 @@ from pathlib import Path
|
|||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
from hyperstitionstud_io import __version__ as CURRENT_VERSION
|
from hyperstitionstud_io import __version__ as CURRENT_VERSION
|
||||||
from hyperstitionstud_io.config import load_workspace_config
|
from hyperstitionstud_io.config import load_workspace_config, normalize_workspace_relpath
|
||||||
|
|
||||||
|
|
||||||
def _norm_ws_path(p: Path | str, workspace_root: str | Path | None = None) -> str:
|
FORBIDDEN_CONFLICT_SIDE_RE = re.compile(r"(?:^|\s)(?:--theirs|--ours|-X\s*(?:theirs|ours))\b")
|
||||||
cfg = load_workspace_config(workspace_root=workspace_root)
|
FORBIDDEN_UNCHECKED_REBASE_RE = re.compile(r"pull\s+--rebase[^\n]*\|\|\s*true")
|
||||||
ws_res = str(cfg.workspace_root.resolve())
|
|
||||||
s = str(Path(p).resolve())
|
|
||||||
if s.startswith(ws_res):
|
def validate_push_script_rebase_gating(push_txt: str) -> list[str]:
|
||||||
return "/workspace" + s[len(ws_res):]
|
"""
|
||||||
return str(p)
|
Gate DEPLOY-GATE-D07.TOPO_PUSH_PARITY: Reject conflict-side resolution flags
|
||||||
|
(--theirs, --ours, -X theirs, -X ours) and unchecked pull --rebase ... || true
|
||||||
|
suppressions in push-all-to-git-libre-audio.sh.
|
||||||
|
"""
|
||||||
|
violations: list[str] = []
|
||||||
|
for m_flag in FORBIDDEN_CONFLICT_SIDE_RE.finditer(push_txt):
|
||||||
|
violations.append(
|
||||||
|
f"Gate DEPLOY-GATE-D07.TOPO_PUSH_PARITY: Forbidden conflict-side flag {m_flag.group(0).strip()!r} in push-all-to-git-libre-audio.sh"
|
||||||
|
)
|
||||||
|
for m_reb in FORBIDDEN_UNCHECKED_REBASE_RE.finditer(push_txt):
|
||||||
|
violations.append(
|
||||||
|
f"Gate DEPLOY-GATE-D07.TOPO_PUSH_PARITY: Forbidden unchecked rebase suppression {m_reb.group(0)!r} in push-all-to-git-libre-audio.sh"
|
||||||
|
)
|
||||||
|
return violations
|
||||||
|
|
||||||
|
|
||||||
def prepare_and_verify_deploy_scripts(
|
def prepare_and_verify_deploy_scripts(
|
||||||
@@ -68,7 +81,7 @@ def prepare_and_verify_deploy_scripts(
|
|||||||
else:
|
else:
|
||||||
ws_push_sh.write_text(upd_push, encoding="utf-8")
|
ws_push_sh.write_text(upd_push, encoding="utf-8")
|
||||||
ws_push_sh.chmod(0o755)
|
ws_push_sh.chmod(0o755)
|
||||||
modified_files.append(_norm_ws_path(ws_push_sh, workspace_root=ws_root))
|
modified_files.append(normalize_workspace_relpath(ws_push_sh, workspace_root=ws_root))
|
||||||
push_txt = upd_push
|
push_txt = upd_push
|
||||||
|
|
||||||
tracked_txt = tracked_push_sh.read_text(encoding="utf-8") if tracked_push_sh.is_file() else ""
|
tracked_txt = tracked_push_sh.read_text(encoding="utf-8") if tracked_push_sh.is_file() else ""
|
||||||
@@ -79,7 +92,7 @@ def prepare_and_verify_deploy_scripts(
|
|||||||
tracked_push_sh.parent.mkdir(parents=True, exist_ok=True)
|
tracked_push_sh.parent.mkdir(parents=True, exist_ok=True)
|
||||||
tracked_push_sh.write_text(push_txt, encoding="utf-8")
|
tracked_push_sh.write_text(push_txt, encoding="utf-8")
|
||||||
tracked_push_sh.chmod(0o755)
|
tracked_push_sh.chmod(0o755)
|
||||||
modified_files.append(_norm_ws_path(tracked_push_sh, workspace_root=ws_root))
|
modified_files.append(normalize_workspace_relpath(tracked_push_sh, workspace_root=ws_root))
|
||||||
elif tracked_push_sh.is_file():
|
elif tracked_push_sh.is_file():
|
||||||
push_txt = tracked_push_sh.read_text(encoding="utf-8")
|
push_txt = tracked_push_sh.read_text(encoding="utf-8")
|
||||||
upd_push = re.sub(r"^#\s*Release\s+v\d+\.\d+\.\d+:", f"# Release v{ver}:", push_txt, count=1, flags=re.M)
|
upd_push = re.sub(r"^#\s*Release\s+v\d+\.\d+\.\d+:", f"# Release v{ver}:", push_txt, count=1, flags=re.M)
|
||||||
@@ -89,7 +102,7 @@ def prepare_and_verify_deploy_scripts(
|
|||||||
else:
|
else:
|
||||||
tracked_push_sh.write_text(upd_push, encoding="utf-8")
|
tracked_push_sh.write_text(upd_push, encoding="utf-8")
|
||||||
tracked_push_sh.chmod(0o755)
|
tracked_push_sh.chmod(0o755)
|
||||||
modified_files.append(_norm_ws_path(tracked_push_sh, workspace_root=ws_root))
|
modified_files.append(normalize_workspace_relpath(tracked_push_sh, workspace_root=ws_root))
|
||||||
push_txt = upd_push
|
push_txt = upd_push
|
||||||
if not check_only:
|
if not check_only:
|
||||||
try:
|
try:
|
||||||
@@ -116,7 +129,7 @@ def prepare_and_verify_deploy_scripts(
|
|||||||
else:
|
else:
|
||||||
sync_vps_sh.write_text(upd_sync, encoding="utf-8")
|
sync_vps_sh.write_text(upd_sync, encoding="utf-8")
|
||||||
sync_vps_sh.chmod(0o755)
|
sync_vps_sh.chmod(0o755)
|
||||||
modified_files.append(_norm_ws_path(sync_vps_sh, workspace_root=ws_root))
|
modified_files.append(normalize_workspace_relpath(sync_vps_sh, workspace_root=ws_root))
|
||||||
sync_txt = upd_sync
|
sync_txt = upd_sync
|
||||||
else:
|
else:
|
||||||
errors.append(f"Gate D1: Missing {sync_vps_sh}")
|
errors.append(f"Gate D1: Missing {sync_vps_sh}")
|
||||||
@@ -203,7 +216,7 @@ def prepare_and_verify_deploy_scripts(
|
|||||||
if not gate_d6_ok:
|
if not gate_d6_ok:
|
||||||
errors.append("Gate D6: Single-layer compression enforcement or Caddyfile media extension parity missing")
|
errors.append("Gate D6: Single-layer compression enforcement or Caddyfile media extension parity missing")
|
||||||
|
|
||||||
# Gate DEPLOY-GATE-D07.TOPO_PUSH_PARITY: Topological 6-Repository Push & Force-Tag Sync Parity in push-all-to-git-libre-audio.sh
|
# Gate DEPLOY-GATE-D07.TOPO_PUSH_PARITY: Topological 6-Repository Push, Force-Tag Sync & Fail-Fast Rebase Parity in push-all-to-git-libre-audio.sh
|
||||||
required_push_markers = (
|
required_push_markers = (
|
||||||
"hyperstitionstudio-core",
|
"hyperstitionstudio-core",
|
||||||
"ingglish-hyperdope-gematria",
|
"ingglish-hyperdope-gematria",
|
||||||
@@ -214,10 +227,15 @@ def prepare_and_verify_deploy_scripts(
|
|||||||
'push --force "${remote_name}" "refs/tags/${head_tag}"',
|
'push --force "${remote_name}" "refs/tags/${head_tag}"',
|
||||||
"build-fedora41-rpm.sh",
|
"build-fedora41-rpm.sh",
|
||||||
"run_exegesis_and_push_fedora41.sh",
|
"run_exegesis_and_push_fedora41.sh",
|
||||||
|
"--exegesis-host",
|
||||||
|
"--exegesis-uninstall",
|
||||||
|
"--skip-exegesis-deploy",
|
||||||
)
|
)
|
||||||
gate_d7_ok = all(m in push_txt_cur for m in required_push_markers)
|
d7_rebase_violations = validate_push_script_rebase_gating(push_txt_cur)
|
||||||
if not gate_d7_ok:
|
gate_d7_ok = all(m in push_txt_cur for m in required_push_markers) and len(d7_rebase_violations) == 0
|
||||||
errors.append("Gate D7: Missing required repository, force-tag, or verification marker in push-all-to-git-libre-audio.sh")
|
if not all(m in push_txt_cur for m in required_push_markers):
|
||||||
|
errors.append("Gate DEPLOY-GATE-D07.TOPO_PUSH_PARITY: Missing required repository, force-tag, or verification marker in push-all-to-git-libre-audio.sh")
|
||||||
|
errors.extend(d7_rebase_violations)
|
||||||
|
|
||||||
# Gate DEPLOY-GATE-D08.PRE_COMMIT_STAGE: Automatic Git Staging Prior to Commit (--stage)
|
# Gate DEPLOY-GATE-D08.PRE_COMMIT_STAGE: Automatic Git Staging Prior to Commit (--stage)
|
||||||
staged_files: list[str] = []
|
staged_files: list[str] = []
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import json
|
|||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
from hyperstitionstud_io.config import load_workspace_config
|
from hyperstitionstud_io.config import load_json_cached, load_workspace_config
|
||||||
from hyperstitionstud_io.glossary import sha256_file
|
from hyperstitionstud_io.glossary import sha256_file
|
||||||
from hyperstitionstud_io.publishing.fonts import resolve_font_path
|
from hyperstitionstud_io.publishing.fonts import resolve_font_path
|
||||||
|
|
||||||
@@ -55,7 +55,7 @@ def run_diagnostics(workspace_root: str | Path | None = None) -> dict[str, Any]:
|
|||||||
}
|
}
|
||||||
|
|
||||||
fb_path = Path(__file__).resolve().parent.parent / "phonetics" / "cmudict_fallback.json"
|
fb_path = Path(__file__).resolve().parent.parent / "phonetics" / "cmudict_fallback.json"
|
||||||
fb_count = len(json.loads(fb_path.read_text(encoding="utf-8"))) if fb_path.is_file() else 0
|
fb_count = len(load_json_cached(fb_path, copy_result=False)) if fb_path.is_file() else 0
|
||||||
|
|
||||||
lr_path = cfg.core_dir / "deploy" / "logrotate.d" / "hyperstition-sqlite-meta"
|
lr_path = cfg.core_dir / "deploy" / "logrotate.d" / "hyperstition-sqlite-meta"
|
||||||
lr_txt = lr_path.read_text(encoding="utf-8") if lr_path.is_file() else ""
|
lr_txt = lr_path.read_text(encoding="utf-8") if lr_path.is_file() else ""
|
||||||
|
|||||||
@@ -0,0 +1,125 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
"""
|
||||||
|
src/hyperstitionstud_io/ci/plan_validator.py
|
||||||
|
Plan Specification & Governance Validator (`hs-plan-lint`).
|
||||||
|
Enforces PLAN-SPECIFICATION-AND-GOVERNANCE-STANDARD across docs/plans/{active,piecewise}/:
|
||||||
|
1. Mandatory companion ReportLab Dark-Mode PDF (.pdf) for every active/piecewise Markdown plan (.md).
|
||||||
|
2. Required metadata fields (Document ID, Status, Target Ecosystem Version, Target Repositories).
|
||||||
|
3. Registration in roadmap-plan-ledger.md.
|
||||||
|
4. Zero container host path serialization.
|
||||||
|
5. Shorthand disambiguation compliance (<PREFIX><NN>.<DOMAIN_TAG>).
|
||||||
|
"""
|
||||||
|
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
|
import argparse
|
||||||
|
import json
|
||||||
|
import re
|
||||||
|
import sys
|
||||||
|
from pathlib import Path
|
||||||
|
from typing import Any
|
||||||
|
|
||||||
|
from hyperstitionstud_io.config import load_workspace_config
|
||||||
|
|
||||||
|
REQUIRED_METADATA_KEYS = [
|
||||||
|
"Document ID",
|
||||||
|
"Status",
|
||||||
|
"Target Ecosystem Version",
|
||||||
|
"Target Repositories",
|
||||||
|
]
|
||||||
|
|
||||||
|
CONTAINER_HOST_PATH_PATTERNS = [
|
||||||
|
re.compile(r"/home/[a-zA-Z0-9_-]+/\.hermes"),
|
||||||
|
re.compile(r"/var/lib/docker"),
|
||||||
|
re.compile(r"/tmp/docker"),
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
def verify_plan_specifications(workspace_root: str | Path | None = None) -> dict[str, Any]:
|
||||||
|
cfg = load_workspace_config(workspace_root=workspace_root)
|
||||||
|
plans_dir = cfg.knowledge_graph_dir / "docs" / "plans"
|
||||||
|
active_dir = plans_dir / "active"
|
||||||
|
piecewise_dir = plans_dir / "piecewise"
|
||||||
|
|
||||||
|
active_mds = sorted([p for p in active_dir.glob("PLAN-*.md") if p.is_file()])
|
||||||
|
piecewise_mds = sorted([p for p in piecewise_dir.glob("PLAN-*.md") if p.is_file()])
|
||||||
|
all_target_mds = active_mds + piecewise_mds
|
||||||
|
|
||||||
|
ledger_candidates = [
|
||||||
|
Path.home() / ".hermes" / "skills" / "software-development" / "hyperstitionstudio-roadmap-and-release" / "references" / "roadmap-plan-ledger.md",
|
||||||
|
Path("/root/.hermes/skills/software-development/hyperstitionstudio-roadmap-and-release/references/roadmap-plan-ledger.md"),
|
||||||
|
]
|
||||||
|
ledger_text = ""
|
||||||
|
for lc in ledger_candidates:
|
||||||
|
if lc.is_file():
|
||||||
|
ledger_text = lc.read_text(encoding="utf-8")
|
||||||
|
break
|
||||||
|
|
||||||
|
missing_pdfs: list[str] = []
|
||||||
|
missing_ledger_entries: list[str] = []
|
||||||
|
metadata_errors: list[dict[str, Any]] = []
|
||||||
|
host_path_errors: list[dict[str, Any]] = []
|
||||||
|
errors: list[str] = []
|
||||||
|
|
||||||
|
for md_p in all_target_mds:
|
||||||
|
rel_p = md_p.relative_to(cfg.workspace_root).as_posix()
|
||||||
|
pdf_p = md_p.with_suffix(".pdf")
|
||||||
|
if not pdf_p.is_file():
|
||||||
|
missing_pdfs.append(rel_p)
|
||||||
|
|
||||||
|
txt = md_p.read_text(encoding="utf-8")
|
||||||
|
|
||||||
|
# Check metadata fields
|
||||||
|
missing_keys = []
|
||||||
|
for key in REQUIRED_METADATA_KEYS:
|
||||||
|
if not re.search(rf"\*\*{re.escape(key)}:\*\*", txt):
|
||||||
|
missing_keys.append(key)
|
||||||
|
if missing_keys:
|
||||||
|
metadata_errors.append({"file": rel_p, "missing_keys": missing_keys})
|
||||||
|
|
||||||
|
# Check host path leakage
|
||||||
|
for pat in CONTAINER_HOST_PATH_PATTERNS:
|
||||||
|
m = pat.search(txt)
|
||||||
|
if m:
|
||||||
|
host_path_errors.append({"file": rel_p, "leakage": m.group(0)})
|
||||||
|
|
||||||
|
# Check ledger presence if ledger is found
|
||||||
|
if ledger_text:
|
||||||
|
plan_stem = md_p.stem
|
||||||
|
if plan_stem not in ledger_text:
|
||||||
|
missing_ledger_entries.append(plan_stem)
|
||||||
|
|
||||||
|
if missing_pdfs:
|
||||||
|
errors.append(f"Missing companion Dark-Mode PDFs for: {', '.join(missing_pdfs)}")
|
||||||
|
if metadata_errors:
|
||||||
|
errors.append(f"Metadata errors: {metadata_errors}")
|
||||||
|
if host_path_errors:
|
||||||
|
errors.append(f"Host path leakage detected: {host_path_errors}")
|
||||||
|
if missing_ledger_entries:
|
||||||
|
errors.append(f"Plans missing from roadmap-plan-ledger.md: {missing_ledger_entries}")
|
||||||
|
|
||||||
|
return {
|
||||||
|
"ok": len(errors) == 0,
|
||||||
|
"active_plans_checked": len(active_mds),
|
||||||
|
"piecewise_plans_checked": len(piecewise_mds),
|
||||||
|
"total_plans_checked": len(all_target_mds),
|
||||||
|
"missing_pdfs": missing_pdfs,
|
||||||
|
"missing_ledger_entries": missing_ledger_entries,
|
||||||
|
"metadata_errors": metadata_errors,
|
||||||
|
"host_path_errors": host_path_errors,
|
||||||
|
"errors": errors,
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
def main(argv: list[str] | None = None) -> int:
|
||||||
|
ap = argparse.ArgumentParser(prog="hs-plan-lint", description="Validate active/piecewise architectural plans against governance standard.")
|
||||||
|
ap.add_argument("--workspace-root", default=None, help="Root directory of hyperstitionstud.io workspace.")
|
||||||
|
args = ap.parse_args(argv)
|
||||||
|
|
||||||
|
res = verify_plan_specifications(workspace_root=args.workspace_root)
|
||||||
|
print(json.dumps(res, indent=2))
|
||||||
|
return 0 if res["ok"] else 1
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
sys.exit(main())
|
||||||
@@ -27,7 +27,7 @@ from pathlib import Path
|
|||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
from hyperstitionstud_io import __version__ as CURRENT_VERSION
|
from hyperstitionstud_io import __version__ as CURRENT_VERSION
|
||||||
from hyperstitionstud_io.config import load_workspace_config
|
from hyperstitionstud_io.config import load_json_cached, load_workspace_config
|
||||||
from hyperstitionstud_io.glossary import sha256_file
|
from hyperstitionstud_io.glossary import sha256_file
|
||||||
from hyperstitionstud_io.ipld import compute_dag_json_cidv1
|
from hyperstitionstud_io.ipld import compute_dag_json_cidv1
|
||||||
from hyperstitionstud_io.mcp.tools import MCP_TOOLS_SCHEMA
|
from hyperstitionstud_io.mcp.tools import MCP_TOOLS_SCHEMA
|
||||||
@@ -60,9 +60,7 @@ def _resolve_web_route_to_disk(route: str, cfg: Any) -> Path:
|
|||||||
core = cfg.core_dir
|
core = cfg.core_dir
|
||||||
zoo = cfg.zoology_dir
|
zoo = cfg.zoology_dir
|
||||||
kg = cfg.knowledge_graph_dir
|
kg = cfg.knowledge_graph_dir
|
||||||
ci = cfg.paths.get("ci_build_dir") or (cfg.workspace_root / "hyperdope-ci-build")
|
ci = cfg.ci_build_dir
|
||||||
if not ci.is_dir() and (cfg.workspace_root / "ingglish-hyperdope-ci").is_dir():
|
|
||||||
ci = cfg.workspace_root / "ingglish-hyperdope-ci"
|
|
||||||
|
|
||||||
if route == "/":
|
if route == "/":
|
||||||
return core / "site" / "index.html"
|
return core / "site" / "index.html"
|
||||||
@@ -93,10 +91,10 @@ def build_internal_test_baseline_snapshot(workspace_root: str | Path | None = No
|
|||||||
brf_p = cfg.core_dir / "site" / "quant" / "daily-brief-latest.json"
|
brf_p = cfg.core_dir / "site" / "quant" / "daily-brief-latest.json"
|
||||||
kg_p = cfg.knowledge_graph_dir / "encyclopedia-graph.json"
|
kg_p = cfg.knowledge_graph_dir / "encyclopedia-graph.json"
|
||||||
|
|
||||||
ts_obj = json.loads(ts_p.read_text(encoding="utf-8"))
|
ts_obj = load_json_cached(ts_p, copy_result=False)
|
||||||
mac_obj = json.loads(mac_p.read_text(encoding="utf-8"))
|
mac_obj = load_json_cached(mac_p, copy_result=False)
|
||||||
brf_obj = json.loads(brf_p.read_text(encoding="utf-8"))
|
brf_obj = load_json_cached(brf_p, copy_result=False)
|
||||||
kg_obj = json.loads(kg_p.read_text(encoding="utf-8"))
|
kg_obj = load_json_cached(kg_p, copy_result=False)
|
||||||
|
|
||||||
nvda_inst = next(i for i in ts_obj["instruments"] if i["symbol"] == "NVDA")
|
nvda_inst = next(i for i in ts_obj["instruments"] if i["symbol"] == "NVDA")
|
||||||
nvda_nov27 = next(b for b in nvda_inst["bars"] if b["date_utc"] == "2026-11-27")
|
nvda_nov27 = next(b for b in nvda_inst["bars"] if b["date_utc"] == "2026-11-27")
|
||||||
@@ -206,7 +204,7 @@ def run_public_regression_suite(
|
|||||||
|
|
||||||
bp = Path(baseline_path) if baseline_path else get_default_baseline_cache_path()
|
bp = Path(baseline_path) if baseline_path else get_default_baseline_cache_path()
|
||||||
if bp.is_file():
|
if bp.is_file():
|
||||||
baseline = json.loads(bp.read_text(encoding="utf-8"))
|
baseline = load_json_cached(bp, copy_result=False)
|
||||||
else:
|
else:
|
||||||
baseline = build_internal_test_baseline_snapshot()
|
baseline = build_internal_test_baseline_snapshot()
|
||||||
|
|
||||||
|
|||||||
@@ -17,6 +17,8 @@ from dataclasses import dataclass, field
|
|||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
|
from hyperstitionstud_io import __version__ as _PKG_VERSION
|
||||||
|
|
||||||
CORE_REPO_ROOT = Path(__file__).resolve().parents[3]
|
CORE_REPO_ROOT = Path(__file__).resolve().parents[3]
|
||||||
WORKSPACE_ROOT = CORE_REPO_ROOT.parent
|
WORKSPACE_ROOT = CORE_REPO_ROOT.parent
|
||||||
USER_WORKSPACE_TOML = Path.home() / ".config" / "hyperstitionstud.io" / "workspace.toml"
|
USER_WORKSPACE_TOML = Path.home() / ".config" / "hyperstitionstud.io" / "workspace.toml"
|
||||||
@@ -173,7 +175,7 @@ def load_json_cached(path: str | Path, *, copy_result: bool = True) -> Any:
|
|||||||
|
|
||||||
@dataclass(frozen=True)
|
@dataclass(frozen=True)
|
||||||
class WorkspaceConfig:
|
class WorkspaceConfig:
|
||||||
schema_version: str = "1.2.0"
|
schema_version: str = _PKG_VERSION
|
||||||
namespace_urn: str = "urn:io:hyperstitionstud"
|
namespace_urn: str = "urn:io:hyperstitionstud"
|
||||||
workspace_root: Path = WORKSPACE_ROOT
|
workspace_root: Path = WORKSPACE_ROOT
|
||||||
paths: dict[str, Path] = field(default_factory=dict)
|
paths: dict[str, Path] = field(default_factory=dict)
|
||||||
@@ -288,7 +290,7 @@ def load_workspace_config(
|
|||||||
resolved_mounts = {str(_rebase_path(k, ws_root)): str(v) for k, v in raw_cit.items()}
|
resolved_mounts = {str(_rebase_path(k, ws_root)): str(v) for k, v in raw_cit.items()}
|
||||||
|
|
||||||
return WorkspaceConfig(
|
return WorkspaceConfig(
|
||||||
schema_version=str(raw.get("schema_version", "1.2.0")),
|
schema_version=str(raw.get("schema_version", _PKG_VERSION)),
|
||||||
namespace_urn=str(raw.get("namespace_urn", "urn:io:hyperstitionstud")),
|
namespace_urn=str(raw.get("namespace_urn", "urn:io:hyperstitionstud")),
|
||||||
workspace_root=ws_root,
|
workspace_root=ws_root,
|
||||||
paths=resolved_paths,
|
paths=resolved_paths,
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ if _SRC_DIR.is_dir() and str(_SRC_DIR) not in sys.path:
|
|||||||
sys.path.insert(0, str(_SRC_DIR))
|
sys.path.insert(0, str(_SRC_DIR))
|
||||||
|
|
||||||
from hyperstitionstud_io import __version__ as CURRENT_VERSION # noqa: E402
|
from hyperstitionstud_io import __version__ as CURRENT_VERSION # noqa: E402
|
||||||
from hyperstitionstud_io.config import load_workspace_config # noqa: E402
|
from hyperstitionstud_io.config import load_json_cached, load_workspace_config # noqa: E402
|
||||||
from hyperstitionstud_io.glossary import ReadOnlyIsolationGuard # noqa: E402
|
from hyperstitionstud_io.glossary import ReadOnlyIsolationGuard # noqa: E402
|
||||||
from hyperstitionstud_io.ipld import compute_dag_json_cidv1 # noqa: E402
|
from hyperstitionstud_io.ipld import compute_dag_json_cidv1 # noqa: E402
|
||||||
from hyperstitionstud_io.quant.timeseries import build_quant_timeseries_bundle # noqa: E402
|
from hyperstitionstud_io.quant.timeseries import build_quant_timeseries_bundle # noqa: E402
|
||||||
@@ -403,7 +403,7 @@ def build_catalog_sqlite_db(db_path: Path | str | None = None) -> dict[str, Any]
|
|||||||
|
|
||||||
# 2. Glossary Entries & Bilingual Specimens
|
# 2. Glossary Entries & Bilingual Specimens
|
||||||
gl_path = cfg.zoology_dir / "taxonomy" / "glossary-registry.json"
|
gl_path = cfg.zoology_dir / "taxonomy" / "glossary-registry.json"
|
||||||
gl_data = json.loads(gl_path.read_text(encoding="utf-8"))
|
gl_data = load_json_cached(gl_path, copy_result=False)
|
||||||
seen_terms: set[str] = set()
|
seen_terms: set[str] = set()
|
||||||
glossary_rows = 0
|
glossary_rows = 0
|
||||||
|
|
||||||
@@ -500,7 +500,7 @@ def build_catalog_sqlite_db(db_path: Path | str | None = None) -> dict[str, Any]
|
|||||||
|
|
||||||
# 3. Knowledge Graph Nodes & Edges
|
# 3. Knowledge Graph Nodes & Edges
|
||||||
kg_path = cfg.knowledge_graph_dir / "encyclopedia-graph.json"
|
kg_path = cfg.knowledge_graph_dir / "encyclopedia-graph.json"
|
||||||
kg_data = json.loads(kg_path.read_text(encoding="utf-8"))
|
kg_data = load_json_cached(kg_path, copy_result=False)
|
||||||
deg_map: dict[str, int] = {}
|
deg_map: dict[str, int] = {}
|
||||||
edge_rows = 0
|
edge_rows = 0
|
||||||
for e in kg_data.get("edges", []):
|
for e in kg_data.get("edges", []):
|
||||||
@@ -619,7 +619,7 @@ def build_catalog_sqlite_db(db_path: Path | str | None = None) -> dict[str, Any]
|
|||||||
# 5. Periodic Quantitative Financial Time-Series Bars (24 Tickers x 30 UTC Days = 720 bars)
|
# 5. Periodic Quantitative Financial Time-Series Bars (24 Tickers x 30 UTC Days = 720 bars)
|
||||||
ts_path = cfg.core_dir / "site" / "quant" / "quant-timeseries.json"
|
ts_path = cfg.core_dir / "site" / "quant" / "quant-timeseries.json"
|
||||||
if ts_path.is_file():
|
if ts_path.is_file():
|
||||||
ts_bundle = json.loads(ts_path.read_text(encoding="utf-8"))
|
ts_bundle = load_json_cached(ts_path, copy_result=False)
|
||||||
else:
|
else:
|
||||||
ts_bundle = build_quant_timeseries_bundle(write_files=False)
|
ts_bundle = build_quant_timeseries_bundle(write_files=False)
|
||||||
|
|
||||||
|
|||||||
@@ -187,7 +187,7 @@ MCP_TOOLS_SCHEMA: list[dict[str, Any]] = [
|
|||||||
"inputSchema": {
|
"inputSchema": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
"harvest_mode": {"type": "string", "enum": ["us-closing-bell", "utc-rollover"], "default": "us-closing-bell"},
|
"harvest_mode": {"type": "string", "enum": ["us-pre-market-open", "us-closing-bell", "utc-rollover"], "default": "us-closing-bell"},
|
||||||
"symbol_filter": {"type": "string", "default": "", "description": "Optional ticker symbol filter (e.g. 'NVDA', 'ASML', 'BTC-USD')."},
|
"symbol_filter": {"type": "string", "default": "", "description": "Optional ticker symbol filter (e.g. 'NVDA', 'ASML', 'BTC-USD')."},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -683,7 +683,7 @@ def call_mcp_tool(name: str, arguments: dict[str, Any]) -> dict[str, Any]:
|
|||||||
b_path = cfg.core_dir / "site" / "quant" / "daily-brief-latest.json"
|
b_path = cfg.core_dir / "site" / "quant" / "daily-brief-latest.json"
|
||||||
if bool(arguments.get("refresh")) or not b_path.is_file():
|
if bool(arguments.get("refresh")) or not b_path.is_file():
|
||||||
return build_daily_portfolio_brief(allow_live_network=False, write_files=False)
|
return build_daily_portfolio_brief(allow_live_network=False, write_files=False)
|
||||||
return load_json_cached(b_path)
|
return load_json_cached(b_path, copy_result=False)
|
||||||
|
|
||||||
if name == "hs_inspect_engineering_and_math_docs":
|
if name == "hs_inspect_engineering_and_math_docs":
|
||||||
from hyperstitionstud_io.publishing.engineering_docs import (
|
from hyperstitionstud_io.publishing.engineering_docs import (
|
||||||
@@ -760,7 +760,7 @@ def call_mcp_tool(name: str, arguments: dict[str, Any]) -> dict[str, Any]:
|
|||||||
{
|
{
|
||||||
"id": "ONBOARDING-INGGLISH-AQ",
|
"id": "ONBOARDING-INGGLISH-AQ",
|
||||||
"category": "manuals",
|
"category": "manuals",
|
||||||
"md_path": (cfg.paths.get("ci_repo_dir") or (cfg.workspace_root / "hyperdope-ci-build")) / "ONBOARDING-INGGLISH-AQ.md",
|
"md_path": cfg.ci_build_dir / "ONBOARDING-INGGLISH-AQ.md",
|
||||||
"web_pdf_route": "/ci/ONBOARDING-INGGLISH-AQ.pdf",
|
"web_pdf_route": "/ci/ONBOARDING-INGGLISH-AQ.pdf",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -1036,7 +1036,7 @@ def call_mcp_tool(name: str, arguments: dict[str, Any]) -> dict[str, Any]:
|
|||||||
if inc_base:
|
if inc_base:
|
||||||
bp = get_default_baseline_cache_path()
|
bp = get_default_baseline_cache_path()
|
||||||
if bp.is_file():
|
if bp.is_file():
|
||||||
b_obj = json.loads(bp.read_text(encoding="utf-8"))
|
b_obj = load_json_cached(bp, copy_result=False)
|
||||||
out_cat["internal_test_baseline"] = {
|
out_cat["internal_test_baseline"] = {
|
||||||
"expected_version": b_obj.get("expected_version"),
|
"expected_version": b_obj.get("expected_version"),
|
||||||
"expected_mcp_tool_count": b_obj.get("expected_mcp_tool_count"),
|
"expected_mcp_tool_count": b_obj.get("expected_mcp_tool_count"),
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ from pathlib import Path
|
|||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
from hyperstitionstud_io import __version__ as CURRENT_VERSION
|
from hyperstitionstud_io import __version__ as CURRENT_VERSION
|
||||||
from hyperstitionstud_io.config import load_json_cached, load_workspace_config
|
from hyperstitionstud_io.config import load_json_cached, load_workspace_config, normalize_workspace_relpath
|
||||||
from hyperstitionstud_io.db.sqlite_meta import ensure_single_layer_gzip_file, parse_size_spec_bytes
|
from hyperstitionstud_io.db.sqlite_meta import ensure_single_layer_gzip_file, parse_size_spec_bytes
|
||||||
from hyperstitionstud_io.glossary import ReadOnlyIsolationGuard, sha256_file
|
from hyperstitionstud_io.glossary import ReadOnlyIsolationGuard, sha256_file
|
||||||
from hyperstitionstud_io.ipld import compute_dag_json_cidv1
|
from hyperstitionstud_io.ipld import compute_dag_json_cidv1
|
||||||
@@ -47,15 +47,6 @@ INACTIVE_MANIFEST_FILENAME = "inactive-archive-manifest.json"
|
|||||||
DEFAULT_MAX_ARCHIVE_BUNDLE_BYTES = 256 * 1024 # 262,144 bytes (256 KB)
|
DEFAULT_MAX_ARCHIVE_BUNDLE_BYTES = 256 * 1024 # 262,144 bytes (256 KB)
|
||||||
|
|
||||||
|
|
||||||
def _norm_ws_path(p: Path | str, workspace_root: str | Path | None = None) -> str:
|
|
||||||
cfg = load_workspace_config(workspace_root=workspace_root)
|
|
||||||
ws_res = str(cfg.workspace_root.resolve())
|
|
||||||
s = str(Path(p).resolve())
|
|
||||||
if s.startswith(ws_res):
|
|
||||||
return "/workspace" + s[len(ws_res):]
|
|
||||||
return str(p)
|
|
||||||
|
|
||||||
|
|
||||||
def assert_not_gematria_pipeline_source(target_path: str | Path, workspace_root: str | Path | None = None) -> Path:
|
def assert_not_gematria_pipeline_source(target_path: str | Path, workspace_root: str | Path | None = None) -> Path:
|
||||||
"""
|
"""
|
||||||
Hard programmatic block guaranteeing that NO file supplying any gematria, phonemic,
|
Hard programmatic block guaranteeing that NO file supplying any gematria, phonemic,
|
||||||
@@ -571,7 +562,7 @@ def _load_existing_manifest_maps(manifest_p: Path) -> tuple[dict[str, dict[str,
|
|||||||
existing_manifest: dict[str, Any] = {}
|
existing_manifest: dict[str, Any] = {}
|
||||||
if manifest_p.is_file():
|
if manifest_p.is_file():
|
||||||
try:
|
try:
|
||||||
existing_manifest = load_json_cached(manifest_p)
|
existing_manifest = load_json_cached(manifest_p, copy_result=False)
|
||||||
except Exception:
|
except Exception:
|
||||||
existing_manifest = {}
|
existing_manifest = {}
|
||||||
|
|
||||||
@@ -690,8 +681,8 @@ def rotate_docs_archive_directory(
|
|||||||
staged_files = sorted(p for p in stage_dir.iterdir() if p.is_file() and p.suffix == ".md")
|
staged_files = sorted(p for p in stage_dir.iterdir() if p.is_file() and p.suffix == ".md")
|
||||||
if not staged_files and not long_term_by_name:
|
if not staged_files and not long_term_by_name:
|
||||||
return {
|
return {
|
||||||
"archive_dir": _norm_ws_path(arc_p),
|
"archive_dir": normalize_workspace_relpath(arc_p),
|
||||||
"bundle_path": _norm_ws_path(bundle_p),
|
"bundle_path": normalize_workspace_relpath(bundle_p),
|
||||||
"member_count": 0,
|
"member_count": 0,
|
||||||
"rotated_loose_files": 0,
|
"rotated_loose_files": 0,
|
||||||
"preserved_standalone_pdfs": preserved_standalone_pdfs,
|
"preserved_standalone_pdfs": preserved_standalone_pdfs,
|
||||||
@@ -720,9 +711,9 @@ def rotate_docs_archive_directory(
|
|||||||
lp.unlink()
|
lp.unlink()
|
||||||
|
|
||||||
return {
|
return {
|
||||||
"archive_dir": _norm_ws_path(arc_p),
|
"archive_dir": normalize_workspace_relpath(arc_p),
|
||||||
"bundle_path": _norm_ws_path(bundle_p),
|
"bundle_path": normalize_workspace_relpath(bundle_p),
|
||||||
"manifest_path": _norm_ws_path(manifest_p),
|
"manifest_path": normalize_workspace_relpath(manifest_p),
|
||||||
"manifest_dag_json_cid": manifest_cid,
|
"manifest_dag_json_cid": manifest_cid,
|
||||||
"max_bundle_bytes": eff_max_bytes,
|
"max_bundle_bytes": eff_max_bytes,
|
||||||
"bundle_size_bytes": bundle_p.stat().st_size,
|
"bundle_size_bytes": bundle_p.stat().st_size,
|
||||||
@@ -815,8 +806,8 @@ def rotate_inactive_plans_marked_for_archival(
|
|||||||
if not staged_files and not long_term_by_name:
|
if not staged_files and not long_term_by_name:
|
||||||
return {
|
return {
|
||||||
"ok": True,
|
"ok": True,
|
||||||
"inactive_dir": _norm_ws_path(inactive_dir, workspace_root=workspace_root),
|
"inactive_dir": normalize_workspace_relpath(inactive_dir, workspace_root=workspace_root),
|
||||||
"bundle_path": _norm_ws_path(bundle_p, workspace_root=workspace_root),
|
"bundle_path": normalize_workspace_relpath(bundle_p, workspace_root=workspace_root),
|
||||||
"member_count": 0,
|
"member_count": 0,
|
||||||
"rotated_loose_files": 0,
|
"rotated_loose_files": 0,
|
||||||
"retained_inactive_plans": retained_inactive_plans,
|
"retained_inactive_plans": retained_inactive_plans,
|
||||||
@@ -843,9 +834,9 @@ def rotate_inactive_plans_marked_for_archival(
|
|||||||
return {
|
return {
|
||||||
"ok": True,
|
"ok": True,
|
||||||
"version": CURRENT_VERSION,
|
"version": CURRENT_VERSION,
|
||||||
"inactive_dir": _norm_ws_path(inactive_dir, workspace_root=workspace_root),
|
"inactive_dir": normalize_workspace_relpath(inactive_dir, workspace_root=workspace_root),
|
||||||
"bundle_path": _norm_ws_path(bundle_p, workspace_root=workspace_root),
|
"bundle_path": normalize_workspace_relpath(bundle_p, workspace_root=workspace_root),
|
||||||
"manifest_path": _norm_ws_path(manifest_p, workspace_root=workspace_root),
|
"manifest_path": normalize_workspace_relpath(manifest_p, workspace_root=workspace_root),
|
||||||
"manifest_dag_json_cid": manifest_cid,
|
"manifest_dag_json_cid": manifest_cid,
|
||||||
"bundle_size_bytes": bundle_p.stat().st_size,
|
"bundle_size_bytes": bundle_p.stat().st_size,
|
||||||
"bundle_sha256": bundle_sha,
|
"bundle_sha256": bundle_sha,
|
||||||
@@ -949,7 +940,7 @@ def audit_and_fix_multi_compressed_files(
|
|||||||
cfg.zoology_dir,
|
cfg.zoology_dir,
|
||||||
cfg.knowledge_graph_dir,
|
cfg.knowledge_graph_dir,
|
||||||
cfg.paths["gematria_js_dir"],
|
cfg.paths["gematria_js_dir"],
|
||||||
cfg.paths.get("ci_repo_dir", cfg.workspace_root / "hyperdope-ci-build"),
|
cfg.ci_build_dir,
|
||||||
]
|
]
|
||||||
for ed in extra_dirs or []:
|
for ed in extra_dirs or []:
|
||||||
ep = Path(ed)
|
ep = Path(ed)
|
||||||
@@ -981,10 +972,10 @@ def audit_and_fix_multi_compressed_files(
|
|||||||
fp.unlink()
|
fp.unlink()
|
||||||
else:
|
else:
|
||||||
fp.rename(base_p)
|
fp.rename(base_p)
|
||||||
removed_double_sidecars.append(_norm_ws_path(fp, workspace_root=workspace_root))
|
removed_double_sidecars.append(normalize_workspace_relpath(fp, workspace_root=workspace_root))
|
||||||
continue
|
continue
|
||||||
else:
|
else:
|
||||||
removed_double_sidecars.append(_norm_ws_path(fp, workspace_root=workspace_root))
|
removed_double_sidecars.append(normalize_workspace_relpath(fp, workspace_root=workspace_root))
|
||||||
|
|
||||||
if fn.endswith((".gz", ".tgz")):
|
if fn.endswith((".gz", ".tgz")):
|
||||||
scanned_gz_count += 1
|
scanned_gz_count += 1
|
||||||
@@ -996,7 +987,7 @@ def audit_and_fix_multi_compressed_files(
|
|||||||
if head.startswith((b"\x1f\x8b", b"\xfd7zXZ\x00")):
|
if head.startswith((b"\x1f\x8b", b"\xfd7zXZ\x00")):
|
||||||
if fix:
|
if fix:
|
||||||
ensure_single_layer_gzip_file(fp)
|
ensure_single_layer_gzip_file(fp)
|
||||||
peeled_gzip_files.append(_norm_ws_path(fp, workspace_root=workspace_root))
|
peeled_gzip_files.append(normalize_workspace_relpath(fp, workspace_root=workspace_root))
|
||||||
|
|
||||||
if fn.endswith((".tar.gz", ".tgz", ".tar.xz")):
|
if fn.endswith((".tar.gz", ".tgz", ".tar.xz")):
|
||||||
scanned_tar_count += 1
|
scanned_tar_count += 1
|
||||||
@@ -1025,12 +1016,12 @@ def audit_and_fix_multi_compressed_files(
|
|||||||
elif bad_members and fix and fn.startswith("ingglish-isopsephic-exegesis-") and fn.endswith((".tar.gz", ".tar.xz")):
|
elif bad_members and fix and fn.startswith("ingglish-isopsephic-exegesis-") and fn.endswith((".tar.gz", ".tar.xz")):
|
||||||
# Remove legacy 2x-compressed packaging wrapper if still present in an unpulled/live directory
|
# Remove legacy 2x-compressed packaging wrapper if still present in an unpulled/live directory
|
||||||
fp.unlink()
|
fp.unlink()
|
||||||
removed_double_sidecars.append(_norm_ws_path(fp, workspace_root=workspace_root))
|
removed_double_sidecars.append(normalize_workspace_relpath(fp, workspace_root=workspace_root))
|
||||||
bad_members = []
|
bad_members = []
|
||||||
if bad_members:
|
if bad_members:
|
||||||
nested_archive_violations.append(
|
nested_archive_violations.append(
|
||||||
{
|
{
|
||||||
"archive": _norm_ws_path(fp, workspace_root=workspace_root),
|
"archive": normalize_workspace_relpath(fp, workspace_root=workspace_root),
|
||||||
"nested_compressed_members": bad_members,
|
"nested_compressed_members": bad_members,
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
@@ -1150,7 +1141,7 @@ def main(argv: list[str] | None = None) -> int:
|
|||||||
):
|
):
|
||||||
mp = d / mf
|
mp = d / mf
|
||||||
if mp.is_file():
|
if mp.is_file():
|
||||||
out[_norm_ws_path(d, workspace_root=args.workspace_root)] = load_json_cached(mp)
|
out[normalize_workspace_relpath(d, workspace_root=args.workspace_root)] = load_json_cached(mp, copy_result=False)
|
||||||
print(json.dumps(out, indent=2))
|
print(json.dumps(out, indent=2))
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
|
|||||||
@@ -30,12 +30,15 @@ from typing import Any
|
|||||||
from PIL import Image, ImageDraw
|
from PIL import Image, ImageDraw
|
||||||
|
|
||||||
from hyperstitionstud_io import __version__ as CURRENT_VERSION
|
from hyperstitionstud_io import __version__ as CURRENT_VERSION
|
||||||
from hyperstitionstud_io.config import load_json_cached, load_workspace_config
|
from hyperstitionstud_io.config import count_file_lines_cached, load_json_cached, load_workspace_config
|
||||||
from hyperstitionstud_io.glossary import ReadOnlyIsolationGuard
|
from hyperstitionstud_io.glossary import ReadOnlyIsolationGuard
|
||||||
from hyperstitionstud_io.ipld import compute_dag_json_cidv1
|
from hyperstitionstud_io.ipld import compute_dag_json_cidv1
|
||||||
from hyperstitionstud_io.publishing.fonts import (
|
from hyperstitionstud_io.publishing.fonts import (
|
||||||
GROUP3_PALETTE,
|
GROUP3_PALETTE,
|
||||||
|
draw_bounded_box_text,
|
||||||
|
draw_bounded_kv_row,
|
||||||
draw_group3_chamfered_plate,
|
draw_group3_chamfered_plate,
|
||||||
|
fit_pillow_text_to_width,
|
||||||
load_pillow_font,
|
load_pillow_font,
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -126,17 +129,15 @@ def _fit_font_for_width(
|
|||||||
min_size: int = 8,
|
min_size: int = 8,
|
||||||
bold: bool = False,
|
bold: bool = False,
|
||||||
) -> tuple[Any, int, int]:
|
) -> tuple[Any, int, int]:
|
||||||
font_file = FONT_MONO_B if bold else FONT_MONO
|
return fit_pillow_text_to_width(
|
||||||
for sz in range(preferred_size, min_size - 1, -1):
|
d,
|
||||||
f = _fnt(font_file, sz)
|
text,
|
||||||
tb = d.textbbox((0, 0), text, font=f)
|
max_width,
|
||||||
w = int(tb[2] - tb[0])
|
preferred_size=preferred_size,
|
||||||
h = int(tb[3] - tb[1])
|
min_size=min_size,
|
||||||
if w <= max_width:
|
bold=bold,
|
||||||
return f, w, h
|
font_filename=FONT_MONO_B if bold else FONT_MONO,
|
||||||
f = _fnt(font_file, min_size)
|
)
|
||||||
tb = d.textbbox((0, 0), text, font=f)
|
|
||||||
return f, int(tb[2] - tb[0]), int(tb[3] - tb[1])
|
|
||||||
|
|
||||||
|
|
||||||
def _draw_box_text(
|
def _draw_box_text(
|
||||||
@@ -152,18 +153,19 @@ def _draw_box_text(
|
|||||||
bold: bool = False,
|
bold: bool = False,
|
||||||
y_pos: int | None = None,
|
y_pos: int | None = None,
|
||||||
) -> tuple[int, int, int, int]:
|
) -> tuple[int, int, int, int]:
|
||||||
bx1, by1, bx2, by2 = box
|
return draw_bounded_box_text(
|
||||||
avail_w = max(16, (bx2 - bx1) - 2 * pad_x)
|
d,
|
||||||
f, tw, th = _fit_font_for_width(d, text, avail_w, preferred_size=preferred_size, min_size=min_size, bold=bold)
|
box,
|
||||||
if align == "center":
|
text,
|
||||||
tx = bx1 + max(pad_x, ((bx2 - bx1) - tw) // 2)
|
fill,
|
||||||
elif align == "right":
|
pad_x=pad_x,
|
||||||
tx = max(bx1 + pad_x, bx2 - pad_x - tw)
|
align=align,
|
||||||
else:
|
preferred_size=preferred_size,
|
||||||
tx = bx1 + pad_x
|
min_size=min_size,
|
||||||
ty = y_pos if y_pos is not None else (by1 + max(2, ((by2 - by1) - th) // 2 - 1))
|
bold=bold,
|
||||||
d.text((tx, ty), text, font=f, fill=fill)
|
y_pos=y_pos,
|
||||||
return d.texts[-1][2]
|
font_filename=FONT_MONO_B if bold else FONT_MONO,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
def _draw_kv_row(
|
def _draw_kv_row(
|
||||||
@@ -181,22 +183,20 @@ def _draw_kv_row(
|
|||||||
val_bold: bool = False,
|
val_bold: bool = False,
|
||||||
min_val_x: int | None = None,
|
min_val_x: int | None = None,
|
||||||
) -> None:
|
) -> None:
|
||||||
bx1, by1, bx2, by2 = box
|
draw_bounded_kv_row(
|
||||||
d.rectangle([bx1, by1, bx2, by2], fill=fill_bg, outline=outline)
|
d,
|
||||||
total_inner = (bx2 - bx1) - 16
|
box,
|
||||||
kf, kw, kh = _fit_font_for_width(d, key_text, max(40, int(total_inner * 0.52)), preferred_size=key_size, min_size=8, bold=True)
|
key_text,
|
||||||
ky = by1 + max(2, ((by2 - by1) - kh) // 2 - 1)
|
val_text,
|
||||||
kx = bx1 + 8
|
fill_bg=fill_bg,
|
||||||
d.text((kx, ky), key_text, font=kf, fill=key_fill)
|
outline=outline,
|
||||||
key_tb = d.texts[-1][2]
|
key_fill=key_fill,
|
||||||
|
val_fill=val_fill,
|
||||||
vx_start = max(key_tb[2] + 8, min_val_x if min_val_x is not None else (key_tb[2] + 10))
|
key_size=key_size,
|
||||||
avail_val_w = max(24, (bx2 - 6) - vx_start)
|
val_size=val_size,
|
||||||
vf, vw, vh = _fit_font_for_width(d, val_text, avail_val_w, preferred_size=val_size, min_size=8, bold=val_bold)
|
val_bold=val_bold,
|
||||||
if vx_start + vw > bx2 - 6:
|
min_val_x=min_val_x,
|
||||||
vx_start = max(key_tb[2] + 6, (bx2 - 6) - vw)
|
)
|
||||||
vy = by1 + max(2, ((by2 - by1) - vh) // 2 - 1)
|
|
||||||
d.text((vx_start, vy), val_text, font=vf, fill=val_fill)
|
|
||||||
|
|
||||||
|
|
||||||
def verify_closeup_geometry(tracked_by_filename: dict[str, _TrackedCanvasDraw]) -> dict[str, Any]:
|
def verify_closeup_geometry(tracked_by_filename: dict[str, _TrackedCanvasDraw]) -> dict[str, Any]:
|
||||||
@@ -348,7 +348,7 @@ def introspect_live_ui_elements(workspace_root: str | Path | None = None) -> dic
|
|||||||
core = cfg.core_dir
|
core = cfg.core_dir
|
||||||
kg = cfg.knowledge_graph_dir
|
kg = cfg.knowledge_graph_dir
|
||||||
calc_dir = cfg.paths["gematria_js_dir"]
|
calc_dir = cfg.paths["gematria_js_dir"]
|
||||||
ci_dir = cfg.paths.get("ci_repo_dir") or (cfg.workspace_root / "hyperdope-ci-build")
|
ci_dir = cfg.ci_build_dir
|
||||||
|
|
||||||
surfaces: dict[str, Path] = {
|
surfaces: dict[str, Path] = {
|
||||||
"home": core / "site" / "index.html",
|
"home": core / "site" / "index.html",
|
||||||
@@ -408,7 +408,7 @@ def introspect_live_ui_elements(workspace_root: str | Path | None = None) -> dic
|
|||||||
}
|
}
|
||||||
|
|
||||||
db_txt_p = calc_dir / "db.txt"
|
db_txt_p = calc_dir / "db.txt"
|
||||||
db_entries_count = sum(1 for _ in db_txt_p.open(encoding="utf-8")) if db_txt_p.is_file() else 231615
|
db_entries_count = count_file_lines_cached(db_txt_p) if db_txt_p.is_file() else 231615
|
||||||
|
|
||||||
ci_rep_p = ci_dir / "ci-audit-report.json"
|
ci_rep_p = ci_dir / "ci-audit-report.json"
|
||||||
ci_obj = load_json_cached(ci_rep_p, copy_result=False) if ci_rep_p.is_file() else {}
|
ci_obj = load_json_cached(ci_rep_p, copy_result=False) if ci_rep_p.is_file() else {}
|
||||||
@@ -486,7 +486,7 @@ def render_all_quadrant_closeups(
|
|||||||
prev_fp = ""
|
prev_fp = ""
|
||||||
if manifest_path.is_file():
|
if manifest_path.is_file():
|
||||||
try:
|
try:
|
||||||
prev_obj = json.loads(manifest_path.read_text(encoding="utf-8"))
|
prev_obj = load_json_cached(manifest_path, copy_result=False)
|
||||||
prev_fp = prev_obj.get("ui_elements_fingerprint_sha256", "")
|
prev_fp = prev_obj.get("ui_elements_fingerprint_sha256", "")
|
||||||
except Exception:
|
except Exception:
|
||||||
prev_fp = ""
|
prev_fp = ""
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ clamping (`breach_count == 0`).
|
|||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
|
import hashlib
|
||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
@@ -20,6 +21,7 @@ from hyperstitionstud_io.publishing.fonts import (
|
|||||||
GROUP3_PALETTE,
|
GROUP3_PALETTE,
|
||||||
chamfer_polygon_points as _chamfer_pts,
|
chamfer_polygon_points as _chamfer_pts,
|
||||||
draw_group3_chamfered_plate as _draw_group3_plate,
|
draw_group3_chamfered_plate as _draw_group3_plate,
|
||||||
|
fit_pillow_text_to_width,
|
||||||
load_pillow_font,
|
load_pillow_font,
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -55,18 +57,48 @@ def _draw_arrow_right(draw: Any, x0: int, x1: int, y: int, color: tuple[int, int
|
|||||||
draw.polygon([(x1 - 10, y - 5), (x1 - 10, y + 5), (x1, y)], fill=color)
|
draw.polygon([(x1 - 10, y - 5), (x1 - 10, y + 5), (x1, y)], fill=color)
|
||||||
|
|
||||||
|
|
||||||
|
def _compute_flow_diagram_sha256() -> str:
|
||||||
|
src_bytes = Path(__file__).resolve().read_bytes()
|
||||||
|
h = hashlib.sha256()
|
||||||
|
h.update(f"v{CURRENT_VERSION}:{DIAGRAM_WIDTH}x{DIAGRAM_HEIGHT}:".encode("utf-8"))
|
||||||
|
h.update(src_bytes)
|
||||||
|
return h.hexdigest()
|
||||||
|
|
||||||
|
|
||||||
def render_periodic_harvest_cicd_flow_diagram_png(
|
def render_periodic_harvest_cicd_flow_diagram_png(
|
||||||
output_path: str | Path | None = None,
|
output_path: str | Path | None = None,
|
||||||
|
*,
|
||||||
|
if_changed: bool = True,
|
||||||
) -> dict[str, Any]:
|
) -> dict[str, Any]:
|
||||||
"""
|
"""
|
||||||
Render the 5-Stage End-to-End Periodic Data Harvest -> CI/CD -> Deployed VPS Infrastructure Flow Diagram
|
Render the 5-Stage End-to-End Periodic Data Harvest -> CI/CD -> Deployed VPS Infrastructure Flow Diagram
|
||||||
to `/workspace/encyclopedia-knowledge-graph/docs/periodic-harvest-cicd-to-vps-flow-diagram.png`.
|
to `/workspace/encyclopedia-knowledge-graph/docs/periodic-harvest-cicd-to-vps-flow-diagram.png`.
|
||||||
|
When `if_changed=True` and the existing PNG embeds a matching `hs_diagram_sha256` tEXt chunk,
|
||||||
|
skips rewriting the file.
|
||||||
"""
|
"""
|
||||||
from PIL import Image, ImageDraw
|
from PIL import Image, ImageDraw
|
||||||
|
from PIL.PngImagePlugin import PngInfo
|
||||||
|
|
||||||
cfg = load_workspace_config()
|
cfg = load_workspace_config()
|
||||||
out_p = Path(output_path) if output_path else (cfg.knowledge_graph_dir / "docs" / "periodic-harvest-cicd-to-vps-flow-diagram.png")
|
out_p = Path(output_path) if output_path else (cfg.knowledge_graph_dir / "docs" / "periodic-harvest-cicd-to-vps-flow-diagram.png")
|
||||||
out_p = out_p.resolve()
|
out_p = out_p.resolve()
|
||||||
|
diagram_sha256 = _compute_flow_diagram_sha256()
|
||||||
|
|
||||||
|
if if_changed and out_p.is_file():
|
||||||
|
try:
|
||||||
|
with Image.open(out_p) as existing_im:
|
||||||
|
if existing_im.info.get("hs_diagram_sha256") == diagram_sha256:
|
||||||
|
return {
|
||||||
|
"png_path": str(out_p),
|
||||||
|
"dimensions": [DIAGRAM_WIDTH, DIAGRAM_HEIGHT],
|
||||||
|
"size_bytes": out_p.stat().st_size,
|
||||||
|
"breach_count": 0,
|
||||||
|
"skipped_unchanged": True,
|
||||||
|
"hs_diagram_sha256": diagram_sha256,
|
||||||
|
}
|
||||||
|
except Exception:
|
||||||
|
pass
|
||||||
|
|
||||||
out_p.parent.mkdir(parents=True, exist_ok=True)
|
out_p.parent.mkdir(parents=True, exist_ok=True)
|
||||||
tmp_p = out_p.with_suffix(f".tmp.{os.getpid()}.png")
|
tmp_p = out_p.with_suffix(f".tmp.{os.getpid()}.png")
|
||||||
|
|
||||||
@@ -381,13 +413,17 @@ def render_periodic_harvest_cicd_flow_diagram_png(
|
|||||||
fit_text(bbox[0] + 12, ly, ln, TXT_PRI, [f_m11, f_m10], max_x=bbox[2] - 10)
|
fit_text(bbox[0] + 12, ly, ln, TXT_PRI, [f_m11, f_m10], max_x=bbox[2] - 10)
|
||||||
ly += 20
|
ly += 20
|
||||||
|
|
||||||
img.save(tmp_p, format="PNG")
|
pnginfo = PngInfo()
|
||||||
|
pnginfo.add_text("hs_diagram_sha256", diagram_sha256)
|
||||||
|
img.save(tmp_p, format="PNG", pnginfo=pnginfo)
|
||||||
os.replace(tmp_p, out_p)
|
os.replace(tmp_p, out_p)
|
||||||
return {
|
return {
|
||||||
"png_path": str(out_p),
|
"png_path": str(out_p),
|
||||||
"dimensions": [DIAGRAM_WIDTH, DIAGRAM_HEIGHT],
|
"dimensions": [DIAGRAM_WIDTH, DIAGRAM_HEIGHT],
|
||||||
"size_bytes": out_p.stat().st_size,
|
"size_bytes": out_p.stat().st_size,
|
||||||
"breach_count": breach_count,
|
"breach_count": breach_count,
|
||||||
|
"skipped_unchanged": False,
|
||||||
|
"hs_diagram_sha256": diagram_sha256,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ from pathlib import Path
|
|||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
from hyperstitionstud_io import __version__ as CURRENT_VERSION
|
from hyperstitionstud_io import __version__ as CURRENT_VERSION
|
||||||
from hyperstitionstud_io.config import load_workspace_config
|
from hyperstitionstud_io.config import load_json_cached, load_workspace_config
|
||||||
from hyperstitionstud_io.glossary import ReadOnlyIsolationGuard
|
from hyperstitionstud_io.glossary import ReadOnlyIsolationGuard
|
||||||
from hyperstitionstud_io.ipld import compute_dag_json_cidv1
|
from hyperstitionstud_io.ipld import compute_dag_json_cidv1
|
||||||
from hyperstitionstud_io.mcp.tools import MCP_TOOLS_SCHEMA
|
from hyperstitionstud_io.mcp.tools import MCP_TOOLS_SCHEMA
|
||||||
@@ -44,7 +44,7 @@ def compute_corpus_delta_report(workspace_root: str | Path | None = None) -> dic
|
|||||||
prior_snap = cur_snap
|
prior_snap = cur_snap
|
||||||
if cache_p.is_file():
|
if cache_p.is_file():
|
||||||
try:
|
try:
|
||||||
prior_snap = json.loads(cache_p.read_text(encoding="utf-8"))
|
prior_snap = load_json_cached(cache_p, copy_result=False)
|
||||||
except Exception:
|
except Exception:
|
||||||
prior_snap = cur_snap
|
prior_snap = cur_snap
|
||||||
|
|
||||||
|
|||||||
@@ -639,9 +639,7 @@ def discover_web_and_repo_pdf_pairs(workspace_root: str | Path | None = None) ->
|
|||||||
core = cfg.core_dir
|
core = cfg.core_dir
|
||||||
zoo = cfg.zoology_dir
|
zoo = cfg.zoology_dir
|
||||||
kg = cfg.knowledge_graph_dir
|
kg = cfg.knowledge_graph_dir
|
||||||
ci = cfg.paths.get("ci_build_dir") or (cfg.workspace_root / "hyperdope-ci-build")
|
ci = cfg.ci_build_dir
|
||||||
if not ci.is_dir() and (cfg.workspace_root / "ingglish-hyperdope-ci").is_dir():
|
|
||||||
ci = cfg.workspace_root / "ingglish-hyperdope-ci"
|
|
||||||
|
|
||||||
web_surfaces = [
|
web_surfaces = [
|
||||||
core / "site" / "index.html",
|
core / "site" / "index.html",
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ from pathlib import Path
|
|||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
from hyperstitionstud_io import __version__ as CURRENT_VERSION
|
from hyperstitionstud_io import __version__ as CURRENT_VERSION
|
||||||
from hyperstitionstud_io.config import load_workspace_config
|
from hyperstitionstud_io.config import load_json_cached, load_workspace_config
|
||||||
from hyperstitionstud_io.glossary import ReadOnlyIsolationGuard
|
from hyperstitionstud_io.glossary import ReadOnlyIsolationGuard
|
||||||
from hyperstitionstud_io.phonetics import translate_batch
|
from hyperstitionstud_io.phonetics import translate_batch
|
||||||
|
|
||||||
@@ -393,7 +393,7 @@ def build_quant_tour_voice_assets(
|
|||||||
prev_clips_by_id: dict[str, dict[str, Any]] = {}
|
prev_clips_by_id: dict[str, dict[str, Any]] = {}
|
||||||
if not force and manifest_p.is_file():
|
if not force and manifest_p.is_file():
|
||||||
try:
|
try:
|
||||||
prev_man = json.loads(manifest_p.read_text(encoding="utf-8"))
|
prev_man = load_json_cached(manifest_p, copy_result=False)
|
||||||
for c_item in prev_man.get("clips") or []:
|
for c_item in prev_man.get("clips") or []:
|
||||||
cid = str(c_item.get("clip_id") or "")
|
cid = str(c_item.get("clip_id") or "")
|
||||||
if cid and (target_dir / f"{cid}.wav").is_file():
|
if cid and (target_dir / f"{cid}.wav").is_file():
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ if _SRC_DIR.is_dir() and str(_SRC_DIR) not in sys.path:
|
|||||||
sys.path.insert(0, str(_SRC_DIR))
|
sys.path.insert(0, str(_SRC_DIR))
|
||||||
|
|
||||||
from hyperstitionstud_io import __version__ as CURRENT_VERSION # noqa: E402
|
from hyperstitionstud_io import __version__ as CURRENT_VERSION # noqa: E402
|
||||||
from hyperstitionstud_io.config import load_workspace_config # noqa: E402
|
from hyperstitionstud_io.config import load_workspace_config, resolve_workspace_repo_dir, run_git_stdout # noqa: E402
|
||||||
|
|
||||||
STATUS_START = "<!-- HS-COMMIT-STATUS:START -->"
|
STATUS_START = "<!-- HS-COMMIT-STATUS:START -->"
|
||||||
STATUS_END = "<!-- HS-COMMIT-STATUS:END -->"
|
STATUS_END = "<!-- HS-COMMIT-STATUS:END -->"
|
||||||
@@ -73,29 +73,8 @@ REPO_SPECS: dict[str, dict[str, str]] = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
def _git_out(repo_dir: Path, args: list[str], strip_leading: bool = True) -> str:
|
|
||||||
try:
|
|
||||||
res = subprocess.run(
|
|
||||||
["git", "-C", str(repo_dir), *args],
|
|
||||||
capture_output=True,
|
|
||||||
text=True,
|
|
||||||
timeout=5,
|
|
||||||
check=False,
|
|
||||||
)
|
|
||||||
if res.returncode == 0:
|
|
||||||
return res.stdout.strip() if strip_leading else res.stdout.rstrip("\r\n")
|
|
||||||
except Exception:
|
|
||||||
pass
|
|
||||||
return ""
|
|
||||||
|
|
||||||
|
|
||||||
def _resolve_repo_dir(ws_root: Path, repo_key: str) -> Path:
|
def _resolve_repo_dir(ws_root: Path, repo_key: str) -> Path:
|
||||||
cand = ws_root / repo_key
|
return resolve_workspace_repo_dir(ws_root, repo_key)
|
||||||
if cand.is_dir():
|
|
||||||
return cand
|
|
||||||
if repo_key == "hyperdope-ci-build" and (ws_root / "ingglish-hyperdope-ci").is_dir():
|
|
||||||
return ws_root / "ingglish-hyperdope-ci"
|
|
||||||
return cand
|
|
||||||
|
|
||||||
|
|
||||||
def _introspect_repo_commit_context(repo_dir: Path, version: str) -> dict[str, Any]:
|
def _introspect_repo_commit_context(repo_dir: Path, version: str) -> dict[str, Any]:
|
||||||
@@ -111,11 +90,11 @@ def _introspect_repo_commit_context(repo_dir: Path, version: str) -> dict[str, A
|
|||||||
}
|
}
|
||||||
|
|
||||||
# Check staged files first (for pre-commit hook)
|
# Check staged files first (for pre-commit hook)
|
||||||
staged_raw = _git_out(repo_dir, ["diff", "--cached", "--name-only"])
|
staged_raw = run_git_stdout(repo_dir, ["diff", "--cached", "--name-only"])
|
||||||
staged = [ln.strip() for ln in staged_raw.splitlines() if ln.strip() and ln.strip() != "README.md"]
|
staged = [ln.strip() for ln in staged_raw.splitlines() if ln.strip() and ln.strip() != "README.md"]
|
||||||
|
|
||||||
# Check working-tree modified files next (preserve leading status column on line 1!)
|
# Check working-tree modified files next (preserve leading status column on line 1!)
|
||||||
status_raw = _git_out(repo_dir, ["status", "--porcelain"], strip_leading=False)
|
status_raw = run_git_stdout(repo_dir, ["status", "--porcelain"], strip_leading=False)
|
||||||
dirty: list[str] = []
|
dirty: list[str] = []
|
||||||
for ln in status_raw.splitlines():
|
for ln in status_raw.splitlines():
|
||||||
if not ln.strip():
|
if not ln.strip():
|
||||||
@@ -124,7 +103,7 @@ def _introspect_repo_commit_context(repo_dir: Path, version: str) -> dict[str, A
|
|||||||
if p and p != "README.md" and not p.startswith("untracked/"):
|
if p and p != "README.md" and not p.startswith("untracked/"):
|
||||||
dirty.append(p)
|
dirty.append(p)
|
||||||
|
|
||||||
head_files_raw = _git_out(repo_dir, ["diff-tree", "--no-commit-id", "--name-only", "-r", "HEAD"])
|
head_files_raw = run_git_stdout(repo_dir, ["diff-tree", "--no-commit-id", "--name-only", "-r", "HEAD"])
|
||||||
head_files = [ln.strip() for ln in head_files_raw.splitlines() if ln.strip() and ln.strip() != "README.md"]
|
head_files = [ln.strip() for ln in head_files_raw.splitlines() if ln.strip() and ln.strip() != "README.md"]
|
||||||
|
|
||||||
active_files = staged if staged else (dirty if dirty else head_files)
|
active_files = staged if staged else (dirty if dirty else head_files)
|
||||||
@@ -493,8 +472,8 @@ def sync_all_repo_readmes(
|
|||||||
|
|
||||||
PRE_COMMIT_HOOK_SCRIPT = """#!/usr/bin/env bash
|
PRE_COMMIT_HOOK_SCRIPT = """#!/usr/bin/env bash
|
||||||
# Auto-installed by hyperstitionstud_io.publishing.readme_sync (hs-readme-sync --install-hooks)
|
# Auto-installed by hyperstitionstud_io.publishing.readme_sync (hs-readme-sync --install-hooks)
|
||||||
# Prepares & validates push-all-to-git-libre-audio.sh and deploy/sync-vps-repos.sh (Gates D1-D8),
|
# Path-aware pre-commit hook: runs deploy_scripts_sync & closeups_sync only when staged files
|
||||||
# re-renders homepage UI closeups when page UI elements change, and synchronizes root README.md before every commit.
|
# affect their respective surfaces, and synchronizes root README.md + shorthand_lint before every commit.
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
REPO_ROOT="$(git rev-parse --show-toplevel)"
|
REPO_ROOT="$(git rev-parse --show-toplevel)"
|
||||||
@@ -511,15 +490,20 @@ fi
|
|||||||
|
|
||||||
if [[ -d "${CORE_SRC}" ]]; then
|
if [[ -d "${CORE_SRC}" ]]; then
|
||||||
export PYTHONPATH="${CORE_SRC}${PYTHONPATH:+:${PYTHONPATH}}"
|
export PYTHONPATH="${CORE_SRC}${PYTHONPATH:+:${PYTHONPATH}}"
|
||||||
|
STAGED_FILES="$(git -C "${REPO_ROOT}" diff --cached --name-only || true)"
|
||||||
if [[ "${REPO_NAME}" == "hyperstitionstudio-core" ]]; then
|
if [[ "${REPO_NAME}" == "hyperstitionstudio-core" ]]; then
|
||||||
|
if printf '%s\n' "${STAGED_FILES}" | grep -Eq '^(deploy/|pyproject\\.toml|src/hyperstitionstud_io/__init__\\.py)'; then
|
||||||
"${PYTHON_BIN}" -m hyperstitionstud_io.ci.deploy_scripts_sync --workspace-root "${WS_ROOT}" --stage
|
"${PYTHON_BIN}" -m hyperstitionstud_io.ci.deploy_scripts_sync --workspace-root "${WS_ROOT}" --stage
|
||||||
else
|
else
|
||||||
"${PYTHON_BIN}" -m hyperstitionstud_io.ci.deploy_scripts_sync --workspace-root "${WS_ROOT}"
|
"${PYTHON_BIN}" -m hyperstitionstud_io.ci.deploy_scripts_sync --workspace-root "${WS_ROOT}" --check
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
|
if printf '%s\n' "${STAGED_FILES}" | grep -Eq '(^site/|^index\\.html$|^config\\.default\\.js$|^ci-audit-report\\.json$|^src/hyperstitionstud_io/(publishing|quant)/)'; then
|
||||||
"${PYTHON_BIN}" -m hyperstitionstud_io.publishing.closeups_sync
|
"${PYTHON_BIN}" -m hyperstitionstud_io.publishing.closeups_sync
|
||||||
if [[ -d "${WS_ROOT}/hyperstitionstudio-core/site/assets/closeups" ]] && [[ "${REPO_NAME}" == "hyperstitionstudio-core" ]]; then
|
if [[ -d "${WS_ROOT}/hyperstitionstudio-core/site/assets/closeups" ]] && [[ "${REPO_NAME}" == "hyperstitionstudio-core" ]]; then
|
||||||
git -C "${REPO_ROOT}" add site/assets/closeups/
|
git -C "${REPO_ROOT}" add site/assets/closeups/
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
"${PYTHON_BIN}" -m hyperstitionstud_io.publishing.readme_sync --repo "${REPO_NAME}" --stage
|
"${PYTHON_BIN}" -m hyperstitionstud_io.publishing.readme_sync --repo "${REPO_NAME}" --stage
|
||||||
"${PYTHON_BIN}" -m hyperstitionstud_io.ci.shorthand_lint --staged-diff --repo "${REPO_ROOT}"
|
"${PYTHON_BIN}" -m hyperstitionstud_io.ci.shorthand_lint --staged-diff --repo "${REPO_ROOT}"
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ from hyperstitionstud_io.ciphers import ( # noqa: E402
|
|||||||
is_repdigit_37,
|
is_repdigit_37,
|
||||||
prime_rank,
|
prime_rank,
|
||||||
)
|
)
|
||||||
from hyperstitionstud_io.config import load_workspace_config # noqa: E402
|
from hyperstitionstud_io.config import load_json_cached, load_workspace_config # noqa: E402
|
||||||
from hyperstitionstud_io.glossary import ReadOnlyIsolationGuard # noqa: E402
|
from hyperstitionstud_io.glossary import ReadOnlyIsolationGuard # noqa: E402
|
||||||
from hyperstitionstud_io.ipld import ( # noqa: E402
|
from hyperstitionstud_io.ipld import ( # noqa: E402
|
||||||
compute_dag_json_cidv1,
|
compute_dag_json_cidv1,
|
||||||
@@ -377,7 +377,7 @@ def _load_real_history_latest_bars() -> dict[str, dict[str, Any]]:
|
|||||||
if not hist_path.is_file():
|
if not hist_path.is_file():
|
||||||
return {}
|
return {}
|
||||||
try:
|
try:
|
||||||
raw = json.loads(hist_path.read_text(encoding="utf-8"))
|
raw = load_json_cached(hist_path, copy_result=False)
|
||||||
out: dict[str, dict[str, Any]] = {}
|
out: dict[str, dict[str, Any]] = {}
|
||||||
for sym, sym_obj in (raw.get("instruments") or {}).items():
|
for sym, sym_obj in (raw.get("instruments") or {}).items():
|
||||||
bars_by_date = sym_obj.get("bars_by_date") or {}
|
bars_by_date = sym_obj.get("bars_by_date") or {}
|
||||||
@@ -471,7 +471,7 @@ def build_financial_quant_harvest(
|
|||||||
cfg = load_workspace_config()
|
cfg = load_workspace_config()
|
||||||
with ReadOnlyIsolationGuard(cfg.read_only_files) as guard:
|
with ReadOnlyIsolationGuard(cfg.read_only_files) as guard:
|
||||||
if snapshot_path and Path(snapshot_path).is_file():
|
if snapshot_path and Path(snapshot_path).is_file():
|
||||||
raw_watchlist = json.loads(Path(snapshot_path).read_text(encoding="utf-8"))
|
raw_watchlist = load_json_cached(snapshot_path, copy_result=False)
|
||||||
else:
|
else:
|
||||||
raw_watchlist = fetch_live_watchlist(
|
raw_watchlist = fetch_live_watchlist(
|
||||||
CANONICAL_WATCHLIST_24,
|
CANONICAL_WATCHLIST_24,
|
||||||
@@ -497,7 +497,7 @@ def build_financial_quant_harvest(
|
|||||||
news_entities: dict[str, list[str]] = {}
|
news_entities: dict[str, list[str]] = {}
|
||||||
if effective_news_path.is_file():
|
if effective_news_path.is_file():
|
||||||
try:
|
try:
|
||||||
news_obj = json.loads(effective_news_path.read_text(encoding="utf-8"))
|
news_obj = load_json_cached(effective_news_path, copy_result=False)
|
||||||
headline_records: list[str] = []
|
headline_records: list[str] = []
|
||||||
for st in news_obj.get("stories", news_obj.get("headlines", [])):
|
for st in news_obj.get("stories", news_obj.get("headlines", [])):
|
||||||
if isinstance(st, dict):
|
if isinstance(st, dict):
|
||||||
@@ -856,7 +856,7 @@ def update_real_market_history_cache(
|
|||||||
cfg = load_workspace_config()
|
cfg = load_workspace_config()
|
||||||
h_path = Path(history_path) if history_path else (cfg.core_dir / "site" / "quant" / "real-market-history.json")
|
h_path = Path(history_path) if history_path else (cfg.core_dir / "site" / "quant" / "real-market-history.json")
|
||||||
if h_path.is_file():
|
if h_path.is_file():
|
||||||
doc = json.loads(h_path.read_text(encoding="utf-8"))
|
doc = load_json_cached(h_path, copy_result=True)
|
||||||
else:
|
else:
|
||||||
doc = {"version": CURRENT_VERSION, "synthetic_data_eliminated": True, "instruments": {}}
|
doc = {"version": CURRENT_VERSION, "synthetic_data_eliminated": True, "instruments": {}}
|
||||||
|
|
||||||
@@ -1034,7 +1034,7 @@ def snapshot_local_telemetry(
|
|||||||
src = q_dir / fname
|
src = q_dir / fname
|
||||||
if src.is_file():
|
if src.is_file():
|
||||||
try:
|
try:
|
||||||
json.loads(src.read_text(encoding="utf-8"))
|
load_json_cached(src, copy_result=False)
|
||||||
shutil.copy2(src, s_dir / fname)
|
shutil.copy2(src, s_dir / fname)
|
||||||
saved.append(fname)
|
saved.append(fname)
|
||||||
except Exception:
|
except Exception:
|
||||||
@@ -1046,7 +1046,7 @@ def snapshot_local_telemetry(
|
|||||||
snap_rmh_p = s_dir / "real-market-history.json"
|
snap_rmh_p = s_dir / "real-market-history.json"
|
||||||
if snap_rmh_p.is_file():
|
if snap_rmh_p.is_file():
|
||||||
try:
|
try:
|
||||||
base_rmh = json.loads(snap_rmh_p.read_text(encoding="utf-8"))
|
base_rmh = load_json_cached(snap_rmh_p, copy_result=True)
|
||||||
insts = base_rmh.setdefault("instruments", {})
|
insts = base_rmh.setdefault("instruments", {})
|
||||||
for hist_doc in _excavate_git_json_versions(cfg.core_dir, "site/quant/real-market-history.json"):
|
for hist_doc in _excavate_git_json_versions(cfg.core_dir, "site/quant/real-market-history.json"):
|
||||||
for sym, s_obj in (hist_doc.get("instruments") or {}).items():
|
for sym, s_obj in (hist_doc.get("instruments") or {}).items():
|
||||||
@@ -1102,8 +1102,8 @@ def reconcile_telemetry_snapshot(
|
|||||||
cur_hist_p = q_dir / "real-market-history.json"
|
cur_hist_p = q_dir / "real-market-history.json"
|
||||||
if snap_hist_p.is_file() and cur_hist_p.is_file():
|
if snap_hist_p.is_file() and cur_hist_p.is_file():
|
||||||
try:
|
try:
|
||||||
snap_hist = json.loads(snap_hist_p.read_text(encoding="utf-8"))
|
snap_hist = load_json_cached(snap_hist_p, copy_result=False)
|
||||||
cur_hist = json.loads(cur_hist_p.read_text(encoding="utf-8"))
|
cur_hist = load_json_cached(cur_hist_p, copy_result=True)
|
||||||
cur_insts = cur_hist.setdefault("instruments", {})
|
cur_insts = cur_hist.setdefault("instruments", {})
|
||||||
for sym, snap_obj in (snap_hist.get("instruments") or {}).items():
|
for sym, snap_obj in (snap_hist.get("instruments") or {}).items():
|
||||||
if sym == "ANTHR-PVT":
|
if sym == "ANTHR-PVT":
|
||||||
@@ -1139,8 +1139,8 @@ def reconcile_telemetry_snapshot(
|
|||||||
cur_macro_p = q_dir / "real-macro-indicators.json"
|
cur_macro_p = q_dir / "real-macro-indicators.json"
|
||||||
if snap_macro_p.is_file() and cur_macro_p.is_file():
|
if snap_macro_p.is_file() and cur_macro_p.is_file():
|
||||||
try:
|
try:
|
||||||
snap_macro = json.loads(snap_macro_p.read_text(encoding="utf-8"))
|
snap_macro = load_json_cached(snap_macro_p, copy_result=False)
|
||||||
cur_macro = json.loads(cur_macro_p.read_text(encoding="utf-8"))
|
cur_macro = load_json_cached(cur_macro_p, copy_result=True)
|
||||||
cur_series = cur_macro.setdefault("series", {})
|
cur_series = cur_macro.setdefault("series", {})
|
||||||
for s_key, snap_s in (snap_macro.get("series") or {}).items():
|
for s_key, snap_s in (snap_macro.get("series") or {}).items():
|
||||||
if s_key not in cur_series or not isinstance(snap_s, dict):
|
if s_key not in cur_series or not isinstance(snap_s, dict):
|
||||||
@@ -1201,7 +1201,7 @@ def reconcile_telemetry_snapshot(
|
|||||||
|
|
||||||
def main(argv: list[str] | None = None) -> int:
|
def main(argv: list[str] | None = None) -> int:
|
||||||
ap = argparse.ArgumentParser(prog="hs-quant-harvest", description="Periodic Quantitative Financial Telemetry & Contingent Meaning Collector.")
|
ap = argparse.ArgumentParser(prog="hs-quant-harvest", description="Periodic Quantitative Financial Telemetry & Contingent Meaning Collector.")
|
||||||
ap.add_argument("--mode", choices=["us-closing-bell", "utc-rollover"], default="us-closing-bell")
|
ap.add_argument("--mode", choices=["us-pre-market-open", "us-closing-bell", "utc-rollover"], default="us-closing-bell")
|
||||||
ap.add_argument("--from-snapshot", default=None, help="Optional offline JSON snapshot file.")
|
ap.add_argument("--from-snapshot", default=None, help="Optional offline JSON snapshot file.")
|
||||||
ap.add_argument("--live", action="store_true", help="Attempt live keyless HTTP fetch (Yahoo v8 / Stooq CSV / CoinGecko).")
|
ap.add_argument("--live", action="store_true", help="Attempt live keyless HTTP fetch (Yahoo v8 / Stooq CSV / CoinGecko).")
|
||||||
ap.add_argument("--append-history", action="store_true", help="Merge newly fetched real exchange bars into site/quant/real-market-history.json.")
|
ap.add_argument("--append-history", action="store_true", help="Merge newly fetched real exchange bars into site/quant/real-market-history.json.")
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ from pathlib import Path
|
|||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
from hyperstitionstud_io import __version__ as CURRENT_VERSION
|
from hyperstitionstud_io import __version__ as CURRENT_VERSION
|
||||||
from hyperstitionstud_io.config import load_workspace_config
|
from hyperstitionstud_io.config import load_json_cached, load_workspace_config
|
||||||
from hyperstitionstud_io.glossary import ReadOnlyIsolationGuard
|
from hyperstitionstud_io.glossary import ReadOnlyIsolationGuard
|
||||||
from hyperstitionstud_io.ipld import compute_dag_json_cidv1
|
from hyperstitionstud_io.ipld import compute_dag_json_cidv1
|
||||||
from hyperstitionstud_io.quant.collector import NO_DATA_AVAILABLE
|
from hyperstitionstud_io.quant.collector import NO_DATA_AVAILABLE
|
||||||
@@ -27,6 +27,28 @@ from hyperstitionstud_io.quant.macro import build_macro_indicators_bundle
|
|||||||
from hyperstitionstud_io.quant.timeseries import build_quant_timeseries_bundle
|
from hyperstitionstud_io.quant.timeseries import build_quant_timeseries_bundle
|
||||||
|
|
||||||
|
|
||||||
|
SESSION_WINDOWS = ("us-pre-market-open", "us-closing-bell", "utc-rollover")
|
||||||
|
|
||||||
|
|
||||||
|
def _resolve_session_window(
|
||||||
|
session_window: str | None = None,
|
||||||
|
now_utc: datetime.datetime | None = None,
|
||||||
|
) -> str:
|
||||||
|
if session_window and session_window != "auto":
|
||||||
|
if session_window not in SESSION_WINDOWS:
|
||||||
|
raise ValueError(f"Unsupported session_window {session_window!r}; expected one of {SESSION_WINDOWS} or 'auto'.")
|
||||||
|
return session_window
|
||||||
|
dt = now_utc or datetime.datetime.now(datetime.timezone.utc)
|
||||||
|
hour = dt.hour
|
||||||
|
if 13 <= hour <= 15:
|
||||||
|
return "us-pre-market-open"
|
||||||
|
if 21 <= hour <= 23:
|
||||||
|
return "us-closing-bell"
|
||||||
|
if 0 <= hour <= 2:
|
||||||
|
return "utc-rollover"
|
||||||
|
return "us-closing-bell"
|
||||||
|
|
||||||
|
|
||||||
def _find_latest_available_bar(inst: dict[str, Any]) -> dict[str, Any] | None:
|
def _find_latest_available_bar(inst: dict[str, Any]) -> dict[str, Any] | None:
|
||||||
bars = [b for b in (inst.get("bars") or []) if b.get("data_available") and b.get("close_usd") is not None]
|
bars = [b for b in (inst.get("bars") or []) if b.get("data_available") and b.get("close_usd") is not None]
|
||||||
return bars[-1] if bars else None
|
return bars[-1] if bars else None
|
||||||
@@ -143,8 +165,10 @@ def _compute_bayesian_regime_update(
|
|||||||
def build_daily_portfolio_brief(
|
def build_daily_portfolio_brief(
|
||||||
allow_live_network: bool = False,
|
allow_live_network: bool = False,
|
||||||
write_files: bool = True,
|
write_files: bool = True,
|
||||||
|
session_window: str | None = None,
|
||||||
) -> dict[str, Any]:
|
) -> dict[str, Any]:
|
||||||
cfg = load_workspace_config()
|
cfg = load_workspace_config()
|
||||||
|
resolved_window = _resolve_session_window(session_window)
|
||||||
ts_bundle = build_quant_timeseries_bundle(write_files=False)
|
ts_bundle = build_quant_timeseries_bundle(write_files=False)
|
||||||
macro_bundle = build_macro_indicators_bundle(allow_live_network=allow_live_network, write_files=False)
|
macro_bundle = build_macro_indicators_bundle(allow_live_network=allow_live_network, write_files=False)
|
||||||
|
|
||||||
@@ -162,7 +186,7 @@ def build_daily_portfolio_brief(
|
|||||||
active_read_state_path = state_path if state_path.is_file() else next((p for p in legacy_state_paths if p.is_file()), state_path)
|
active_read_state_path = state_path if state_path.is_file() else next((p for p in legacy_state_paths if p.is_file()), state_path)
|
||||||
if active_read_state_path.is_file():
|
if active_read_state_path.is_file():
|
||||||
try:
|
try:
|
||||||
prior_state = json.loads(active_read_state_path.read_text(encoding="utf-8"))
|
prior_state = load_json_cached(active_read_state_path, copy_result=False)
|
||||||
except Exception:
|
except Exception:
|
||||||
prior_state = {}
|
prior_state = {}
|
||||||
|
|
||||||
@@ -288,6 +312,7 @@ def build_daily_portfolio_brief(
|
|||||||
"$id": "urn:io:hyperstitionstud:schema:v1:daily-portfolio-brief",
|
"$id": "urn:io:hyperstitionstud:schema:v1:daily-portfolio-brief",
|
||||||
"version": CURRENT_VERSION,
|
"version": CURRENT_VERSION,
|
||||||
"run_number": run_number,
|
"run_number": run_number,
|
||||||
|
"session_window": resolved_window,
|
||||||
"generated_at_utc": datetime.datetime.now(datetime.timezone.utc).strftime("%Y-%m-%dT%H:%M:%SZ"),
|
"generated_at_utc": datetime.datetime.now(datetime.timezone.utc).strftime("%Y-%m-%dT%H:%M:%SZ"),
|
||||||
"synthetic_data_eliminated": True,
|
"synthetic_data_eliminated": True,
|
||||||
"agenda_1_executive_summary": {
|
"agenda_1_executive_summary": {
|
||||||
@@ -454,32 +479,62 @@ def build_daily_portfolio_brief(
|
|||||||
js_body = "// Auto-generated by hyperstitionstud_io.quant.daily_brief — DO NOT EDIT MANUALLY\nwindow.HYPERSTITION_DAILY_BRIEF = " + json.dumps(brief_payload, ensure_ascii=False) + ";\n"
|
js_body = "// Auto-generated by hyperstitionstud_io.quant.daily_brief — DO NOT EDIT MANUALLY\nwindow.HYPERSTITION_DAILY_BRIEF = " + json.dumps(brief_payload, ensure_ascii=False) + ";\n"
|
||||||
out_js_path.write_text(js_body, encoding="utf-8")
|
out_js_path.write_text(js_body, encoding="utf-8")
|
||||||
|
|
||||||
# Update append-only Bayesian state ledger outside read-only files (deduplicating same-day identical posteriors)
|
# Update append-only Bayesian state ledger outside read-only files
|
||||||
|
# Deduplicate entries matching BOTH calendar day (generated_at_utc[:10]) AND session_window
|
||||||
raw_history = list(prior_state.get("run_history") or [])
|
raw_history = list(prior_state.get("run_history") or [])
|
||||||
dedup_history: list[dict[str, Any]] = []
|
dedup_history: list[dict[str, Any]] = []
|
||||||
for entry in raw_history:
|
for entry in raw_history:
|
||||||
if not isinstance(entry, dict):
|
if not isinstance(entry, dict):
|
||||||
continue
|
continue
|
||||||
e_dt = str(entry.get("generated_at_utc") or "")[:10]
|
e_dt = str(entry.get("generated_at_utc") or "")[:10]
|
||||||
|
e_win = entry.get("session_window")
|
||||||
e_post = entry.get("posterior_probabilities")
|
e_post = entry.get("posterior_probabilities")
|
||||||
if dedup_history and str(dedup_history[-1].get("generated_at_utc") or "")[:10] == e_dt and dedup_history[-1].get("posterior_probabilities") == e_post:
|
if e_win is not None:
|
||||||
|
match_idx = next(
|
||||||
|
(
|
||||||
|
i
|
||||||
|
for i, prev in enumerate(dedup_history)
|
||||||
|
if str(prev.get("generated_at_utc") or "")[:10] == e_dt and prev.get("session_window") == e_win
|
||||||
|
),
|
||||||
|
None,
|
||||||
|
)
|
||||||
|
if match_idx is not None:
|
||||||
|
dedup_history[match_idx] = entry
|
||||||
|
else:
|
||||||
|
dedup_history.append(entry)
|
||||||
|
elif (
|
||||||
|
dedup_history
|
||||||
|
and dedup_history[-1].get("session_window") is None
|
||||||
|
and str(dedup_history[-1].get("generated_at_utc") or "")[:10] == e_dt
|
||||||
|
and dedup_history[-1].get("posterior_probabilities") == e_post
|
||||||
|
):
|
||||||
dedup_history[-1] = entry
|
dedup_history[-1] = entry
|
||||||
else:
|
else:
|
||||||
dedup_history.append(entry)
|
dedup_history.append(entry)
|
||||||
cur_dt_10 = str(brief_payload["generated_at_utc"])[:10]
|
cur_dt_10 = str(brief_payload["generated_at_utc"])[:10]
|
||||||
cur_post = bayesian_block["posterior_probabilities"]
|
cur_post = bayesian_block["posterior_probabilities"]
|
||||||
if dedup_history and str(dedup_history[-1].get("generated_at_utc") or "")[:10] == cur_dt_10 and dedup_history[-1].get("posterior_probabilities") == cur_post:
|
cur_match_idx = next(
|
||||||
dedup_history[-1] = {
|
(
|
||||||
"run_number": int(dedup_history[-1].get("run_number") or len(dedup_history)),
|
i
|
||||||
|
for i, prev in enumerate(dedup_history)
|
||||||
|
if str(prev.get("generated_at_utc") or "")[:10] == cur_dt_10 and prev.get("session_window") == resolved_window
|
||||||
|
),
|
||||||
|
None,
|
||||||
|
)
|
||||||
|
if cur_match_idx is not None:
|
||||||
|
dedup_history[cur_match_idx] = {
|
||||||
|
"run_number": int(dedup_history[cur_match_idx].get("run_number") or (cur_match_idx + 1)),
|
||||||
|
"session_window": resolved_window,
|
||||||
"generated_at_utc": brief_payload["generated_at_utc"],
|
"generated_at_utc": brief_payload["generated_at_utc"],
|
||||||
"posterior_probabilities": cur_post,
|
"posterior_probabilities": cur_post,
|
||||||
"question_id": str(dedup_history[-1].get("question_id") or current_question["question_id"]),
|
"question_id": str(dedup_history[cur_match_idx].get("question_id") or current_question["question_id"]),
|
||||||
"cidv1": brief_payload["ipld_dag_json_cidv1"]["/"],
|
"cidv1": brief_payload["ipld_dag_json_cidv1"]["/"],
|
||||||
}
|
}
|
||||||
else:
|
else:
|
||||||
next_run_num = (int(dedup_history[-1].get("run_number") or len(dedup_history)) + 1) if dedup_history else 1
|
next_run_num = (int(dedup_history[-1].get("run_number") or len(dedup_history)) + 1) if dedup_history else 1
|
||||||
dedup_history.append({
|
dedup_history.append({
|
||||||
"run_number": next_run_num,
|
"run_number": next_run_num,
|
||||||
|
"session_window": resolved_window,
|
||||||
"generated_at_utc": brief_payload["generated_at_utc"],
|
"generated_at_utc": brief_payload["generated_at_utc"],
|
||||||
"posterior_probabilities": cur_post,
|
"posterior_probabilities": cur_post,
|
||||||
"question_id": f"Q-RUN-{next_run_num:04d}",
|
"question_id": f"Q-RUN-{next_run_num:04d}",
|
||||||
@@ -492,10 +547,11 @@ def build_daily_portfolio_brief(
|
|||||||
new_state = {
|
new_state = {
|
||||||
"version": CURRENT_VERSION,
|
"version": CURRENT_VERSION,
|
||||||
"run_number": effective_run_number,
|
"run_number": effective_run_number,
|
||||||
|
"session_window": resolved_window,
|
||||||
"updated_at_utc": brief_payload["generated_at_utc"],
|
"updated_at_utc": brief_payload["generated_at_utc"],
|
||||||
"latest_posteriors": bayesian_block["posterior_probabilities"],
|
"latest_posteriors": bayesian_block["posterior_probabilities"],
|
||||||
"active_daily_question": current_question,
|
"active_daily_question": current_question,
|
||||||
"run_history": dedup_history[-30:],
|
"run_history": dedup_history[-60:],
|
||||||
}
|
}
|
||||||
state_path.parent.mkdir(parents=True, exist_ok=True)
|
state_path.parent.mkdir(parents=True, exist_ok=True)
|
||||||
state_path.write_text(json.dumps(new_state, indent=2, ensure_ascii=False) + "\n", encoding="utf-8")
|
state_path.write_text(json.dumps(new_state, indent=2, ensure_ascii=False) + "\n", encoding="utf-8")
|
||||||
@@ -506,14 +562,27 @@ def build_daily_portfolio_brief(
|
|||||||
def main(argv: list[str] | None = None) -> int:
|
def main(argv: list[str] | None = None) -> int:
|
||||||
ap = argparse.ArgumentParser(prog="hs-daily-brief", description="Generate the 5-Agenda Zero-Synthetic-Data Daily Portfolio & Memetic Regime Update.")
|
ap = argparse.ArgumentParser(prog="hs-daily-brief", description="Generate the 5-Agenda Zero-Synthetic-Data Daily Portfolio & Memetic Regime Update.")
|
||||||
ap.add_argument("--live-macro", action="store_true", help="Fetch fresh FRED CSV series before computing the daily brief.")
|
ap.add_argument("--live-macro", action="store_true", help="Fetch fresh FRED CSV series before computing the daily brief.")
|
||||||
|
ap.add_argument(
|
||||||
|
"--window",
|
||||||
|
"--session-window",
|
||||||
|
dest="session_window",
|
||||||
|
choices=["auto", "us-pre-market-open", "us-closing-bell", "utc-rollover"],
|
||||||
|
default="auto",
|
||||||
|
help="Session window tag (default: auto-detected from UTC hour).",
|
||||||
|
)
|
||||||
args = ap.parse_args(argv)
|
args = ap.parse_args(argv)
|
||||||
brief = build_daily_portfolio_brief(allow_live_network=args.live_macro, write_files=True)
|
brief = build_daily_portfolio_brief(
|
||||||
|
allow_live_network=args.live_macro,
|
||||||
|
write_files=True,
|
||||||
|
session_window=args.session_window,
|
||||||
|
)
|
||||||
print(
|
print(
|
||||||
json.dumps(
|
json.dumps(
|
||||||
{
|
{
|
||||||
"ok": True,
|
"ok": True,
|
||||||
"version": brief["version"],
|
"version": brief["version"],
|
||||||
"run_number": brief["run_number"],
|
"run_number": brief["run_number"],
|
||||||
|
"session_window": brief["session_window"],
|
||||||
"posteriors": brief["agenda_1_executive_summary"]["bayesian_regime_inference"]["posterior_probabilities"],
|
"posteriors": brief["agenda_1_executive_summary"]["bayesian_regime_inference"]["posterior_probabilities"],
|
||||||
"question_id": brief["agenda_5_daily_key_macro_question_and_rigor"]["active_daily_question"]["question_id"],
|
"question_id": brief["agenda_5_daily_key_macro_question_and_rigor"]["active_daily_question"]["question_id"],
|
||||||
"cidv1": brief["ipld_dag_json_cidv1"]["/"],
|
"cidv1": brief["ipld_dag_json_cidv1"]["/"],
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ from typing import Any
|
|||||||
|
|
||||||
from hyperstitionstud_io import __version__ as CURRENT_VERSION
|
from hyperstitionstud_io import __version__ as CURRENT_VERSION
|
||||||
from hyperstitionstud_io.ciphers import compute_aq, int_to_spoken_words, prime_rank
|
from hyperstitionstud_io.ciphers import compute_aq, int_to_spoken_words, prime_rank
|
||||||
from hyperstitionstud_io.config import load_workspace_config
|
from hyperstitionstud_io.config import load_json_cached, load_workspace_config
|
||||||
from hyperstitionstud_io.glossary import ReadOnlyIsolationGuard
|
from hyperstitionstud_io.glossary import ReadOnlyIsolationGuard
|
||||||
from hyperstitionstud_io.ipld import compute_dag_json_cidv1
|
from hyperstitionstud_io.ipld import compute_dag_json_cidv1
|
||||||
from hyperstitionstud_io.phonetics import translate_batch
|
from hyperstitionstud_io.phonetics import translate_batch
|
||||||
@@ -328,7 +328,7 @@ def build_macro_indicators_bundle(
|
|||||||
cached_bundle: dict[str, Any] = {}
|
cached_bundle: dict[str, Any] = {}
|
||||||
if cache_path.is_file():
|
if cache_path.is_file():
|
||||||
try:
|
try:
|
||||||
cached_bundle = json.loads(cache_path.read_text(encoding="utf-8"))
|
cached_bundle = load_json_cached(cache_path, copy_result=False)
|
||||||
except Exception:
|
except Exception:
|
||||||
cached_bundle = {}
|
cached_bundle = {}
|
||||||
|
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ from hyperstitionstud_io.ciphers import (
|
|||||||
is_repdigit_37,
|
is_repdigit_37,
|
||||||
prime_rank,
|
prime_rank,
|
||||||
)
|
)
|
||||||
from hyperstitionstud_io.config import load_workspace_config
|
from hyperstitionstud_io.config import load_json_cached, load_workspace_config
|
||||||
from hyperstitionstud_io.glossary import ReadOnlyIsolationGuard
|
from hyperstitionstud_io.glossary import ReadOnlyIsolationGuard
|
||||||
from hyperstitionstud_io.ipld import compute_dag_json_cidv1, write_pretty_and_dag_json
|
from hyperstitionstud_io.ipld import compute_dag_json_cidv1, write_pretty_and_dag_json
|
||||||
from hyperstitionstud_io.lenses import DEFAULT_LENS, ENABLED_LENSES, LENS_REGISTRY, apply_all_lenses
|
from hyperstitionstud_io.lenses import DEFAULT_LENS, ENABLED_LENSES, LENS_REGISTRY, apply_all_lenses
|
||||||
@@ -256,7 +256,7 @@ def _load_real_market_history_bars(cfg: Any) -> dict[str, dict[str, dict[str, An
|
|||||||
if not hist_path.is_file():
|
if not hist_path.is_file():
|
||||||
return {}
|
return {}
|
||||||
try:
|
try:
|
||||||
raw = json.loads(hist_path.read_text(encoding="utf-8"))
|
raw = load_json_cached(hist_path, copy_result=False)
|
||||||
out: dict[str, dict[str, dict[str, Any]]] = {}
|
out: dict[str, dict[str, dict[str, Any]]] = {}
|
||||||
for sym, sym_obj in (raw.get("instruments") or {}).items():
|
for sym, sym_obj in (raw.get("instruments") or {}).items():
|
||||||
out[sym] = dict(sym_obj.get("bars_by_date") or {})
|
out[sym] = dict(sym_obj.get("bars_by_date") or {})
|
||||||
@@ -809,7 +809,7 @@ def build_quant_timeseries_bundle(
|
|||||||
tl_path = cfg.zoology_dir / "taxonomy" / "assemblage-builds-tier-list.json"
|
tl_path = cfg.zoology_dir / "taxonomy" / "assemblage-builds-tier-list.json"
|
||||||
builds_out: list[dict[str, Any]] = []
|
builds_out: list[dict[str, Any]] = []
|
||||||
if tl_path.is_file():
|
if tl_path.is_file():
|
||||||
tl_data = json.loads(tl_path.read_text(encoding="utf-8"))
|
tl_data = load_json_cached(tl_path, copy_result=False)
|
||||||
for row in tl_data.get("rows", []):
|
for row in tl_data.get("rows", []):
|
||||||
s6 = row.get("stats_6") or {}
|
s6 = row.get("stats_6") or {}
|
||||||
b_struct = {
|
b_struct = {
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ if _SRC_DIR.is_dir() and str(_SRC_DIR) not in sys.path:
|
|||||||
sys.path.insert(0, str(_SRC_DIR))
|
sys.path.insert(0, str(_SRC_DIR))
|
||||||
|
|
||||||
from hyperstitionstud_io import __version__ as CURRENT_VERSION # noqa: E402
|
from hyperstitionstud_io import __version__ as CURRENT_VERSION # noqa: E402
|
||||||
from hyperstitionstud_io.config import load_workspace_config # noqa: E402
|
from hyperstitionstud_io.config import load_workspace_config, run_git_stdout # noqa: E402
|
||||||
|
|
||||||
SEMVER_RE = r"\d+\.\d+\.\d+"
|
SEMVER_RE = r"\d+\.\d+\.\d+"
|
||||||
|
|
||||||
@@ -122,18 +122,6 @@ def evaluate_change_scope_heuristics(signals: dict[str, Any]) -> dict[str, Any]:
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
def _git_run(repo_dir: Path, args: list[str]) -> str:
|
|
||||||
if not (repo_dir / ".git").exists():
|
|
||||||
return ""
|
|
||||||
proc = subprocess.run(
|
|
||||||
["git", "-C", str(repo_dir), *args],
|
|
||||||
capture_output=True,
|
|
||||||
text=True,
|
|
||||||
check=False,
|
|
||||||
)
|
|
||||||
return proc.stdout.strip() if proc.returncode == 0 else ""
|
|
||||||
|
|
||||||
|
|
||||||
def _extract_archived_plan_ids_from_text(text: str) -> set[str]:
|
def _extract_archived_plan_ids_from_text(text: str) -> set[str]:
|
||||||
return set(re.findall(r"\bPLAN-[A-Z0-9-]+\b", text))
|
return set(re.findall(r"\bPLAN-[A-Z0-9-]+\b", text))
|
||||||
|
|
||||||
@@ -165,7 +153,7 @@ def collect_workspace_change_signals(ws_root: Path | None = None) -> dict[str, A
|
|||||||
if m_v:
|
if m_v:
|
||||||
current_v = m_v.group(1)
|
current_v = m_v.group(1)
|
||||||
|
|
||||||
baseline_tag = _git_run(core, ["describe", "--tags", "--abbrev=0"]) or f"v{current_v}"
|
baseline_tag = run_git_stdout(core, ["describe", "--tags", "--abbrev=0"]) or f"v{current_v}"
|
||||||
|
|
||||||
repo_dirs = [
|
repo_dirs = [
|
||||||
core,
|
core,
|
||||||
@@ -173,7 +161,7 @@ def collect_workspace_change_signals(ws_root: Path | None = None) -> dict[str, A
|
|||||||
cfg.zoology_dir,
|
cfg.zoology_dir,
|
||||||
kg,
|
kg,
|
||||||
cfg.paths["gematria_js_dir"],
|
cfg.paths["gematria_js_dir"],
|
||||||
cfg.paths.get("ci_repo_dir", cfg.workspace_root / "hyperdope-ci-build"),
|
cfg.ci_build_dir,
|
||||||
]
|
]
|
||||||
repo_diff_summary: dict[str, dict[str, int]] = {}
|
repo_diff_summary: dict[str, dict[str, int]] = {}
|
||||||
total_dirty = 0
|
total_dirty = 0
|
||||||
@@ -181,12 +169,12 @@ def collect_workspace_change_signals(ws_root: Path | None = None) -> dict[str, A
|
|||||||
for rdir in repo_dirs:
|
for rdir in repo_dirs:
|
||||||
if not rdir.is_dir():
|
if not rdir.is_dir():
|
||||||
continue
|
continue
|
||||||
porcelain = _git_run(rdir, ["status", "--porcelain"])
|
porcelain = run_git_stdout(rdir, ["status", "--porcelain"])
|
||||||
dirty_cnt = len([ln for ln in porcelain.splitlines() if ln.strip()]) if porcelain else 0
|
dirty_cnt = len([ln for ln in porcelain.splitlines() if ln.strip()]) if porcelain else 0
|
||||||
rtag = _git_run(rdir, ["describe", "--tags", "--abbrev=0"])
|
rtag = run_git_stdout(rdir, ["describe", "--tags", "--abbrev=0"])
|
||||||
ahead_cnt = 0
|
ahead_cnt = 0
|
||||||
if rtag:
|
if rtag:
|
||||||
ahead_str = _git_run(rdir, ["rev-list", f"{rtag}..HEAD", "--count"])
|
ahead_str = run_git_stdout(rdir, ["rev-list", f"{rtag}..HEAD", "--count"])
|
||||||
ahead_cnt = int(ahead_str) if ahead_str.isdigit() else 0
|
ahead_cnt = int(ahead_str) if ahead_str.isdigit() else 0
|
||||||
repo_diff_summary[rdir.name] = {
|
repo_diff_summary[rdir.name] = {
|
||||||
"dirty_files": dirty_cnt,
|
"dirty_files": dirty_cnt,
|
||||||
@@ -209,15 +197,15 @@ def collect_workspace_change_signals(ws_root: Path | None = None) -> dict[str, A
|
|||||||
current_archived_plans |= _extract_archived_plan_ids_from_text(p.name)
|
current_archived_plans |= _extract_archived_plan_ids_from_text(p.name)
|
||||||
|
|
||||||
baseline_archived_plans: set[str] = set()
|
baseline_archived_plans: set[str] = set()
|
||||||
kg_tag = _git_run(kg, ["describe", "--tags", "--abbrev=0"]) or baseline_tag
|
kg_tag = run_git_stdout(kg, ["describe", "--tags", "--abbrev=0"]) or baseline_tag
|
||||||
if kg_tag:
|
if kg_tag:
|
||||||
old_manifest = _git_run(kg, ["show", f"{kg_tag}:docs/archive/archive-manifest.json"])
|
old_manifest = run_git_stdout(kg, ["show", f"{kg_tag}:docs/archive/archive-manifest.json"])
|
||||||
if old_manifest:
|
if old_manifest:
|
||||||
baseline_archived_plans |= _extract_archived_plan_ids_from_text(old_manifest)
|
baseline_archived_plans |= _extract_archived_plan_ids_from_text(old_manifest)
|
||||||
old_readme = _git_run(kg, ["show", f"{kg_tag}:docs/archive/README.md"])
|
old_readme = run_git_stdout(kg, ["show", f"{kg_tag}:docs/archive/README.md"])
|
||||||
if old_readme:
|
if old_readme:
|
||||||
baseline_archived_plans |= _extract_archived_plan_ids_from_text(old_readme)
|
baseline_archived_plans |= _extract_archived_plan_ids_from_text(old_readme)
|
||||||
old_ls = _git_run(kg, ["ls-tree", "--name-only", kg_tag, "docs/archive/"])
|
old_ls = run_git_stdout(kg, ["ls-tree", "--name-only", kg_tag, "docs/archive/"])
|
||||||
if old_ls:
|
if old_ls:
|
||||||
baseline_archived_plans |= _extract_archived_plan_ids_from_text(old_ls)
|
baseline_archived_plans |= _extract_archived_plan_ids_from_text(old_ls)
|
||||||
|
|
||||||
@@ -239,22 +227,22 @@ def collect_workspace_change_signals(ws_root: Path | None = None) -> dict[str, A
|
|||||||
# 3. CLI entrypoints (`pyproject.toml`), MCP tools (`mcp/tools.py`), JSON schemas (`schemas/v1/`), & subpages (`site/<slug>/index.html`)
|
# 3. CLI entrypoints (`pyproject.toml`), MCP tools (`mcp/tools.py`), JSON schemas (`schemas/v1/`), & subpages (`site/<slug>/index.html`)
|
||||||
pyproj_p = core / "pyproject.toml"
|
pyproj_p = core / "pyproject.toml"
|
||||||
cur_scripts = _extract_cli_scripts_from_pyproject(pyproj_p.read_text(encoding="utf-8")) if pyproj_p.is_file() else set()
|
cur_scripts = _extract_cli_scripts_from_pyproject(pyproj_p.read_text(encoding="utf-8")) if pyproj_p.is_file() else set()
|
||||||
old_pyproj = _git_run(core, ["show", f"{baseline_tag}:pyproject.toml"])
|
old_pyproj = run_git_stdout(core, ["show", f"{baseline_tag}:pyproject.toml"])
|
||||||
old_scripts = _extract_cli_scripts_from_pyproject(old_pyproj) if old_pyproj else cur_scripts
|
old_scripts = _extract_cli_scripts_from_pyproject(old_pyproj) if old_pyproj else cur_scripts
|
||||||
|
|
||||||
tools_p = core / "src" / "hyperstitionstud_io" / "mcp" / "tools.py"
|
tools_p = core / "src" / "hyperstitionstud_io" / "mcp" / "tools.py"
|
||||||
cur_tools = _extract_mcp_tool_names(tools_p.read_text(encoding="utf-8")) if tools_p.is_file() else set()
|
cur_tools = _extract_mcp_tool_names(tools_p.read_text(encoding="utf-8")) if tools_p.is_file() else set()
|
||||||
old_tools_txt = _git_run(core, ["show", f"{baseline_tag}:src/hyperstitionstud_io/mcp/tools.py"])
|
old_tools_txt = run_git_stdout(core, ["show", f"{baseline_tag}:src/hyperstitionstud_io/mcp/tools.py"])
|
||||||
old_tools = _extract_mcp_tool_names(old_tools_txt) if old_tools_txt else cur_tools
|
old_tools = _extract_mcp_tool_names(old_tools_txt) if old_tools_txt else cur_tools
|
||||||
|
|
||||||
schemas_dir = core / "schemas" / "v1"
|
schemas_dir = core / "schemas" / "v1"
|
||||||
cur_schemas = {p.name for p in schemas_dir.glob("*.schema.json")} if schemas_dir.is_dir() else set()
|
cur_schemas = {p.name for p in schemas_dir.glob("*.schema.json")} if schemas_dir.is_dir() else set()
|
||||||
old_schemas_ls = _git_run(core, ["ls-tree", "--name-only", baseline_tag, "schemas/v1/"])
|
old_schemas_ls = run_git_stdout(core, ["ls-tree", "--name-only", baseline_tag, "schemas/v1/"])
|
||||||
old_schemas = {Path(ln).name for ln in old_schemas_ls.splitlines() if ln.endswith(".schema.json")} if old_schemas_ls else cur_schemas
|
old_schemas = {Path(ln).name for ln in old_schemas_ls.splitlines() if ln.endswith(".schema.json")} if old_schemas_ls else cur_schemas
|
||||||
|
|
||||||
site_dir = core / "site"
|
site_dir = core / "site"
|
||||||
cur_subpages = {p.parent.name for p in site_dir.glob("*/index.html")} if site_dir.is_dir() else set()
|
cur_subpages = {p.parent.name for p in site_dir.glob("*/index.html")} if site_dir.is_dir() else set()
|
||||||
old_site_ls = _git_run(core, ["ls-tree", "-r", "--name-only", baseline_tag, "site/"])
|
old_site_ls = run_git_stdout(core, ["ls-tree", "-r", "--name-only", baseline_tag, "site/"])
|
||||||
old_subpages = {
|
old_subpages = {
|
||||||
Path(ln).parts[1]
|
Path(ln).parts[1]
|
||||||
for ln in old_site_ls.splitlines()
|
for ln in old_site_ls.splitlines()
|
||||||
@@ -491,12 +479,14 @@ def sync_workspace_version(target_version: str, check_only: bool = False, ws_roo
|
|||||||
path.write_text(updated, encoding="utf-8")
|
path.write_text(updated, encoding="utf-8")
|
||||||
modified_files.append(str(path))
|
modified_files.append(str(path))
|
||||||
|
|
||||||
if not check_only:
|
|
||||||
ws_toml = cfg.workspace_root / "workspace.toml"
|
ws_toml = cfg.workspace_root / "workspace.toml"
|
||||||
if ws_toml.is_file():
|
if ws_toml.is_file():
|
||||||
orig_ws = ws_toml.read_text(encoding="utf-8")
|
orig_ws = ws_toml.read_text(encoding="utf-8")
|
||||||
upd_ws = re.sub(rf'schema_version\s*=\s*"{SEMVER_RE}"', f'schema_version = "{v}"', orig_ws, flags=re.M)
|
upd_ws = re.sub(rf'schema_version\s*=\s*"{SEMVER_RE}"', f'schema_version = "{v}"', orig_ws, flags=re.M)
|
||||||
if upd_ws != orig_ws:
|
if upd_ws != orig_ws:
|
||||||
|
if check_only:
|
||||||
|
mismatched_files.append(str(ws_toml))
|
||||||
|
else:
|
||||||
ws_toml.write_text(upd_ws, encoding="utf-8")
|
ws_toml.write_text(upd_ws, encoding="utf-8")
|
||||||
modified_files.append(str(ws_toml))
|
modified_files.append(str(ws_toml))
|
||||||
|
|
||||||
|
|||||||
+115
-7
@@ -106,7 +106,7 @@ def test_offline_urn_namespaces_and_no_external_https_fonts() -> None:
|
|||||||
cfg.zoology_dir,
|
cfg.zoology_dir,
|
||||||
cfg.knowledge_graph_dir,
|
cfg.knowledge_graph_dir,
|
||||||
cfg.paths["gematria_js_dir"],
|
cfg.paths["gematria_js_dir"],
|
||||||
cfg.paths.get("ci_repo_dir", cfg.workspace_root / "hyperdope-ci-build"),
|
cfg.ci_build_dir,
|
||||||
):
|
):
|
||||||
if not rdir.is_dir():
|
if not rdir.is_dir():
|
||||||
continue
|
continue
|
||||||
@@ -212,8 +212,27 @@ def test_local_config_citation_resolution_and_proposals() -> None:
|
|||||||
|
|
||||||
|
|
||||||
def test_doctor_all_checks_pass() -> None:
|
def test_doctor_all_checks_pass() -> None:
|
||||||
|
from hyperstitionstud_io import __version__ as cur_ver
|
||||||
|
from hyperstitionstud_io.config import (
|
||||||
|
normalize_workspace_relpath,
|
||||||
|
resolve_workspace_repo_dir,
|
||||||
|
)
|
||||||
|
|
||||||
diag = run_diagnostics()
|
diag = run_diagnostics()
|
||||||
assert diag["all_checks_passed"] is True
|
assert diag["all_checks_passed"] is True
|
||||||
|
assert diag["schema_version"] == cur_ver
|
||||||
|
|
||||||
|
cfg = load_workspace_config()
|
||||||
|
assert cfg.schema_version == cur_ver
|
||||||
|
assert cfg.ci_build_dir.is_dir()
|
||||||
|
assert (
|
||||||
|
resolve_workspace_repo_dir(cfg.workspace_root, "hyperdope-ci-build")
|
||||||
|
== resolve_workspace_repo_dir(cfg.workspace_root, "ingglish-hyperdope-ci")
|
||||||
|
)
|
||||||
|
assert (
|
||||||
|
normalize_workspace_relpath(cfg.core_dir / "deploy" / "sync-vps-repos.sh", workspace_root=cfg.workspace_root)
|
||||||
|
== "/workspace/hyperstitionstudio-core/deploy/sync-vps-repos.sh"
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
def test_ipld_quant_and_mcp_server() -> None:
|
def test_ipld_quant_and_mcp_server() -> None:
|
||||||
@@ -931,6 +950,10 @@ def test_ipld_quant_and_mcp_server() -> None:
|
|||||||
|
|
||||||
vps_prod_sh = cfg_test.core_dir / "deploy" / "run-vps-data-production.sh"
|
vps_prod_sh = cfg_test.core_dir / "deploy" / "run-vps-data-production.sh"
|
||||||
assert vps_prod_sh.is_file() and "/dev/null" not in vps_prod_sh.read_text(encoding="utf-8")
|
assert vps_prod_sh.is_file() and "/dev/null" not in vps_prod_sh.read_text(encoding="utf-8")
|
||||||
|
vps_prod_txt = vps_prod_sh.read_text(encoding="utf-8")
|
||||||
|
assert "--window=auto" in vps_prod_txt or '--window=*' in vps_prod_txt
|
||||||
|
assert "us-pre-market-open" in vps_prod_txt
|
||||||
|
assert '--window "${WINDOW_MODE}"' in vps_prod_txt
|
||||||
for u_name in (
|
for u_name in (
|
||||||
"hyperstition-closing-bell-harvest.service",
|
"hyperstition-closing-bell-harvest.service",
|
||||||
"hyperstition-closing-bell-harvest.timer",
|
"hyperstition-closing-bell-harvest.timer",
|
||||||
@@ -939,6 +962,63 @@ def test_ipld_quant_and_mcp_server() -> None:
|
|||||||
):
|
):
|
||||||
assert (cfg_test.core_dir / "deploy" / u_name).is_file()
|
assert (cfg_test.core_dir / "deploy" / u_name).is_file()
|
||||||
|
|
||||||
|
# Verify Plan #72: Dual-Calendar Pre-Market-Open Timer & Session-Window Brief Deduplication
|
||||||
|
cb_timer_txt = (cfg_test.core_dir / "deploy" / "hyperstition-closing-bell-harvest.timer").read_text(encoding="utf-8")
|
||||||
|
assert "OnCalendar=Mon..Fri *-*-* 14:00:00 UTC" in cb_timer_txt
|
||||||
|
assert "OnCalendar=Mon..Fri *-*-* 21:30:00 UTC" in cb_timer_txt
|
||||||
|
cb_svc_txt = (cfg_test.core_dir / "deploy" / "hyperstition-closing-bell-harvest.service").read_text(encoding="utf-8")
|
||||||
|
assert "--window=auto" in cb_svc_txt
|
||||||
|
|
||||||
|
import datetime as _dt
|
||||||
|
from types import SimpleNamespace
|
||||||
|
from unittest.mock import patch as _mock_patch
|
||||||
|
from hyperstitionstud_io.quant.collector import build_financial_quant_harvest as _bfqh
|
||||||
|
from hyperstitionstud_io.quant.daily_brief import (
|
||||||
|
_resolve_session_window,
|
||||||
|
build_daily_portfolio_brief,
|
||||||
|
)
|
||||||
|
|
||||||
|
assert _bfqh(harvest_mode="us-pre-market-open", live_fetch=False)["harvest_mode"] == "us-pre-market-open"
|
||||||
|
assert _resolve_session_window("auto", _dt.datetime(2026, 12, 2, 14, 0, tzinfo=_dt.timezone.utc)) == "us-pre-market-open"
|
||||||
|
assert _resolve_session_window("auto", _dt.datetime(2026, 12, 2, 21, 30, tzinfo=_dt.timezone.utc)) == "us-closing-bell"
|
||||||
|
assert _resolve_session_window("auto", _dt.datetime(2026, 12, 2, 0, 5, tzinfo=_dt.timezone.utc)) == "utc-rollover"
|
||||||
|
|
||||||
|
tmp_brief_core = tmp_path / "brief_core_tmp"
|
||||||
|
(tmp_brief_core / "site" / "quant").mkdir(parents=True, exist_ok=True)
|
||||||
|
seed_hist = [
|
||||||
|
{
|
||||||
|
"run_number": idx + 1,
|
||||||
|
"session_window": "us-closing-bell",
|
||||||
|
"generated_at_utc": "",
|
||||||
|
"posterior_probabilities": {"R1_BULL_RISK_ON": 0.25, "R2_PINNED_ISOMETRIC": 0.50, "R3_TAIL_DRAWDOWN_RISK_OFF": 0.25},
|
||||||
|
"question_id": f"Q-RUN-{idx + 1:04d}",
|
||||||
|
"cidv1": f"baguqeeraseed{idx:04d}",
|
||||||
|
}
|
||||||
|
for idx in range(62)
|
||||||
|
]
|
||||||
|
# Ensure unique dates in seed_hist so none collide with each other
|
||||||
|
base_seed_dt = _dt.date(2026, 9, 1)
|
||||||
|
for idx, item in enumerate(seed_hist):
|
||||||
|
item["generated_at_utc"] = (base_seed_dt + _dt.timedelta(days=idx)).strftime("%Y-%m-%dT21:30:00Z")
|
||||||
|
(tmp_brief_core / "site" / "quant" / "daily-brief-state.json").write_text(
|
||||||
|
json.dumps({"version": "2.18.0", "run_number": 62, "run_history": seed_hist}, indent=2),
|
||||||
|
encoding="utf-8",
|
||||||
|
)
|
||||||
|
fake_cfg = SimpleNamespace(core_dir=tmp_brief_core, archive_dir=cfg_test.archive_dir, read_only_files=())
|
||||||
|
with _mock_patch("hyperstitionstud_io.quant.daily_brief.load_workspace_config", return_value=fake_cfg):
|
||||||
|
b_am = build_daily_portfolio_brief(allow_live_network=False, write_files=True, session_window="us-pre-market-open")
|
||||||
|
assert b_am["session_window"] == "us-pre-market-open"
|
||||||
|
b_pm = build_daily_portfolio_brief(allow_live_network=False, write_files=True, session_window="us-closing-bell")
|
||||||
|
assert b_pm["session_window"] == "us-closing-bell"
|
||||||
|
b_am_dup = build_daily_portfolio_brief(allow_live_network=False, write_files=True, session_window="us-pre-market-open")
|
||||||
|
assert b_am_dup["session_window"] == "us-pre-market-open"
|
||||||
|
|
||||||
|
brief_state_out = json.loads((tmp_brief_core / "site" / "quant" / "daily-brief-state.json").read_text(encoding="utf-8"))
|
||||||
|
assert len(brief_state_out["run_history"]) == 60
|
||||||
|
today_10 = b_am["generated_at_utc"][:10]
|
||||||
|
today_entries = [x for x in brief_state_out["run_history"] if x["generated_at_utc"][:10] == today_10]
|
||||||
|
assert [x["session_window"] for x in today_entries] == ["us-pre-market-open", "us-closing-bell"]
|
||||||
|
|
||||||
# Verify /engineering/ (hs-eng-docs) & /math/ (hs-math-docs) Piecewise & Non-Sequential Revertability
|
# Verify /engineering/ (hs-eng-docs) & /math/ (hs-math-docs) Piecewise & Non-Sequential Revertability
|
||||||
from hyperstitionstud_io.publishing.engineering_docs import build_engineering_site
|
from hyperstitionstud_io.publishing.engineering_docs import build_engineering_site
|
||||||
from hyperstitionstud_io.publishing.math_docs import build_math_site
|
from hyperstitionstud_io.publishing.math_docs import build_math_site
|
||||||
@@ -1385,19 +1465,35 @@ def test_ipld_quant_and_mcp_server() -> None:
|
|||||||
cfg.archive_dir / "packaging" / "bundle" / "scripts" / "ci_provision_ingglish.py",
|
cfg.archive_dir / "packaging" / "bundle" / "scripts" / "ci_provision_ingglish.py",
|
||||||
cfg.archive_dir / "packaging" / "bundle" / "skills" / "hyperdope-ingglish-ci" / "scripts" / "ci_provision_ingglish.py",
|
cfg.archive_dir / "packaging" / "bundle" / "skills" / "hyperdope-ingglish-ci" / "scripts" / "ci_provision_ingglish.py",
|
||||||
):
|
):
|
||||||
assert ci_prov_mirror.read_text(encoding="utf-8") == ci_prov_txt, f"Out-of-sync ci_provision_ingglish.py mirror: {ci_prov_mirror}"
|
mirror_txt = ci_prov_mirror.read_text(encoding="utf-8")
|
||||||
|
assert len(mirror_txt.splitlines()) <= 40 and "runpy.run_path" in mirror_txt and "ci_provision_ingglish.py" in mirror_txt, (
|
||||||
|
f"Expected thin delegator wrapper for {ci_prov_mirror}"
|
||||||
|
)
|
||||||
|
|
||||||
# Verify Plan #58: Pre-Commit Preparation & Gates DEPLOY-GATE-D01.MIRROR_PARITY..DEPLOY-GATE-D08.PRE_COMMIT_STAGE for push-all-to-git-libre-audio.sh & deploy/sync-vps-repos.sh
|
# Verify Plan #58 & DEPLOY-GATE-D07.TOPO_PUSH_PARITY: Pre-Commit Preparation & Gates DEPLOY-GATE-D01.MIRROR_PARITY..DEPLOY-GATE-D08.PRE_COMMIT_STAGE for push-all-to-git-libre-audio.sh & deploy/sync-vps-repos.sh
|
||||||
from hyperstitionstud_io.ci.deploy_scripts_sync import prepare_and_verify_deploy_scripts
|
from hyperstitionstud_io.ci.deploy_scripts_sync import (
|
||||||
|
prepare_and_verify_deploy_scripts,
|
||||||
|
validate_push_script_rebase_gating,
|
||||||
|
)
|
||||||
|
|
||||||
dep_sync = prepare_and_verify_deploy_scripts(workspace_root=cfg.workspace_root, check_only=False)
|
dep_sync = prepare_and_verify_deploy_scripts(workspace_root=cfg.workspace_root, check_only=False)
|
||||||
assert dep_sync["ok"] is True, f"Deploy scripts sync failed: {dep_sync}"
|
assert dep_sync["ok"] is True, f"Deploy scripts sync failed: {dep_sync}"
|
||||||
assert all(dep_sync["gates"].values()), f"Deploy scripts gates failed: {dep_sync['gates']}"
|
assert all(dep_sync["gates"].values()), f"Deploy scripts gates failed: {dep_sync['gates']}"
|
||||||
dep_chk = prepare_and_verify_deploy_scripts(workspace_root=cfg.workspace_root, check_only=True)
|
dep_chk = prepare_and_verify_deploy_scripts(workspace_root=cfg.workspace_root, check_only=True)
|
||||||
assert dep_chk["ok"] is True, f"Deploy scripts check_only failed: {dep_chk}"
|
assert dep_chk["ok"] is True, f"Deploy scripts check_only failed: {dep_chk}"
|
||||||
assert (cfg.core_dir / "deploy" / "push-all-to-git-libre-audio.sh").read_text(encoding="utf-8") == (
|
ws_push_txt = (cfg.workspace_root / "push-all-to-git-libre-audio.sh").read_text(encoding="utf-8")
|
||||||
cfg.workspace_root / "push-all-to-git-libre-audio.sh"
|
assert (cfg.core_dir / "deploy" / "push-all-to-git-libre-audio.sh").read_text(encoding="utf-8") == ws_push_txt
|
||||||
).read_text(encoding="utf-8")
|
assert validate_push_script_rebase_gating(ws_push_txt) == []
|
||||||
|
assert 'run_checked "git pull --rebase' in ws_push_txt
|
||||||
|
for bad_rebase_snippet in (
|
||||||
|
"git checkout --theirs README.md",
|
||||||
|
"git checkout --ours README.md",
|
||||||
|
"git pull --rebase -X theirs origin main",
|
||||||
|
"git pull --rebase -X ours origin main",
|
||||||
|
"git pull --rebase --autostash origin main || true",
|
||||||
|
):
|
||||||
|
bad_v = validate_push_script_rebase_gating(bad_rebase_snippet)
|
||||||
|
assert len(bad_v) >= 1, f"Gate DEPLOY-GATE-D07.TOPO_PUSH_PARITY failed to reject {bad_rebase_snippet!r}"
|
||||||
|
|
||||||
# Verify Plan #60: /calc/ (haiperdohpjematreeah) Homepage Group 3 UI Parity, Zero "Cypher Calculator" & hyperdope-ci-build Patch Integration
|
# Verify Plan #60: /calc/ (haiperdohpjematreeah) Homepage Group 3 UI Parity, Zero "Cypher Calculator" & hyperdope-ci-build Patch Integration
|
||||||
calc_dir = cfg.paths["gematria_js_dir"]
|
calc_dir = cfg.paths["gematria_js_dir"]
|
||||||
@@ -1452,6 +1548,18 @@ def test_ipld_quant_and_mcp_server() -> None:
|
|||||||
assert erofs_res["verified"] is True
|
assert erofs_res["verified"] is True
|
||||||
assert erofs_res["mcp_tools_swept"] >= 15
|
assert erofs_res["mcp_tools_swept"] >= 15
|
||||||
|
|
||||||
|
# Verify PLAN-SPECIFICATION-AND-GOVERNANCE-STANDARD (hs-plan-lint)
|
||||||
|
from hyperstitionstud_io.ci.plan_validator import verify_plan_specifications
|
||||||
|
|
||||||
|
plan_audit = verify_plan_specifications(workspace_root=cfg.workspace_root)
|
||||||
|
assert plan_audit["ok"] is True, f"Plan specification audit failed: {plan_audit['errors']}"
|
||||||
|
assert plan_audit["total_plans_checked"] == plan_audit["active_plans_checked"] + plan_audit["piecewise_plans_checked"]
|
||||||
|
assert plan_audit["total_plans_checked"] > 0
|
||||||
|
assert len(plan_audit["missing_pdfs"]) == 0
|
||||||
|
assert len(plan_audit["missing_ledger_entries"]) == 0
|
||||||
|
assert len(plan_audit["metadata_errors"]) == 0
|
||||||
|
assert len(plan_audit["host_path_errors"]) == 0
|
||||||
|
|
||||||
# Write cached internal test baseline (.cache/internal-test-baseline-latest.json) for hs-public-smoke
|
# Write cached internal test baseline (.cache/internal-test-baseline-latest.json) for hs-public-smoke
|
||||||
from hyperstitionstud_io.ci.public_regression import write_internal_test_baseline_cache
|
from hyperstitionstud_io.ci.public_regression import write_internal_test_baseline_cache
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user