Files
encyclopedia-knowledge-graph/docs/plans/active/PLAN-FRONT-END-GROUPED-ARCHITECTURE-ATLAS-AND-RELEASE-SYNC.md
T

118 lines
18 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# PLAN: Front-End-Grouped Architecture Atlas Tracing Producer/Consumer Binaries & Artifacts (`PLAN #67`)
**Document ID:** `PLAN-FRONT-END-GROUPED-ARCHITECTURE-ATLAS-AND-RELEASE-SYNC`
**Status:** `ACTIVE (docs/plans/active/)`
**Target Ecosystem Version:** `v2.18.0` (Baseline: `v2.17.0`)
**Target Repositories:** `hyperstitionstudio-core`, `encyclopedia-knowledge-graph`
**Web Route:** `https://hyperstitionstud.io/graph/docs/architecture-atlas.html` (`/graph/docs/architecture-atlas.html`)
**Author:** m00t & Hermes Agent
**Date:** 2026-12-01
---
## 1. Objective & Engineering Constraints
Build a lightweight, deterministic **Architecture Atlas** (`hyperstitionstud_io.publishing.architecture_atlas`, CLI `hs-arch-atlas`) that traces every **binary/script**, **intermediate/published artifact**, and **front-end tool** across the 6-repository `hyperstitionstud.io` ecosystem (`hyperstitionstudio-core`, `ingglish-hyperdope-gematria`, `technocapital-singularity-zoology`, `encyclopedia-knowledge-graph`, `haiperdohp-jemaytreeah`, `hyperdope-ci-build`), explicitly modeling producer -> artifact -> consumer lineage (for example: `hs-quant-harvest` & `hs-macro-harvest` -> `real-market-history.json` & `real-macro-indicators-latest.json` -> `quant/timeseries.py` -> `quant-timeseries.json` -> `hs-daily-brief` -> `daily-brief-latest.json` & `daily-brief-data.js` -> `/quant/` Panel 6 & `/api/v1/tools/hs_generate_daily_portfolio_brief`).
### Four Hard Design Invariants
1. **Front-End Tool Grouping Without Severing Interconnections:** Group diagrams by the **front-end tool / surface** they serve (`8` tool-centered groups `G01.QUANT` .. `G08.MCP_DEPLOY` + `1` shared backbone overview), while preserving **100%** of cross-group producer/consumer dependencies via typed **Boundary Port Pills** (`[IN <- G04.ZOOLOGY: <artifact>]` and `[OUT -> G08.MCP_DEPLOY: <consumer>]`) backed by clickable same-page lowercase hyphenated DOM anchors (`#g01-quant` .. `#g08-mcp-deploy`, avoiding CSS selector dot-collision on `.`) and matching canonical node/edge IDs (`binary:*`, `artifact:*`, `frontend:*`, `service:*`, `port:*`).
2. **Lightweight on Disk (`<= 85 KB` raw, `<= 16 KB` Brotli-11):** Render as a **single self-contained inline-SVG HTML document** (`/workspace/encyclopedia-knowledge-graph/docs/architecture-atlas.html`) plus an optional compact JSON graph index (`architecture-atlas.json`, `<= 25 KB`), avoiding multi-hundred-KB raster PNGs (`285 KB` each) and duplicate embedded-font PDFs in Git.
3. **Lightweight on Recompilation / Rerendering (`< 5 ms` no-op, `< 50 ms` dirty rebuild, `0` Pillow/ReportLab raster work):** Compute a deterministic `SHA-256` content digest over the introspected topology + `CURRENT_VERSION` (`vX.Y.Z`). With `--if-changed` (default in hooks/tests), rewrite disk artifacts **only when the topology or version actually changes**, eliminating spurious dirty Git diffs during `test_core_suite.py` runs.
4. **Automatic Release Synchronization (`0` extra manual steps):** Integrate into `hs-sync-version` (`version_sync.py`), `push-all-to-git-libre-audio.sh`, `deploy/sync-vps-repos.sh` (`.br`/`.gz` pre-compression), and `tests/test_core_suite.py` (coverage gate asserting 100% of `pyproject.toml` `[project.scripts]` binaries and `deploy/Caddyfile` routes appear in the atlas).
---
## 2. Format Selection & Disk / Render Footprint Budget
| Candidate Format | Disk Footprint (Uncompressed) | Brotli-11 VPS Size | Re-render Cost | Ctrl+F Searchable & Clickable Cross-Links | Decision |
| :--- | :---: | :---: | :---: | :---: | :--- |
| **Inline-SVG Self-Contained HTML (`architecture-atlas.html`) + `architecture-atlas.json`** | `~55–80 KB` total (`1` HTML + `1` JSON) | `~10–15 KB` | `< 5 ms` (`--if-changed` no-op) / `< 50 ms` rebuild (`0` Pillow/ReportLab) | Yes (`Ctrl+F` across all binary/artifact labels + clickable `#g01-quant..#g08-mcp-deploy` port links) | **SELECTED** |
| Per-group PNG suite (`8 × 285 KB`) | `~2.3 MB` binary assets in Git | `~2.3 MB` (incompressible) | `~2.5 s` Pillow rasterization + noisy binary diffs | No (`0` searchable text, `0` clickable links) | **REJECTED** |
| Compiled ReportLab PDF atlas | `~120–250 KB` per rebuild | `~120–250 KB` | `~600 ms` + non-deterministic stream diffs | Partial (`#page=`, poor interactive navigation) | **REJECTED** |
- **Visual Styling:** Reuses the offline Group 3 Stealth Basalt inline-SVG/CSS aesthetic (`#020617` void + `40px` grid, `#0f172a` double-rect masking behind arrows, DejaVu Sans Mono stack with zero external Google Fonts, semantic stroke colors: Cyan `#22d3ee` Front-End Tools, Emerald `#34d399` Binaries/CLIs, Violet `#a78bfa` Stored Artifacts/DBs, Amber `#fbbf24` Timers/Sync/Forge, Rose `#fb7185` Isolation/Security/CI Gates).
---
## 3. Front-End Tool Grouping Topology (`G01.QUANT` .. `G08.MCP_DEPLOY`, Zero Severed Edges)
The atlas (`architecture-atlas.html`) renders **Section 0 (Master Cross-Tool Backbone)** followed by **8 Front-End Tool Sub-Diagrams (`G01.QUANT` .. `G08.MCP_DEPLOY`)**. Cross-group edges never break: whenever an artifact produced in one group is consumed in another, the producing group emits a right-gutter **Output Port Pill** (`[OUT -> G03.GRAPH: taxonomy/*.json]` linking to `#g03-graph`) and the consuming group renders a matching left-gutter **Input Port Pill** (`[IN <- G04.ZOOLOGY: taxonomy/*.json]` linking back to `#g04-zoology`), both referencing the same canonical artifact ID (`artifact:*`). Using `id="g01-quant"` .. `id="g08-mcp-deploy"` for DOM/CSS anchors while displaying `G01.QUANT` .. `G08.MCP_DEPLOY` in diagram labels prevents CSS selector dot-parsing collisions.
### Section 0: Master Cross-Tool Backbone & Release/Deploy Spine
- Traces the top-level 6-repo flow at a glance:
- **Producers:** LAN Host `ingglish-exegesis.timer` (`ingglish-exegesis-push`) + VPS `systemd` timers (`run-vps-data-production.sh`, `run-vps-archive-rotation.sh`) + Developer `push-all-to-git-libre-audio.sh` (`hs-sync-version`, `hs-readme-sync`, `hs-deploy-scripts-sync`).
- **Hub & Hydrator:** `git.libre.audio` -> `deploy/sync-vps-repos.sh` -> `/var/www/hyperstitionstud.io/repos` (`tmpfs`, `.br`/`.gz`, `deploy/Caddyfile` + `hyperstition-mcp.service :8095`).
### `G01.QUANT` (`#g01-quant`): `/quant/` — Quantitative Time-Series, Macro & Bayesian Brief Workbench
- **Binaries & Modules:**
- `hs-quant-harvest` (`quant/collector.py`)
- `hs-macro-harvest` (`quant/macro.py`)
- `python3 -m hyperstitionstud_io.quant.timeseries` (`quant/timeseries.py`)
- `hs-daily-brief` (`quant/daily_brief.py`)
- `hs-ticker-card` (`quant/cards.py`)
- `hs-quant-voice-build` (`publishing/quant_voice.py`)
- `hs-pdf-build` (`publishing/pdf_compiler.py`)
- **Explicit Producer -> Artifact -> Consumer Trace (`hs-daily-brief` exemplar):**
1. `hs-quant-harvest` -> produces `ingglish-aq-archive/data/financial-aq-harvest-latest.json` & `site/quant/real-market-history.json`.
2. `hs-macro-harvest` -> produces `ingglish-aq-archive/data/real-macro-indicators-latest.json`.
3. `quant/timeseries.py` -> consumes `real-market-history.json` + `[IN <- G05.ARCHIVE: 25..NN-dossier-news-*.md]` + `[IN <- G04.ZOOLOGY: quantitative-economic-anchors.json]` -> produces `site/quant/quant-timeseries.json` & `quant-timeseries-data.js`.
4. **`hs-daily-brief`** -> consumes `real-macro-indicators-latest.json`, `quant-timeseries.json`, and prior `ingglish-aq-archive/data/daily-brief-state.json` (plus `ReadOnlyIsolationGuard` over `[IN <- G04.ZOOLOGY: glossary-registry.json, encyclopedia-manifest.json]`) -> produces `ingglish-aq-archive/data/daily-brief-state.json`, `site/quant/daily-brief-latest.json`, and `site/quant/daily-brief-data.js` -> consumed by `/quant/index.html` (Panel 6) and `[OUT -> G08.MCP_DEPLOY: hs_generate_daily_portfolio_brief]`.
5. `hs-ticker-card` -> consumes `quant-timeseries.json` + `[IN <- G04.ZOOLOGY: assemblage-builds-tier-list.json]` -> produces `*-stats-card.{png,json}` -> `[OUT -> G08.MCP_DEPLOY: /api/v1/tools/hs_generate_ticker_stats_card]`.
6. `hs-quant-voice-build` -> consumes `site/quant/quant-tutorials.js` -> produces deploy-time `site/quant/audio/ep0X-sY.wav` (gitignored, hydrated on VPS).
### `G02.CALC_CI` (`#g02-calc-ci`): `/calc/` & `/ci/` — Multi-Cipher Workbench (`haiperdohp-jemaytreeah`) & 4-Gate CI
- **Binaries & Scripts:** `ci_provision_ingglish.py`, `tools/normalize_caps.py`, `tools/classify_candidates.py`, `tools/generate_db_json.py`, `integrate-upstream-and-ui.sh` (`hyperdope-ci-build`), `run_exegesis_and_push_fedora41.sh`.
- **Artifacts:** `[IN <- G05.ARCHIVE: 01..NN-*.md & node_modules/ingglish]` -> `ci_provision_ingglish.py` produces `/ci/` (`db_ingglish_entries.txt`, `ci-audit-report.json`, `pr-payload.json`, `ONBOARDING-INGGLISH-AQ.{md,pdf}`) and patches `haiperdohp-jemaytreeah/db.txt` -> `generate_db_json.py` compiles `db_lite.json` (`16` ciphers) + `db.json` (`82` ciphers) + `config.js` -> consumed by `/calc/index.html` and `[OUT -> G07.PORTAL_LEARN: /calc/ Closeups]`.
### `G03.GRAPH` (`#g03-graph`): `/graph/` — Interactive Knowledge Graph Workbench & Plan Archives
- **Binaries & Scripts:** `hs-kg-build` (`graph/cli.py`), `build_encyclopedia_knowledge_graph.py`, `hs-archive-rotate` (`publishing/archive_rotator.py`), `hs-pdf-build`.
- **Artifacts:** `[IN <- G04.ZOOLOGY: taxonomy/*.json, encyclopedia-manifest.json]` -> `build_encyclopedia_knowledge_graph.py` produces `encyclopedia-graph.{json,graphml,gexf}`, `graph-data.js`, `encyclopedia.canvas`, `atlas-mode{1,2,3}.png` -> consumed by `/graph/index.html` and `[OUT -> G08.MCP_DEPLOY: hs_query_knowledge_graph & hs-db-build]`.
- **Plan/Manual Lineage:** `hs-archive-rotate` rotates `docs/archive/PLAN-*.md` & `docs/plans/inactive/` -> `completed-plans-archive.tar.gz` + `archive-manifest.json` & `inactive-plans-archive.tar.gz` + `inactive-archive-manifest.json` -> `[OUT -> G08.MCP_DEPLOY: hs_inspect_documentation_and_manuals]`.
### `G04.ZOOLOGY` (`#g04-zoology`): `/zoology/` & `/encyclopedia/` — Taxonomy, Glossary, ETI Tier List & 22-Volume PDFs
- **Binaries & Scripts:** `classify_technocapital_singularity.py`, `sources.py`, `hs-citations` (`ci/citation_sources.py`), `generate_aq_tier_list.py`, `build_wire_report_pdf.py`.
- **Artifacts:** `[IN <- G05.ARCHIVE: node_modules/ingglish & 65..69-dossier-*.md]` -> produces `taxonomy/*.json` (`glossary-registry.json`, `singularity-zoology-matrix.json`, `memetic-superclass-registry.json`, `quantitative-economic-anchors.json`, `assemblage-builds-tier-list.json`, `citations-ledger-*.json`), `encyclopedia/00..08/*.pdf` (`22` PDFs), `tier-list-*.{md,pdf,png}`, `comprehensive-glossary.{md,pdf}`, `proposal-*.{md,pdf}` -> `[OUT -> G01.QUANT, G03.GRAPH, G08.MCP_DEPLOY]`.
### `G05.ARCHIVE` (`#g05-archive`): `/archive/` — Current-Events & Thematic Ingglish AQ Corpus + Fedora 41 Worker
- **Binaries & Scripts:** `collect_news_aq.py`, `synthesize_news_dossier_openrouter.py`, `evaluate_aq.mjs`, `manage_lecture_artifacts.py`, `packaging/build-fedora41-rpm.sh`, `/usr/bin/ingglish-exegesis-push` (`run_exegesis_and_push_fedora41.sh`).
- **Artifacts:** `news-aq-harvest-*.json` -> `25..73+-dossier-news-YYYY-MM-DD.md` & `00-index-and-methodology.md` + `01-ingglish-aq-lexicon.md` + `65..69-dossier-*.md` + `ingglish-isopsephic-exegesis-*.fc41.noarch.rpm` -> `[OUT -> G01.QUANT, G02.CALC_CI, G04.ZOOLOGY]`.
### `G06.ENG_MATH` (`#g06-eng-math`): `/engineering/` & `/math/` — Live-Introspected Explication Hubs & Polyglot REPL
- **Binaries & Modules:** `hs-eng-docs` (`publishing/engineering_docs.py`), `hs-math-docs` (`publishing/math_docs.py`), `publishing/polyglot_sandbox.py`.
- **Artifacts:** Introspects `[IN <- G08.MCP_DEPLOY: pyproject.toml, mcp/tools.py, schemas/v1/]` + `[IN <- G01.QUANT / G03.GRAPH / G04.ZOOLOGY: ciphers, phonetics, quant, lenses, ipld]` -> produces `site/engineering/{index.html,*/index.html,engineering-manifest.json,engineering-manifest-data.js}`, `site/math/{index.html,*/index.html,math-manifest.json,math-manifest-data.js}`, wired with `site/assets/hs-guile-scheme-repl.js` -> `[OUT -> G08.MCP_DEPLOY: hs_inspect_engineering_and_math_docs & hs_evaluate_polyglot_sandbox]`.
### `G07.PORTAL_LEARN` (`#g07-portal-learn`): `/` (Portal Home), `/learn/` & `/donate/` — Showcase, Interactive Track & Repo READMEs
- **Binaries & Modules:** `hs-closeups-sync` (`publishing/closeups_sync.py`), `hs-readme-sync` (`publishing/readme_sync.py`), `hs-highlights` (`publishing/highlights.py`).
- **Artifacts:** Introspects UI states across `[IN <- G01.QUANT, G02.CALC_CI, G03.GRAPH, G06.ENG_MATH]` -> produces `site/assets/closeups/{quadrant-*.png,ui-elements-manifest.json}` consumed by `site/index.html`; `hs-readme-sync` maintains all `6` root `README.md` files + `.git/hooks/{pre-commit,commit-msg}`; `site/learn/{index.html,learn-app.js}` & `site/donate/index.html` bind `schemas/v1/learn-progress-state.schema.json`.
### `G08.MCP_DEPLOY` (`#g08-mcp-deploy`): `/mcp`, `/api/v1/*` & `/schemas/` — Stateless MCP/REST Server, SQLite Catalog & Release/Deploy Pipeline
- **Binaries & Modules:** `hs-mcp` (`mcp/{server,tools,resources,rest}.py`), `hs-db-build` (`db/sqlite_meta.py`), `hs-doctor` (`ci/doctor.py`), `hs-public-smoke` (`ci/public_regression.py`), `hs-sync-version` (`version_sync.py`), `hs-deploy-scripts-sync` (`ci/deploy_scripts_sync.py`), `deploy/{run-vps-data-production.sh,run-vps-archive-rotation.sh,sync-vps-repos.sh}`, `push-all-to-git-libre-audio.sh`.
- **Artifacts:** `hs-db-build` indexes `[IN <- G03.GRAPH, G04.ZOOLOGY, G05.ARCHIVE, G06.ENG_MATH, G07.PORTAL_LEARN]` into `.cache/hyperstition-catalog.db` & `.cache/api-telemetry.db` -> served alongside `[IN <- G01.QUANT: daily-brief-latest.json, quant-timeseries.json]` over `/mcp` (`20` tools, `14` resources) & `/api/v1/*` (with `ETag` `304`); `hs-doctor` + `hs-public-smoke` maintain `.cache/internal-test-baseline-latest.json`.
---
## 4. Architecture & Implementation Modules
1. **Create `src/hyperstitionstud_io/publishing/architecture_atlas.py` (`hs-arch-atlas`):**
- Defines typed node & edge dataclasses:
- `AtlasNode(id, group_id, kind, label, repo, path_or_route, module_or_entry)` where `kind in {"binary", "artifact", "frontend", "service", "port"}`, `group_id in {"G01.QUANT", "G02.CALC_CI", "G03.GRAPH", "G04.ZOOLOGY", "G05.ARCHIVE", "G06.ENG_MATH", "G07.PORTAL_LEARN", "G08.MCP_DEPLOY"}`, and `id` uses typed prefixes (`binary:*`, `artifact:*`, `frontend:*`, `service:*`, `port:in:*`, `port:out:*`).
- `AtlasEdge(src_id, dst_id, verb, label)` where `verb in {"produces", "consumes", "serves", "verifies", "syncs"}`.
- **Live Introspection + Coverage Verification:** Reads `pyproject.toml` (`[project.scripts]`), `mcp/tools.py` (`MCP_TOOLS_SCHEMA`), and `deploy/Caddyfile` (`handle_path` routes) at build time. Computes `topology_sha256` (`hashlib.sha256(canonical_json(atlas_payload) + CURRENT_VERSION)`).
- **Zero-Churn `--if-changed` Mode:** Before writing `architecture-atlas.html` or `architecture-atlas.json`, checks an embedded `<!-- HS-ATLAS-DIGEST: <sha256> v<version> -->` marker in the existing HTML (and `topology_sha256` in JSON). If identical, returns `{"ok": True, "changed": False, "skipped_write": True}` in `< 5 ms` with **0 disk writes**.
- **Pure-Python Inline SVG Layout Engine (`_render_group_svg`):** Automatically computes vertical lane columns inside each group (`Binaries/Scripts` | `Produced Artifacts` | `Consumers / Front-End Tool`), places `[IN <- GXX.TAG: ...]` pills on the left gutter and `[OUT -> GYY.TAG: ...]` pills on the right gutter (linking via lowercase `#gXX-tag` anchors), applies `#0f172a` double-rect masking behind orthogonal/cubic arrows so arrows never cross text, and verifies `0` bounding-box overlaps.
2. **Register CLI & Release Pipeline Hooks:**
- `pyproject.toml`: Add `hs-arch-atlas = "hyperstitionstud_io.publishing.architecture_atlas:main"`.
- `version_sync.py`: Call `build_architecture_atlas(if_changed=True)` at the end of `sync_versions()` so every `hs-sync-version --set` / `--auto-bump` release automatically refreshes the atlas with the new version and any added/changed binaries/routes.
- `push-all-to-git-libre-audio.sh` & `deploy/sync-vps-repos.sh`: Run `hs-arch-atlas --if-changed` pre-push (`push-all-to-git-libre-audio.sh`), and let `sync-vps-repos.sh`'s existing `*.html` pre-compression pass serve `/graph/docs/architecture-atlas.html` as Brotli-11 (`~12 KB` over the wire).
- `publishing/readme_sync.py` & `publishing/engineering_docs.py` (`Unit E0` / `E5`): Document the atlas link (`/graph/docs/architecture-atlas.html`) and update `17` -> `21` CLI entrypoints if needed (noting `pyproject.toml` already has `20` `hs-*` scripts today; adding `hs-arch-atlas` brings it to `21`).
- `tests/test_core_suite.py`: Assert `hs-arch-atlas --check` passes (`100%` of `pyproject.toml` `[project.scripts]` binaries, `hs-daily-brief`, and active `Caddyfile` front-end routes represented, `0` broken `#g01-quant..#g08-mcp-deploy` port targets, `0` container host paths, `architecture-atlas.html <= 100 KB`, and `--if-changed` second run performs `0` writes).
---
## 5. Verification Plan (Once Implemented)
1. Run `hs-arch-atlas` and confirm `architecture-atlas.html` (`<= 100 KB`) and `architecture-atlas.json` (`<= 30 KB`) are generated cleanly in `< 100 ms`.
2. Immediately re-run `hs-arch-atlas --if-changed` and verify `changed == False` and `skipped_write == True` (`< 10 ms`, `git status` clean).
3. Run `hs-arch-atlas --check` and confirm `missing_cli_binaries == []`, `missing_caddy_routes == []`, `broken_port_links == []`, and `hs-daily-brief` traces `real-market-history.json` + `real-macro-indicators-latest.json` + `quant-timeseries.json` + `daily-brief-state.json` -> `daily-brief-latest.json` + `daily-brief-data.js` -> `/quant/` & `/mcp`.
4. Run `PYTHONPATH=/workspace/hyperstitionstudio-core/src python3 /workspace/hyperstitionstudio-core/tests/test_core_suite.py` (`ALL 7 TEST SUITES PASSED`) and `deploy/test-first-deployment.sh` (`HTTP 200` on `/graph/docs/architecture-atlas.html` with `br` pre-compression).