PLAN-68: Implement shorthand disambiguation standard, hs-shorthand-lint, pre-commit gate, and core comment/UI migration
This commit is contained in:
1 parent
32cd771707
commit
9378c594f9
15 files changed
+300
-93
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 19 tracked module/artifact surface(s)
|
> - **Latest Commit Scope (`hyperstitionstudio-core`):** Synchronized v2.17.1 release state across 14 tracked module/artifact surface(s)
|
||||||
> - **Touched Files / Surfaces:** `deploy/push-all-to-git-libre-audio.sh`, `deploy/sync-vps-repos.sh`, `package.json`, `packages-js/ciphers-aq/package.json`, `pyproject.toml`, `scripts/build_gallery_manifest.py`, `site/donate/index.html`, `site/gallery/index.html` (+11 more)
|
> - **Touched Files / Surfaces:** `docs/SHORTHAND-DISAMBIGUATION-STANDARD.md`, `pyproject.toml`, `site/assets/hs-matrix-coderain.js`, `site/learn/index.html`, `site/learn/learn-app.js`, `site/quant/OPERATORS-MANUAL-QUANT-TIMESERIES-WORKBENCH.pdf`, `src/hyperstitionstud_io/ci/deploy_scripts_sync.py`, `src/hyperstitionstud_io/ci/public_regression.py` (+6 more)
|
||||||
> - **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 -->
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,54 @@
|
|||||||
|
# Global `[A-Z][0-9]` Shorthand Disambiguation Standard (`<PREFIX><NN>.<DOMAIN_TAG>`)
|
||||||
|
|
||||||
|
**Document ID:** `SHORTHAND-DISAMBIGUATION-STANDARD`
|
||||||
|
**Plan Reference:** `PLAN-HUMAN-TEXT-AND-COMMENT-SHORTHAND-DISAMBIGUATION` (`Plan #68`)
|
||||||
|
**Scope:** All human-read documentation (`README.md`, `docs/*.md`, plans, manuals, encyclopedias), non-executable source comments (`#`, `//`, `/* ... */`, `<!-- ... -->`), and web UI prose across all `6` `hyperstitionstud.io` repositories.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 1. Global Executable Code Exemption & `ast.dump` Invariance
|
||||||
|
|
||||||
|
Executable code is **globally exempt** so software functionality is 100% unimpacted:
|
||||||
|
- **Never alter:** variable/function/class/constant names, imports, expressions, control flow, CLI flags, HTTP routes, JSON/TOML keys, schema enums, CSS selectors/classes, HTML element IDs, regexes, or runtime-asserted strings.
|
||||||
|
- **`ast.dump` Parity Guarantee:** Any `.py` file modified for shorthand disambiguation must only alter `#` comment tokens and must satisfy `ast.dump(ast.parse(before)) == ast.dump(ast.parse(after))`.
|
||||||
|
- **DOM/CSS Safety:** HTML/CSS anchors remain lowercase hyphenated (`#g01-quant`, `#unit-e03-quant-brief`) so `.` never breaks CSS selectors.
|
||||||
|
- **Locked JSON Keys:** When referencing SHA-256-locked JSON keys (`ReadOnlyIsolationGuard` in `taxonomy/glossary-registry.json` and `encyclopedia/encyclopedia-manifest.json`), use disambiguated canonical tags in prose without altering JSON keys or locked digests.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 2. Canonical Disambiguation Table (`<PREFIX><NN>.<DOMAIN_TAG>`)
|
||||||
|
|
||||||
|
| Subsystem / Category | Legacy Bare Form | Canonical Disambiguated Form (`<PREFIX><NN>.<DOMAIN_TAG>`) |
|
||||||
|
| :--- | :--- | :--- |
|
||||||
|
| **Architecture Atlas Tool Groups** | `G1..G8` | `G01.QUANT`, `G02.CALC_CI`, `G03.GRAPH`, `G04.ZOOLOGY`, `G05.ARCHIVE`, `G06.ENG_MATH`, `G07.PORTAL_LEARN`, `G08.MCP_DEPLOY` |
|
||||||
|
| **Orthographic Generations** | `G0`, `G1` | `GEN-00.ENGLISH`, `GEN-01.INGGLISH` |
|
||||||
|
| **Cipher & Phonemic Rules / Vectors** | `G1..G6` | `RULE-G01.COLLAPSE`, `RULE-G02.CROSS_GEN_TWIN`, `RULE-G03.STRUCTURAL`, `RULE-G04.ISOMETRIC`, `RULE-G05.TWIN_PRIME`, `RULE-G06.COMPOSITE` |
|
||||||
|
| **Engineering Plan Binary Gates** | `G1..G4` | `PLAN-GATE-G01.EXTANT_DATA`, `PLAN-GATE-G02.ZERO_LLM`, `PLAN-GATE-G03.EROFS_SAFE`, `PLAN-GATE-G04.EXPORTABLE` |
|
||||||
|
| **Deploy Script Gates** | `D1..D8` | `DEPLOY-GATE-D01.MIRROR_PARITY` .. `DEPLOY-GATE-D08.PRE_COMMIT_STAGE` |
|
||||||
|
| **Public Smoke Gates** | `P1..P6` | `SMOKE-GATE-P01.STATIC_ROUTES` .. `SMOKE-GATE-P06.NAV_STYLE_PARITY` |
|
||||||
|
| **Style & Mobile Regression Gates** | `S1..S4` | `STYLE-GATE-S01.NO_SLATE_BG`, `STYLE-GATE-S02.DEJAVU_FONT`, `STYLE-GATE-S03.HEADER_PARITY`, `STYLE-GATE-S04.MOBILE_UI` |
|
||||||
|
| **Engineering Hub Units** | `E0..E5` | `UNIT-E00.HUB`, `UNIT-E01.CIPHERS`, `UNIT-E02.GRAPH_SQLITE`, `UNIT-E03.QUANT_BRIEF`, `UNIT-E04.MCP_REST_IPLD`, `UNIT-E05.CICD_VPS` |
|
||||||
|
| **Applied Math Hub Units** | `M0..M5` | `UNIT-M00.HUB`, `UNIT-M01.BASE36_AQ`, `UNIT-M02.PHONETICS_ENTROPY`, `UNIT-M03.GRAPH_SPECTRAL`, `UNIT-M04.Z_CALCULUS`, `UNIT-M05.MACRO_BAYESIAN` |
|
||||||
|
| **`/learn/` Track Folios** | `M01..M06` | `LEARN-M01.CABBALA`, `LEARN-M02.PARASITE`, `LEARN-M03.SERIES`, `LEARN-M04.STRATA`, `LEARN-M05.RHIZOME`, `LEARN-M06.GEOMANCY` |
|
||||||
|
| **Singularity Classes** | `S1..S6` | `CLASS-S01.SILICON`, `CLASS-S02.TEMPLEX`, `CLASS-S03.WAR_MACHINE`, `CLASS-S04.CARRIER_WAVE`, `CLASS-S05.BWO`, `CLASS-S06.AGI` |
|
||||||
|
| **Memetic Superclasses** | `M1..M7+` | `CLASS-M01.ENTROPIC`, `CLASS-M02.KINETIC`, `CLASS-M03.LEVIATHAN`, `CLASS-M04.MIMETIC`, `CLASS-M05.ORACLE`, `CLASS-M06.ABYSSAL`, `CLASS-M07.HYPERSTITIONAL` |
|
||||||
|
| **Confluence Dose & Regimes** | `D0..D4`, `R1..R3` | `DOSE-D00.NONE` .. `DOSE-D04.FULL_LOCK`; `REGIME-R01.BULL`, `REGIME-R02.PINNED_ISOMETRIC`, `REGIME-R03.TAIL_DRAWDOWN` |
|
||||||
|
| **Polyglot Sandbox Security Rings** | `R1..R4` | `RING-R01.AST_WHITELIST`, `RING-R02.ZERO_EVAL`, `RING-R03.BOUNDED_FUEL`, `RING-R04.PURE_SUBSET` |
|
||||||
|
| **Ingglish AQ Curve Grading** | `D1..D5` | `CURVE-D01.LINEAR`, `CURVE-D02.LOG_COMPRESSION`, `CURVE-D03.QUANTILE`, `CURVE-D04.SIGMOID`, `CURVE-D05.HYBRID_ZSCORE` |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 3. Explicit Non-Shorthand Allowlist
|
||||||
|
|
||||||
|
The following tokens are standard technical/domain identifiers and are explicitly exempt from disambiguation:
|
||||||
|
- HTTP / Protocol / Runtime: `H1`, `H2`, `H3`, `V8` (Yahoo Finance v8 API)
|
||||||
|
- Monetary Aggregates: `M1`, `M2` (when referring to FRED `M1`/`M2` money supply)
|
||||||
|
- Statistical Percentiles: `P20`, `P50`, `P90`
|
||||||
|
- Harvest Keys & Encodings: `H01..H39`, `UTF-8`, `CIDv1`, `SHA-256`, `EUV`, `AI`
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 4. Automated Verification (`hs-shorthand-lint`)
|
||||||
|
|
||||||
|
- **Full 6-Repo Audit:** `hs-shorthand-lint` (or `python3 -m hyperstitionstud_io.ci.shorthand_lint --check-all`)
|
||||||
|
- **Pre-Commit Staged Gate:** `python3 -m hyperstitionstud_io.ci.shorthand_lint --staged-diff --repo <repo_root>` (wired into `.git/hooks/pre-commit` across all `6` repositories via `hs-readme-sync --install-hooks`).
|
||||||
@@ -43,6 +43,7 @@ hs-readme-sync = "hyperstitionstud_io.publishing.readme_sync:main"
|
|||||||
hs-closeups-sync = "hyperstitionstud_io.publishing.closeups_sync:main"
|
hs-closeups-sync = "hyperstitionstud_io.publishing.closeups_sync:main"
|
||||||
hs-quant-voice-build = "hyperstitionstud_io.publishing.quant_voice:main"
|
hs-quant-voice-build = "hyperstitionstud_io.publishing.quant_voice:main"
|
||||||
hs-deploy-scripts-sync = "hyperstitionstud_io.ci.deploy_scripts_sync:main"
|
hs-deploy-scripts-sync = "hyperstitionstud_io.ci.deploy_scripts_sync:main"
|
||||||
|
hs-shorthand-lint = "hyperstitionstud_io.ci.shorthand_lint:main"
|
||||||
|
|
||||||
[tool.setuptools.packages.find]
|
[tool.setuptools.packages.find]
|
||||||
where = ["src"]
|
where = ["src"]
|
||||||
|
|||||||
@@ -27,9 +27,9 @@
|
|||||||
"\u2644", // ♄ Saturn (Chronos / Time-Series & Cold Archive)
|
"\u2644", // ♄ Saturn (Chronos / Time-Series & Cold Archive)
|
||||||
"\u269A", // ⚚ Staff of Hermes (MCP / REST Conduit)
|
"\u269A", // ⚚ Staff of Hermes (MCP / REST Conduit)
|
||||||
"\u269B", // ⚛ Cybernetic Kernel (Wiener Feedback / EROFS)
|
"\u269B", // ⚛ Cybernetic Kernel (Wiener Feedback / EROFS)
|
||||||
"\u25C8", // ◈ Isometric Lattice Node (G4 Fixed Point)
|
"\u25C8", // ◈ Isometric Lattice Node (RULE-G04.ISOMETRIC Fixed Point)
|
||||||
"\u2206", // ∆ Alchemical / Variance-Collapse Delta
|
"\u2206", // ∆ Alchemical / Variance-Collapse Delta
|
||||||
"\u2297", // ⊗ Double Articulation (S x S6)
|
"\u2297", // ⊗ Double Articulation (CLASS-S01.SILICON..CLASS-S05.BWO x CLASS-S06.AGI)
|
||||||
"\u03BB", // λ Church / Z-Combinator Lambda
|
"\u03BB", // λ Church / Z-Combinator Lambda
|
||||||
"\u03A6", // Φ Phonemic Projection
|
"\u03A6", // Φ Phonemic Projection
|
||||||
"\u03A9", // Ω Terminal Attractor
|
"\u03A9", // Ω Terminal Attractor
|
||||||
|
|||||||
@@ -259,7 +259,7 @@
|
|||||||
</section>
|
</section>
|
||||||
|
|
||||||
<main class="modules-grid">
|
<main class="modules-grid">
|
||||||
<!-- MODULE M01 -->
|
<!-- MODULE LEARN-M01.CABBALA -->
|
||||||
<article class="module-card" id="card-M01">
|
<article class="module-card" id="card-M01">
|
||||||
<div class="mod-header">
|
<div class="mod-header">
|
||||||
<div>
|
<div>
|
||||||
@@ -280,7 +280,7 @@
|
|||||||
<textarea class="note-area" id="note-M01" placeholder="Personal field notes for Module M01 (auto-saved locally & exported in your .json state file)..."></textarea>
|
<textarea class="note-area" id="note-M01" placeholder="Personal field notes for Module M01 (auto-saved locally & exported in your .json state file)..."></textarea>
|
||||||
</article>
|
</article>
|
||||||
|
|
||||||
<!-- MODULE M02 -->
|
<!-- MODULE LEARN-M02.PARASITE -->
|
||||||
<article class="module-card" id="card-M02">
|
<article class="module-card" id="card-M02">
|
||||||
<div class="mod-header">
|
<div class="mod-header">
|
||||||
<div>
|
<div>
|
||||||
@@ -311,7 +311,7 @@
|
|||||||
<textarea class="note-area" id="note-M02" placeholder="Personal field notes for Module M02..."></textarea>
|
<textarea class="note-area" id="note-M02" placeholder="Personal field notes for Module M02..."></textarea>
|
||||||
</article>
|
</article>
|
||||||
|
|
||||||
<!-- MODULE M03 -->
|
<!-- MODULE LEARN-M03.SERIES -->
|
||||||
<article class="module-card" id="card-M03">
|
<article class="module-card" id="card-M03">
|
||||||
<div class="mod-header">
|
<div class="mod-header">
|
||||||
<div>
|
<div>
|
||||||
@@ -339,7 +339,7 @@
|
|||||||
<textarea class="note-area" id="note-M03" placeholder="Personal field notes for Module M03..."></textarea>
|
<textarea class="note-area" id="note-M03" placeholder="Personal field notes for Module M03..."></textarea>
|
||||||
</article>
|
</article>
|
||||||
|
|
||||||
<!-- MODULE M04 -->
|
<!-- MODULE LEARN-M04.STRATA -->
|
||||||
<article class="module-card" id="card-M04">
|
<article class="module-card" id="card-M04">
|
||||||
<div class="mod-header">
|
<div class="mod-header">
|
||||||
<div>
|
<div>
|
||||||
@@ -363,7 +363,7 @@
|
|||||||
<textarea class="note-area" id="note-M04" placeholder="Personal field notes for Module M04..."></textarea>
|
<textarea class="note-area" id="note-M04" placeholder="Personal field notes for Module M04..."></textarea>
|
||||||
</article>
|
</article>
|
||||||
|
|
||||||
<!-- MODULE M05 -->
|
<!-- MODULE LEARN-M05.RHIZOME -->
|
||||||
<article class="module-card" id="card-M05">
|
<article class="module-card" id="card-M05">
|
||||||
<div class="mod-header">
|
<div class="mod-header">
|
||||||
<div>
|
<div>
|
||||||
@@ -391,7 +391,7 @@
|
|||||||
<textarea class="note-area" id="note-M05" placeholder="Personal field notes for Module M05..."></textarea>
|
<textarea class="note-area" id="note-M05" placeholder="Personal field notes for Module M05..."></textarea>
|
||||||
</article>
|
</article>
|
||||||
|
|
||||||
<!-- MODULE M06 -->
|
<!-- MODULE LEARN-M06.GEOMANCY -->
|
||||||
<article class="module-card" id="card-M06">
|
<article class="module-card" id="card-M06">
|
||||||
<div class="mod-header">
|
<div class="mod-header">
|
||||||
<div>
|
<div>
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
* /workspace/hyperstitionstudio-core/site/learn/learn-app.js
|
* /workspace/hyperstitionstudio-core/site/learn/learn-app.js
|
||||||
* Self-Paced 6-Module Interactive Onboarding Track & Anonymous Local State Engine (v2.0.0)
|
* Self-Paced 6-Module Interactive Onboarding Track & Anonymous Local State Engine (v2.0.0)
|
||||||
* Supports:
|
* Supports:
|
||||||
* - 6 interactive micro-sandboxes (M01..M06)
|
* - 6 interactive micro-sandboxes (LEARN-M01.CABBALA..LEARN-M06.GEOMANCY)
|
||||||
* - Automatic localStorage checkpointing ("hs_learn_state_v2")
|
* - Automatic localStorage checkpointing ("hs_learn_state_v2")
|
||||||
* - State Download (.json) with canonical IPLD dag-json (0x0129) SHA-256 & CIDv1 ("baguqeera...")
|
* - State Download (.json) with canonical IPLD dag-json (0x0129) SHA-256 & CIDv1 ("baguqeera...")
|
||||||
* - State Upload (.json) via file picker & drag-and-drop with Replace/Merge modes & zero-XSS rendering
|
* - State Upload (.json) via file picker & drag-and-drop with Replace/Merge modes & zero-XSS rendering
|
||||||
|
|||||||
Binary file not shown.
@@ -56,7 +56,7 @@ def prepare_and_verify_deploy_scripts(
|
|||||||
modified_files: list[str] = []
|
modified_files: list[str] = []
|
||||||
errors: list[str] = []
|
errors: list[str] = []
|
||||||
|
|
||||||
# Gate D1: Version Header & Tracked Mirror Parity
|
# Gate DEPLOY-GATE-D01.MIRROR_PARITY: Version Header & Tracked Mirror Parity
|
||||||
# Note: On VPS (/srv/hyperstitionstud.io/repos), the tracked copy is `hyperstitionstudio-core/deploy/push-all-to-git-libre-audio.sh`
|
# Note: On VPS (/srv/hyperstitionstud.io/repos), the tracked copy is `hyperstitionstudio-core/deploy/push-all-to-git-libre-audio.sh`
|
||||||
# while the parent directory `ws_root/push-all-to-git-libre-audio.sh` may be absent until hydrated.
|
# while the parent directory `ws_root/push-all-to-git-libre-audio.sh` may be absent until hydrated.
|
||||||
if ws_push_sh.is_file():
|
if ws_push_sh.is_file():
|
||||||
@@ -123,7 +123,7 @@ def prepare_and_verify_deploy_scripts(
|
|||||||
|
|
||||||
gate_d1_ok = len(errors) == 0
|
gate_d1_ok = len(errors) == 0
|
||||||
|
|
||||||
# Gate D2 & D3: bash -n Syntax, Executable Permissions & Zero-/dev/null Redirections
|
# Gate DEPLOY-GATE-D02.BASH_SYNTAX & DEPLOY-GATE-D03.ZERO_DEV_NULL: bash -n Syntax, Executable Permissions & Zero-/dev/null Redirections
|
||||||
scripts_to_audit = [
|
scripts_to_audit = [
|
||||||
ws_push_sh,
|
ws_push_sh,
|
||||||
tracked_push_sh,
|
tracked_push_sh,
|
||||||
@@ -149,7 +149,7 @@ def prepare_and_verify_deploy_scripts(
|
|||||||
gate_d3_ok = False
|
gate_d3_ok = False
|
||||||
errors.append(f"Gate D3: Forbidden /dev/null found in {sp}")
|
errors.append(f"Gate D3: Forbidden /dev/null found in {sp}")
|
||||||
|
|
||||||
# Gate D4: Untracked Runtime Artifact Hydration Parity (.gitignore vs. sync-vps-repos.sh)
|
# Gate DEPLOY-GATE-D04.HYDRATION_PARITY: Untracked Runtime Artifact Hydration Parity (.gitignore vs. sync-vps-repos.sh)
|
||||||
sync_txt_cur = sync_vps_sh.read_text(encoding="utf-8") if sync_vps_sh.is_file() else ""
|
sync_txt_cur = sync_vps_sh.read_text(encoding="utf-8") if sync_vps_sh.is_file() else ""
|
||||||
core_gi = (core_dir / ".gitignore").read_text(encoding="utf-8") if (core_dir / ".gitignore").is_file() else ""
|
core_gi = (core_dir / ".gitignore").read_text(encoding="utf-8") if (core_dir / ".gitignore").is_file() else ""
|
||||||
gate_d4_ok = True
|
gate_d4_ok = True
|
||||||
@@ -161,7 +161,7 @@ def prepare_and_verify_deploy_scripts(
|
|||||||
gate_d4_ok = False
|
gate_d4_ok = False
|
||||||
errors.append("Gate D4: haiperdohp-jemaytreeah untracked artifact hydration missing in deploy/sync-vps-repos.sh")
|
errors.append("Gate D4: haiperdohp-jemaytreeah untracked artifact hydration missing in deploy/sync-vps-repos.sh")
|
||||||
|
|
||||||
# Gate D5: Cold *.tar.gz Archive Exclusion & Explicit rm -f Safety in sync-vps-repos.sh
|
# Gate DEPLOY-GATE-D05.TAR_EXCLUSION: Cold *.tar.gz Archive Exclusion & Explicit rm -f Safety in sync-vps-repos.sh
|
||||||
gate_d5_ok = (
|
gate_d5_ok = (
|
||||||
"--exclude='completed-plans-archive.tar.gz'" in sync_txt_cur
|
"--exclude='completed-plans-archive.tar.gz'" in sync_txt_cur
|
||||||
and "--exclude='inactive-plans-archive.tar.gz'" in sync_txt_cur
|
and "--exclude='inactive-plans-archive.tar.gz'" in sync_txt_cur
|
||||||
@@ -171,7 +171,7 @@ def prepare_and_verify_deploy_scripts(
|
|||||||
if not gate_d5_ok:
|
if not gate_d5_ok:
|
||||||
errors.append("Gate D5: Cold plan .tar.gz exclusion or rm -f cleanup missing in deploy/sync-vps-repos.sh")
|
errors.append("Gate D5: Cold plan .tar.gz exclusion or rm -f cleanup missing in deploy/sync-vps-repos.sh")
|
||||||
|
|
||||||
# Gate D6: Single-Layer 1x Compression & Caddyfile Media Extension Parity
|
# Gate DEPLOY-GATE-D06.COMPRESSION_PARITY: Single-Layer 1x Compression & Caddyfile Media Extension Parity
|
||||||
caddy_txt = caddyfile_p.read_text(encoding="utf-8") if caddyfile_p.is_file() else ""
|
caddy_txt = caddyfile_p.read_text(encoding="utf-8") if caddyfile_p.is_file() else ""
|
||||||
push_src = ws_push_sh if ws_push_sh.is_file() else tracked_push_sh
|
push_src = ws_push_sh if ws_push_sh.is_file() else tracked_push_sh
|
||||||
push_txt_cur = push_src.read_text(encoding="utf-8") if push_src.is_file() else ""
|
push_txt_cur = push_src.read_text(encoding="utf-8") if push_src.is_file() else ""
|
||||||
@@ -185,7 +185,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 D7: 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 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",
|
||||||
@@ -201,7 +201,7 @@ def prepare_and_verify_deploy_scripts(
|
|||||||
if not gate_d7_ok:
|
if not gate_d7_ok:
|
||||||
errors.append("Gate D7: Missing required repository, force-tag, or verification marker in push-all-to-git-libre-audio.sh")
|
errors.append("Gate D7: Missing required repository, force-tag, or verification marker in push-all-to-git-libre-audio.sh")
|
||||||
|
|
||||||
# Gate D8: 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] = []
|
||||||
if stage and not check_only and (core_dir / ".git").exists():
|
if stage and not check_only and (core_dir / ".git").exists():
|
||||||
for rel_s in ("deploy/push-all-to-git-libre-audio.sh", "deploy/sync-vps-repos.sh", "deploy/Caddyfile"):
|
for rel_s in ("deploy/push-all-to-git-libre-audio.sh", "deploy/sync-vps-repos.sh", "deploy/Caddyfile"):
|
||||||
|
|||||||
@@ -213,7 +213,7 @@ def run_public_regression_suite(
|
|||||||
regressions: list[str] = []
|
regressions: list[str] = []
|
||||||
gate_results: dict[str, bool] = {}
|
gate_results: dict[str, bool] = {}
|
||||||
|
|
||||||
# Gate P1: API & MCP Liveness (502 / 5xx Detector)
|
# Gate SMOKE-GATE-P01.STATIC_ROUTES: API & MCP Liveness (502 / 5xx Detector)
|
||||||
p1_ok = True
|
p1_ok = True
|
||||||
api_probes = (
|
api_probes = (
|
||||||
"/status",
|
"/status",
|
||||||
@@ -252,7 +252,7 @@ def run_public_regression_suite(
|
|||||||
regressions.append(f"Gate P1: GET {mcp_ep} returned HTTP {mcp_code}")
|
regressions.append(f"Gate P1: GET {mcp_ep} returned HTTP {mcp_code}")
|
||||||
gate_results["P1_api_and_mcp_liveness_zero_502"] = p1_ok
|
gate_results["P1_api_and_mcp_liveness_zero_502"] = p1_ok
|
||||||
|
|
||||||
# Gate P2: Internal-vs-External Version & CIDv1 Drift
|
# Gate SMOKE-GATE-P02.VERSION_CID_DRIFT: Internal-vs-External Version & CIDv1 Drift
|
||||||
p2_ok = True
|
p2_ok = True
|
||||||
st_obj = (api_responses.get("/status") or {}).get("data") or {}
|
st_obj = (api_responses.get("/status") or {}).get("data") or {}
|
||||||
live_ver = st_obj.get("version")
|
live_ver = st_obj.get("version")
|
||||||
@@ -277,7 +277,7 @@ def run_public_regression_suite(
|
|||||||
regressions.append(f"Gate P2: {art_route} CIDv1 {live_cid!r} != baseline {exp_cid!r}")
|
regressions.append(f"Gate P2: {art_route} CIDv1 {live_cid!r} != baseline {exp_cid!r}")
|
||||||
gate_results["P2_version_and_cidv1_parity"] = p2_ok
|
gate_results["P2_version_and_cidv1_parity"] = p2_ok
|
||||||
|
|
||||||
# Gate P3: Zero-Synthetic-Data & Canary Invariant Audit
|
# Gate SMOKE-GATE-P03.ZERO_SYNTHETIC: Zero-Synthetic-Data & Canary Invariant Audit
|
||||||
p3_ok = True
|
p3_ok = True
|
||||||
nvda_qts = ((api_responses.get("/quant/timeseries?symbol=NVDA") or {}).get("data") or {}).get("instruments") or []
|
nvda_qts = ((api_responses.get("/quant/timeseries?symbol=NVDA") or {}).get("data") or {}).get("instruments") or []
|
||||||
if nvda_qts:
|
if nvda_qts:
|
||||||
@@ -304,7 +304,7 @@ def run_public_regression_suite(
|
|||||||
regressions.append("Gate P3: hs_generate_ticker_stats_card did not return valid PNG magic bytes")
|
regressions.append("Gate P3: hs_generate_ticker_stats_card did not return valid PNG magic bytes")
|
||||||
gate_results["P3_zero_synthetic_and_canary_invariants"] = p3_ok
|
gate_results["P3_zero_synthetic_and_canary_invariants"] = p3_ok
|
||||||
|
|
||||||
# Gate P4: Web-Linked PDF Stylistic Refresh & SHA-256 Parity
|
# Gate SMOKE-GATE-P04.PDF_PARITY: Web-Linked PDF Stylistic Refresh & SHA-256 Parity
|
||||||
p4_ok = True
|
p4_ok = True
|
||||||
for pdf_route, pdf_meta in baseline["expected_web_pdfs"].items():
|
for pdf_route, pdf_meta in baseline["expected_web_pdfs"].items():
|
||||||
p_code, p_bytes = _http_fetch(f"{base}{pdf_route}")
|
p_code, p_bytes = _http_fetch(f"{base}{pdf_route}")
|
||||||
@@ -319,7 +319,7 @@ def run_public_regression_suite(
|
|||||||
regressions.append(f"Gate P4: {pdf_route} SHA-256 {live_sha[:12]} != baseline {pdf_meta['sha256'][:12]} (un-refreshed PDF!)")
|
regressions.append(f"Gate P4: {pdf_route} SHA-256 {live_sha[:12]} != baseline {pdf_meta['sha256'][:12]} (un-refreshed PDF!)")
|
||||||
gate_results["P4_web_pdf_dark_mode_and_sha256_parity"] = p4_ok
|
gate_results["P4_web_pdf_dark_mode_and_sha256_parity"] = p4_ok
|
||||||
|
|
||||||
# Gate P5: Deep-Link & Citation Target Resolution
|
# Gate SMOKE-GATE-P05.DEEP_LINKS: Deep-Link & Citation Target Resolution
|
||||||
p5_ok = True
|
p5_ok = True
|
||||||
if nvda_qts:
|
if nvda_qts:
|
||||||
drefs = nvda_qts[0].get("doc_references") or {}
|
drefs = nvda_qts[0].get("doc_references") or {}
|
||||||
@@ -332,7 +332,7 @@ def run_public_regression_suite(
|
|||||||
regressions.append(f"Gate P5: Deep link {rlk} returned HTTP {rc}")
|
regressions.append(f"Gate P5: Deep link {rlk} returned HTTP {rc}")
|
||||||
gate_results["P5_deep_link_resolution"] = p5_ok
|
gate_results["P5_deep_link_resolution"] = p5_ok
|
||||||
|
|
||||||
# Gate P6: HTML / CSS Visual & Content Regression
|
# Gate SMOKE-GATE-P06.NAV_STYLE_PARITY: HTML / CSS Visual & Content Regression
|
||||||
p6_ok = True
|
p6_ok = True
|
||||||
for h_route, h_meta in baseline["expected_html_surfaces"].items():
|
for h_route, h_meta in baseline["expected_html_surfaces"].items():
|
||||||
hc, h_bytes = _http_fetch(f"{base}{h_route}")
|
hc, h_bytes = _http_fetch(f"{base}{h_route}")
|
||||||
@@ -384,7 +384,7 @@ def verify_ui_style_and_navigation_consistency(workspace_root: str | Path | None
|
|||||||
chamfer_css_p = core / "site" / "assets" / "hs-group3-basalt-chamfer.css"
|
chamfer_css_p = core / "site" / "assets" / "hs-group3-basalt-chamfer.css"
|
||||||
chamfer_css = chamfer_css_p.read_text(encoding="utf-8") if chamfer_css_p.is_file() else ""
|
chamfer_css = chamfer_css_p.read_text(encoding="utf-8") if chamfer_css_p.is_file() else ""
|
||||||
|
|
||||||
# Gate S1: Zero Spurious rgb(30, 41, 59) / #1e293b Background Invariant on Subpages & Group 3 CSS
|
# Gate STYLE-GATE-S01.NO_SLATE_BG: Zero Spurious rgb(30, 41, 59) / #1e293b Background Invariant on Subpages & Group 3 CSS
|
||||||
if re.search(r"#1e293b|rgb\(\s*30\s*,\s*41\s*,\s*59\s*\)", chamfer_css, flags=re.I):
|
if re.search(r"#1e293b|rgb\(\s*30\s*,\s*41\s*,\s*59\s*\)", chamfer_css, flags=re.I):
|
||||||
errors.append("Gate S1: Forbidden #1e293b / rgb(30, 41, 59) found in hs-group3-basalt-chamfer.css")
|
errors.append("Gate S1: Forbidden #1e293b / rgb(30, 41, 59) found in hs-group3-basalt-chamfer.css")
|
||||||
|
|
||||||
@@ -422,7 +422,7 @@ def verify_ui_style_and_navigation_consistency(workspace_root: str | Path | None
|
|||||||
):
|
):
|
||||||
errors.append("Gate S1/S3: .hs-nav-btn in calc/styles.css contains #1e293b or !important color/border overrides")
|
errors.append("Gate S1/S3: .hs-nav-btn in calc/styles.css contains #1e293b or !important color/border overrides")
|
||||||
|
|
||||||
# Gate S2: Intra-Page Font-Family Uniformity Invariant
|
# Gate STYLE-GATE-S02.DEJAVU_FONT: Intra-Page Font-Family Uniformity Invariant
|
||||||
if "--font-mono:" not in chamfer_css or "button," not in chamfer_css or "select," not in chamfer_css:
|
if "--font-mono:" not in chamfer_css or "button," not in chamfer_css or "select," not in chamfer_css:
|
||||||
errors.append("Gate S2: hs-group3-basalt-chamfer.css missing --font-mono inheritance on button/input/select/textarea")
|
errors.append("Gate S2: hs-group3-basalt-chamfer.css missing --font-mono inheritance on button/input/select/textarea")
|
||||||
for sname in ("graph", "quant", "learn", "engineering_hub", "engineering_e1", "math_hub", "math_m1", "donate", "gallery"):
|
for sname in ("graph", "quant", "learn", "engineering_hub", "engineering_e1", "math_hub", "math_m1", "donate", "gallery"):
|
||||||
@@ -432,7 +432,7 @@ def verify_ui_style_and_navigation_consistency(workspace_root: str | Path | None
|
|||||||
if sname == "graph" and "font-family: monospace;" in stxt:
|
if sname == "graph" and "font-family: monospace;" in stxt:
|
||||||
errors.append(f"Gate S2: Bare 'font-family: monospace;' without --font-mono found in /graph/")
|
errors.append(f"Gate S2: Bare 'font-family: monospace;' without --font-mono found in /graph/")
|
||||||
|
|
||||||
# Gate S3: Cross-Page Navigation UI & Header Style Parity Invariant
|
# Gate STYLE-GATE-S03.HEADER_PARITY: Cross-Page Navigation UI & Header Style Parity Invariant
|
||||||
home_txt = (core / "site" / "index.html").read_text(encoding="utf-8")
|
home_txt = (core / "site" / "index.html").read_text(encoding="utf-8")
|
||||||
if '<div class="meta-badges">' not in home_txt:
|
if '<div class="meta-badges">' not in home_txt:
|
||||||
errors.append("Gate S3: Homepage site/index.html <div class=\"meta-badges\"> was modified!")
|
errors.append("Gate S3: Homepage site/index.html <div class=\"meta-badges\"> was modified!")
|
||||||
@@ -452,7 +452,7 @@ def verify_ui_style_and_navigation_consistency(workspace_root: str | Path | None
|
|||||||
if any(pos == -1 for pos in positions) or positions != sorted(positions):
|
if any(pos == -1 for pos in positions) or positions != sorted(positions):
|
||||||
errors.append(f"Gate S3: Canonical navigation link order mismatch in {sname}: {positions}")
|
errors.append(f"Gate S3: Canonical navigation link order mismatch in {sname}: {positions}")
|
||||||
|
|
||||||
# Gate S4 (Plan #66): Adaptive Mobile Device Detection & Mobile UI Ergonomics (Strategies 1A, 2A, 3A, 4A)
|
# Gate STYLE-GATE-S04.MOBILE_UI (Plan #66): Adaptive Mobile Device Detection & Mobile UI Ergonomics (Strategies 1A, 2A, 3A, 4A)
|
||||||
mob_js_p = core / "site" / "assets" / "hs-mobile-ui.js"
|
mob_js_p = core / "site" / "assets" / "hs-mobile-ui.js"
|
||||||
if not mob_js_p.is_file():
|
if not mob_js_p.is_file():
|
||||||
errors.append("Gate S4: Missing site/assets/hs-mobile-ui.js")
|
errors.append("Gate S4: Missing site/assets/hs-mobile-ui.js")
|
||||||
|
|||||||
@@ -6,25 +6,32 @@ Enforces Plan #68: Human-Read Text & Comment Shorthand Disambiguation (<PREFIX><
|
|||||||
with strict global exemption for executable code, strings, tests, and runtime data structures.
|
with strict global exemption for executable code, strings, tests, and runtime data structures.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import sys
|
from __future__ import annotations
|
||||||
|
|
||||||
|
import argparse
|
||||||
|
import io
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
|
import subprocess
|
||||||
|
import sys
|
||||||
import tokenize
|
import tokenize
|
||||||
import io
|
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import List, Tuple, Dict, Any
|
from typing import List, Tuple
|
||||||
|
|
||||||
CANONICAL_ALLOWLIST = {
|
CANONICAL_ALLOWLIST = {
|
||||||
"HTTP", "HTTPS", "API", "REST", "JSON", "MCP", "TCP", "UDP", "SSH", "HTML", "CSS", "SVG", "URL", "URI",
|
"H1", "H2", "H3", "V8", "M1", "M2", "P20", "P50", "P90",
|
||||||
"SHA", "CID", "CPU", "RAM", "SSD", "RPM", "CLI", "UI", "UX", "EOF", "UTF", "AI", "EUV", "FRED", "USD", "BPS",
|
"H01", "H02", "H03", "H04", "H05", "H06", "H07", "H08", "H09",
|
||||||
"H1", "H2", "H3", "V8", "M1", "M2", "P20", "P50", "P90"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Regex for un-disambiguated bare shorthands like G1..G8, M0..M7, S1..S7, E0..E5, D0..D8, P1..P6, R1..R6
|
# Regex for un-disambiguated bare shorthands (bare [GDMESPR][0-9]{1,2} tokens without a <PREFIX><NN>.<DOMAIN_TAG> qualifier)
|
||||||
BARE_SHORTHAND_PATTERN = re.compile(r"\b([GDMESPR])([0-9]{1,2})\b")
|
BARE_SHORTHAND_PATTERN = re.compile(r"\b([GDMESPR])([0-9]{1,2})\b")
|
||||||
|
DATA_URI_BASE64_RE = re.compile(r"data:image/[a-zA-Z0-9+.-]+;base64,[A-Za-z0-9+/=]+")
|
||||||
|
MD_LINK_URL_RE = re.compile(r"\]\([^)]*\)")
|
||||||
|
SUPPORTED_EXTS = {".py", ".md", ".js", ".mjs", ".ts", ".css", ".html", ".svg", ".sh", ".toml", ".yaml", ".yml"}
|
||||||
|
|
||||||
|
|
||||||
def extract_python_comments(source_code: str) -> List[Tuple[int, str]]:
|
def extract_python_comments(source_code: str) -> List[Tuple[int, str]]:
|
||||||
comments = []
|
comments: List[Tuple[int, str]] = []
|
||||||
try:
|
try:
|
||||||
tokens = tokenize.generate_tokens(io.StringIO(source_code).readline)
|
tokens = tokenize.generate_tokens(io.StringIO(source_code).readline)
|
||||||
for tok in tokens:
|
for tok in tokens:
|
||||||
@@ -34,43 +41,139 @@ def extract_python_comments(source_code: str) -> List[Tuple[int, str]]:
|
|||||||
pass
|
pass
|
||||||
return comments
|
return comments
|
||||||
|
|
||||||
|
|
||||||
def extract_markdown_prose_lines(markdown_text: str) -> List[Tuple[int, str]]:
|
def extract_markdown_prose_lines(markdown_text: str) -> List[Tuple[int, str]]:
|
||||||
lines = markdown_text.splitlines()
|
lines = markdown_text.splitlines()
|
||||||
prose_lines = []
|
prose_lines: List[Tuple[int, str]] = []
|
||||||
in_fence = False
|
in_fence = False
|
||||||
for idx, line in enumerate(lines, start=1):
|
for idx, line in enumerate(lines, start=1):
|
||||||
stripped = line.strip()
|
stripped = line.strip()
|
||||||
if stripped.startswith("```"):
|
if stripped.startswith("```") or stripped.startswith("~~~"):
|
||||||
in_fence = not in_fence
|
in_fence = not in_fence
|
||||||
continue
|
continue
|
||||||
if in_fence:
|
if in_fence:
|
||||||
continue
|
continue
|
||||||
# Remove inline backtick code spans
|
# Remove inline backtick code spans and markdown link target URLs
|
||||||
clean_line = re.sub(r"`[^`]*`", "", line)
|
clean_line = re.sub(r"`[^`]*`", "", line)
|
||||||
|
clean_line = MD_LINK_URL_RE.sub("]()", clean_line)
|
||||||
prose_lines.append((idx, clean_line))
|
prose_lines.append((idx, clean_line))
|
||||||
return prose_lines
|
return prose_lines
|
||||||
|
|
||||||
|
|
||||||
|
def extract_sh_comments(text: str) -> List[Tuple[int, str]]:
|
||||||
|
comments: List[Tuple[int, str]] = []
|
||||||
|
for idx, line in enumerate(text.splitlines(), start=1):
|
||||||
|
in_sq = False
|
||||||
|
in_dq = False
|
||||||
|
esc = False
|
||||||
|
for i, ch in enumerate(line):
|
||||||
|
if esc:
|
||||||
|
esc = False
|
||||||
|
continue
|
||||||
|
if ch == "\\" and not in_sq:
|
||||||
|
esc = True
|
||||||
|
continue
|
||||||
|
if ch == "'" and not in_dq:
|
||||||
|
in_sq = not in_sq
|
||||||
|
elif ch == '"' and not in_sq:
|
||||||
|
in_dq = not in_dq
|
||||||
|
elif ch == "#" and not in_sq and not in_dq:
|
||||||
|
if i == 0 or line[i - 1].isspace():
|
||||||
|
comments.append((idx, line[i:]))
|
||||||
|
break
|
||||||
|
return comments
|
||||||
|
|
||||||
|
|
||||||
def extract_js_css_comments(text: str) -> List[Tuple[int, str]]:
|
def extract_js_css_comments(text: str) -> List[Tuple[int, str]]:
|
||||||
# Extracts // ... and /* ... */ and <!-- ... -->
|
"""Extract // and /* ... */ comments while skipping string/template literals."""
|
||||||
lines = text.splitlines()
|
comments: List[Tuple[int, str]] = []
|
||||||
extracted = []
|
i = 0
|
||||||
in_block = False
|
n = len(text)
|
||||||
for idx, line in enumerate(lines, start=1):
|
line = 1
|
||||||
stripped = line.strip()
|
in_sq = False
|
||||||
if "/*" in stripped:
|
in_dq = False
|
||||||
in_block = True
|
in_bt = False
|
||||||
if "*/" in stripped:
|
while i < n:
|
||||||
in_block = False
|
ch = text[i]
|
||||||
|
if ch == "\n":
|
||||||
|
line += 1
|
||||||
|
i += 1
|
||||||
continue
|
continue
|
||||||
if in_block:
|
if in_sq:
|
||||||
extracted.append((idx, line))
|
if ch == "\\" and i + 1 < n:
|
||||||
|
i += 2
|
||||||
|
continue
|
||||||
|
if ch == "'":
|
||||||
|
in_sq = False
|
||||||
|
i += 1
|
||||||
continue
|
continue
|
||||||
if stripped.startswith("//") or stripped.startswith("<!--") or "#" in stripped:
|
if in_dq:
|
||||||
extracted.append((idx, line))
|
if ch == "\\" and i + 1 < n:
|
||||||
return extracted
|
i += 2
|
||||||
|
continue
|
||||||
|
if ch == '"':
|
||||||
|
in_dq = False
|
||||||
|
i += 1
|
||||||
|
continue
|
||||||
|
if in_bt:
|
||||||
|
if ch == "\\" and i + 1 < n:
|
||||||
|
i += 2
|
||||||
|
continue
|
||||||
|
if ch == "`":
|
||||||
|
in_bt = False
|
||||||
|
i += 1
|
||||||
|
continue
|
||||||
|
if text[i : i + 2] == "/*":
|
||||||
|
start_line = line
|
||||||
|
end = text.find("*/", i + 2)
|
||||||
|
if end == -1:
|
||||||
|
comments.append((start_line, text[i:]))
|
||||||
|
break
|
||||||
|
block = text[i : end + 2]
|
||||||
|
comments.append((start_line, block))
|
||||||
|
line += block.count("\n")
|
||||||
|
i = end + 2
|
||||||
|
continue
|
||||||
|
if text[i : i + 2] == "//":
|
||||||
|
end = text.find("\n", i)
|
||||||
|
if end == -1:
|
||||||
|
comments.append((line, text[i:]))
|
||||||
|
break
|
||||||
|
comments.append((line, text[i:end]))
|
||||||
|
i = end
|
||||||
|
continue
|
||||||
|
if ch == "'":
|
||||||
|
in_sq = True
|
||||||
|
elif ch == '"':
|
||||||
|
in_dq = True
|
||||||
|
elif ch == "`":
|
||||||
|
in_bt = True
|
||||||
|
i += 1
|
||||||
|
return comments
|
||||||
|
|
||||||
|
|
||||||
|
def extract_html_comments(text: str) -> List[Tuple[int, str]]:
|
||||||
|
comments: List[Tuple[int, str]] = []
|
||||||
|
i = 0
|
||||||
|
line = 1
|
||||||
|
while True:
|
||||||
|
idx = text.find("<!--", i)
|
||||||
|
if idx == -1:
|
||||||
|
break
|
||||||
|
line += text[i:idx].count("\n")
|
||||||
|
end = text.find("-->", idx + 4)
|
||||||
|
if end == -1:
|
||||||
|
comments.append((line, text[idx:]))
|
||||||
|
break
|
||||||
|
block = text[idx : end + 3]
|
||||||
|
comments.append((line, block))
|
||||||
|
line += block.count("\n")
|
||||||
|
i = end + 3
|
||||||
|
return comments
|
||||||
|
|
||||||
|
|
||||||
def scan_file_for_bare_shorthands(file_path: Path) -> List[str]:
|
def scan_file_for_bare_shorthands(file_path: Path) -> List[str]:
|
||||||
violations = []
|
violations: List[str] = []
|
||||||
try:
|
try:
|
||||||
content = file_path.read_text(encoding="utf-8", errors="ignore")
|
content = file_path.read_text(encoding="utf-8", errors="ignore")
|
||||||
except Exception:
|
except Exception:
|
||||||
@@ -83,47 +186,94 @@ def scan_file_for_bare_shorthands(file_path: Path) -> List[str]:
|
|||||||
target_lines = extract_python_comments(content)
|
target_lines = extract_python_comments(content)
|
||||||
elif suffix == ".md":
|
elif suffix == ".md":
|
||||||
target_lines = extract_markdown_prose_lines(content)
|
target_lines = extract_markdown_prose_lines(content)
|
||||||
elif suffix in (".js", ".mjs", ".ts", ".css", ".html", ".sh"):
|
elif suffix in (".sh", ".toml", ".yaml", ".yml"):
|
||||||
|
target_lines = extract_sh_comments(content)
|
||||||
|
elif suffix in (".js", ".mjs", ".ts", ".css"):
|
||||||
target_lines = extract_js_css_comments(content)
|
target_lines = extract_js_css_comments(content)
|
||||||
|
elif suffix in (".html", ".svg"):
|
||||||
|
target_lines = extract_html_comments(content)
|
||||||
else:
|
else:
|
||||||
# Default text/doc scan outside code blocks
|
return violations
|
||||||
for idx, line in enumerate(content.splitlines(), start=1):
|
|
||||||
target_lines.append((idx, line))
|
|
||||||
|
|
||||||
for lineno, text in target_lines:
|
for lineno, text in target_lines:
|
||||||
for match in BARE_SHORTHAND_PATTERN.finditer(text):
|
clean_text = DATA_URI_BASE64_RE.sub("", text)
|
||||||
|
for match in BARE_SHORTHAND_PATTERN.finditer(clean_text):
|
||||||
token = match.group(0)
|
token = match.group(0)
|
||||||
if token in CANONICAL_ALLOWLIST:
|
if token in CANONICAL_ALLOWLIST:
|
||||||
continue
|
continue
|
||||||
# Check if immediately followed by a domain tag like .QUANT, .ENTROPIC, etc.
|
# Check if immediately followed by a domain tag like .QUANT, .ENTROPIC, etc.
|
||||||
start_pos = match.end()
|
start_pos = match.end()
|
||||||
if start_pos < len(text) and text[start_pos] == ".":
|
if start_pos < len(clean_text) and clean_text[start_pos] == ".":
|
||||||
# Has a domain tag extension, check if it forms a canonical tag
|
|
||||||
continue
|
continue
|
||||||
violations.append(f"{file_path}:{lineno}: Bare shorthand '{token}' detected without canonical <PREFIX><NN>.<DOMAIN_TAG> domain tag.")
|
violations.append(
|
||||||
|
f"{file_path}:{lineno}: Bare shorthand '{token}' detected without canonical <PREFIX><NN>.<DOMAIN_TAG> domain tag."
|
||||||
|
)
|
||||||
|
|
||||||
return violations
|
return violations
|
||||||
|
|
||||||
def main() -> int:
|
|
||||||
workspace_root = Path(os.environ.get("WORKSPACE_DIR", "/workspace"))
|
def _staged_files_for_repo(repo_dir: Path) -> List[Path]:
|
||||||
repos = [
|
res = subprocess.run(
|
||||||
"hyperstitionstudio-core",
|
["git", "-C", str(repo_dir), "diff", "--cached", "--name-only", "--diff-filter=ACM"],
|
||||||
"ingglish-hyperdope-gematria",
|
capture_output=True,
|
||||||
"technocapital-singularity-zoology",
|
text=True,
|
||||||
"encyclopedia-knowledge-graph",
|
check=False,
|
||||||
"haiperdohp-jemaytreeah",
|
)
|
||||||
"hyperdope-ci-build"
|
if res.returncode != 0:
|
||||||
]
|
return []
|
||||||
all_violations = []
|
files: List[Path] = []
|
||||||
for r in repos:
|
for rel in res.stdout.splitlines():
|
||||||
rdir = workspace_root / r
|
rel_s = rel.strip()
|
||||||
if not rdir.is_dir():
|
if not rel_s:
|
||||||
continue
|
continue
|
||||||
for p in rdir.rglob("*"):
|
p = repo_dir / rel_s
|
||||||
|
if p.is_file() and p.suffix.lower() in SUPPORTED_EXTS:
|
||||||
|
files.append(p)
|
||||||
|
return files
|
||||||
|
|
||||||
|
|
||||||
|
def main(argv: list[str] | None = None) -> int:
|
||||||
|
ap = argparse.ArgumentParser(
|
||||||
|
prog="hs-shorthand-lint",
|
||||||
|
description="Tokenizer-based shorthand disambiguation linter (Plan #68).",
|
||||||
|
)
|
||||||
|
ap.add_argument("--check-all", action="store_true", help="Scan all 6 repositories (default).")
|
||||||
|
ap.add_argument("--staged-diff", action="store_true", help="Scan only git-staged files in --repo.")
|
||||||
|
ap.add_argument("--repo", default=None, help="Repository path to scan.")
|
||||||
|
args = ap.parse_args(argv)
|
||||||
|
|
||||||
|
workspace_root = Path(os.environ.get("WORKSPACE_DIR", "/workspace"))
|
||||||
|
all_violations: List[str] = []
|
||||||
|
|
||||||
|
if args.staged_diff:
|
||||||
|
repo_dir = Path(args.repo).resolve() if args.repo else Path.cwd()
|
||||||
|
for p in _staged_files_for_repo(repo_dir):
|
||||||
|
all_violations.extend(scan_file_for_bare_shorthands(p))
|
||||||
|
elif args.repo:
|
||||||
|
rdir = Path(args.repo).resolve()
|
||||||
|
if not rdir.is_dir():
|
||||||
|
rdir = workspace_root / args.repo
|
||||||
|
for p in sorted(rdir.rglob("*")):
|
||||||
if p.is_file() and not any(part.startswith(".") or part in ("node_modules", ".venv", "__pycache__") for part in p.parts):
|
if p.is_file() and not any(part.startswith(".") or part in ("node_modules", ".venv", "__pycache__") for part in p.parts):
|
||||||
if p.suffix.lower() in (".py", ".md", ".js", ".ts", ".css", ".html", ".sh"):
|
if p.suffix.lower() in SUPPORTED_EXTS:
|
||||||
v = scan_file_for_bare_shorthands(p)
|
all_violations.extend(scan_file_for_bare_shorthands(p))
|
||||||
all_violations.extend(v)
|
else:
|
||||||
|
repos = [
|
||||||
|
"hyperstitionstudio-core",
|
||||||
|
"ingglish-hyperdope-gematria",
|
||||||
|
"technocapital-singularity-zoology",
|
||||||
|
"encyclopedia-knowledge-graph",
|
||||||
|
"haiperdohp-jemaytreeah",
|
||||||
|
"hyperdope-ci-build",
|
||||||
|
]
|
||||||
|
for r in repos:
|
||||||
|
rdir = workspace_root / r
|
||||||
|
if not rdir.is_dir():
|
||||||
|
continue
|
||||||
|
for p in sorted(rdir.rglob("*")):
|
||||||
|
if p.is_file() and not any(part.startswith(".") or part in ("node_modules", ".venv", "__pycache__") for part in p.parts):
|
||||||
|
if p.suffix.lower() in SUPPORTED_EXTS:
|
||||||
|
all_violations.extend(scan_file_for_bare_shorthands(p))
|
||||||
|
|
||||||
if all_violations:
|
if all_violations:
|
||||||
print(f"[ERROR] Shorthand linting found {len(all_violations)} bare shorthand violation(s) (Plan #68):", file=sys.stderr)
|
print(f"[ERROR] Shorthand linting found {len(all_violations)} bare shorthand violation(s) (Plan #68):", file=sys.stderr)
|
||||||
@@ -134,5 +284,6 @@ def main() -> int:
|
|||||||
print("[OK] Shorthand linting passed with 0 violations across all repositories.")
|
print("[OK] Shorthand linting passed with 0 violations across all repositories.")
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
sys.exit(main())
|
sys.exit(main())
|
||||||
@@ -23,11 +23,11 @@ ENABLED_LENSES: tuple[str, ...] = (
|
|||||||
|
|
||||||
# 12 Canonical Lens-Neutral Mathematical Keys:
|
# 12 Canonical Lens-Neutral Mathematical Keys:
|
||||||
# Structural Combine (6):
|
# Structural Combine (6):
|
||||||
# 1. struct_isometric_armor (G4 Isometric Chokepoint Ratio, 0-100)
|
# 1. struct_isometric_armor (RULE-G04.ISOMETRIC Chokepoint Ratio, 0-100)
|
||||||
# 2. struct_drift_velocity (G3 Inverse Phonemic Drift & Quantized Steps, 0-100)
|
# 2. struct_drift_velocity (RULE-G03.STRUCTURAL Inverse Phonemic Drift & Quantized Steps, 0-100)
|
||||||
# 3. struct_variance_collapse (G1 Log Gen 0 -> Gen 1 Variance Collapse, 0-100)
|
# 3. struct_variance_collapse (RULE-G01.COLLAPSE Log GEN-00.ENGLISH -> GEN-01.INGGLISH Variance Collapse, 0-100)
|
||||||
# 4. struct_trophic_capture (S[1-5]xS6 Double-Articulation & Cross-Guild Degree, 0-100)
|
# 4. struct_trophic_capture (CLASS-S01.SILICON..CLASS-S05.BWO x CLASS-S06.AGI Double-Articulation & Cross-Guild Degree, 0-100)
|
||||||
# 5. struct_prime_density (G5 Prime & Twin-Prime Mutation Density, 0-100)
|
# 5. struct_prime_density (RULE-G05.TWIN_PRIME Mutation Density, 0-100)
|
||||||
# 6. struct_repricing_resilience (Tri-Modal Repricing & State-Gate Closure, 0-100)
|
# 6. struct_repricing_resilience (Tri-Modal Repricing & State-Gate Closure, 0-100)
|
||||||
# Longitudinal Time-Series Moments (6):
|
# Longitudinal Time-Series Moments (6):
|
||||||
# 7. ts_duty_cycle_pct (Pr[X_t > 0] Active Lock/Wire Duty Cycle %)
|
# 7. ts_duty_cycle_pct (Pr[X_t > 0] Active Lock/Wire Duty Cycle %)
|
||||||
@@ -35,7 +35,7 @@ ENABLED_LENSES: tuple[str, ...] = (
|
|||||||
# 9. ts_excess_over_replacement (Value Over Baseline Tier D Replacement)
|
# 9. ts_excess_over_replacement (Value Over Baseline Tier D Replacement)
|
||||||
# 10. ts_quantile_profile ({p20_floor, p90_ceiling, boom_pct, bust_pct, cv})
|
# 10. ts_quantile_profile ({p20_floor, p90_ceiling, boom_pct, bust_pct, cv})
|
||||||
# 11. ts_optimal_lag_days (Peak Cross-Correlation Lead-Lag tau* in [-5..+5] days)
|
# 11. ts_optimal_lag_days (Peak Cross-Correlation Lead-Lag tau* in [-5..+5] days)
|
||||||
# 12. ts_regime_splits (Conditional Regime Delta {M1, M2, M3})
|
# 12. ts_regime_splits (Conditional Regime Delta {CLASS-M01.ENTROPIC, CLASS-M02.KINETIC, CLASS-M03.LEVIATHAN})
|
||||||
|
|
||||||
LENS_REGISTRY: dict[str, dict[str, Any]] = {
|
LENS_REGISTRY: dict[str, dict[str, Any]] = {
|
||||||
"neutral_math": {
|
"neutral_math": {
|
||||||
|
|||||||
@@ -112,7 +112,7 @@ ATLAS_HTML_TEMPLATE = """<!DOCTYPE html>
|
|||||||
</header>
|
</header>
|
||||||
|
|
||||||
<div class="atlas-grid" id="atlasGrid">
|
<div class="atlas-grid" id="atlasGrid">
|
||||||
<!-- G01 .. G08 -->
|
<!-- G01.QUANT .. G08.MCP_DEPLOY -->
|
||||||
<div class="tool-card" id="g01-quant">
|
<div class="tool-card" id="g01-quant">
|
||||||
<h2>G01.QUANT (/quant/)</h2>
|
<h2>G01.QUANT (/quant/)</h2>
|
||||||
<ul>
|
<ul>
|
||||||
|
|||||||
@@ -907,7 +907,7 @@ def render_all_quadrant_closeups(
|
|||||||
im.save(out_dir / "quadrant-4-operators-deployment-vps.png", "PNG")
|
im.save(out_dir / "quadrant-4-operators-deployment-vps.png", "PNG")
|
||||||
tracked_draws["quadrant-4-operators-deployment-vps.png"] = d
|
tracked_draws["quadrant-4-operators-deployment-vps.png"] = d
|
||||||
|
|
||||||
# 10. Quadrant 04 Tab 2: Unit E4 MCP, REST & ETag 304 Probe
|
# 10. Quadrant 04 Tab 2: UNIT-E04.MCP_REST_IPLD MCP, REST & ETag 304 Probe
|
||||||
im, d = _new_canvas()
|
im, d = _new_canvas()
|
||||||
_draw_chamfer_box(d, (10, 10, 670, 250), PLATE, BORDER, chamfer=10, pip=ROSE)
|
_draw_chamfer_box(d, (10, 10, 670, 250), PLATE, BORDER, chamfer=10, pip=ROSE)
|
||||||
d.text((24, 18), "STATELESS MCP (/mcp), REST v1 (/api/v1/*) & LIVE ETAG 304 PROBE", font=f_hdr, fill=ROSE)
|
d.text((24, 18), "STATELESS MCP (/mcp), REST v1 (/api/v1/*) & LIVE ETAG 304 PROBE", font=f_hdr, fill=ROSE)
|
||||||
@@ -950,7 +950,7 @@ def render_all_quadrant_closeups(
|
|||||||
im.save(out_dir / "quadrant-4-tab-2-mcp-etag.png", "PNG")
|
im.save(out_dir / "quadrant-4-tab-2-mcp-etag.png", "PNG")
|
||||||
tracked_draws["quadrant-4-tab-2-mcp-etag.png"] = d
|
tracked_draws["quadrant-4-tab-2-mcp-etag.png"] = d
|
||||||
|
|
||||||
# 11. Quadrant 04 Tab 3: /ci/ 4-Gate Pipeline & P1-P6 Smoke
|
# 11. Quadrant 04 Tab 3: /ci/ 4-Gate Pipeline & SMOKE-GATE-P01.STATIC_ROUTES..SMOKE-GATE-P06.NAV_STYLE_PARITY Smoke
|
||||||
im, d = _new_canvas()
|
im, d = _new_canvas()
|
||||||
_draw_chamfer_box(d, (10, 10, 670, 250), PLATE, BORDER, chamfer=10, pip=ROSE)
|
_draw_chamfer_box(d, (10, 10, 670, 250), PLATE, BORDER, chamfer=10, pip=ROSE)
|
||||||
d.text((24, 18), "4-GATE INGGLISH CI PIPELINE (/ci/) & 6-GATE PUBLIC SMOKE SUITE", font=f_hdr, fill=ROSE)
|
d.text((24, 18), "4-GATE INGGLISH CI PIPELINE (/ci/) & 6-GATE PUBLIC SMOKE SUITE", font=f_hdr, fill=ROSE)
|
||||||
|
|||||||
@@ -514,6 +514,7 @@ if [[ -d "${CORE_SRC}" ]]; then
|
|||||||
git -C "${REPO_ROOT}" add site/assets/closeups/
|
git -C "${REPO_ROOT}" add site/assets/closeups/
|
||||||
fi
|
fi
|
||||||
python3 -m hyperstitionstud_io.publishing.readme_sync --repo "${REPO_NAME}" --stage
|
python3 -m hyperstitionstud_io.publishing.readme_sync --repo "${REPO_NAME}" --stage
|
||||||
|
python3 -m hyperstitionstud_io.ci.shorthand_lint --staged-diff --repo "${REPO_ROOT}"
|
||||||
fi
|
fi
|
||||||
"""
|
"""
|
||||||
|
|
||||||
@@ -559,7 +560,7 @@ def install_git_pre_commit_hooks(ws_root: Path | None = None, check_only: bool =
|
|||||||
if not hooks_dir.is_dir():
|
if not hooks_dir.is_dir():
|
||||||
continue
|
continue
|
||||||
for h_name, h_script, markers in (
|
for h_name, h_script, markers in (
|
||||||
("pre-commit", PRE_COMMIT_HOOK_SCRIPT, ("readme_sync", "closeups_sync", "deploy_scripts_sync")),
|
("pre-commit", PRE_COMMIT_HOOK_SCRIPT, ("readme_sync", "closeups_sync", "deploy_scripts_sync", "shorthand_lint")),
|
||||||
("commit-msg", COMMIT_MSG_HOOK_SCRIPT, ("COMMIT-MSG GATE",)),
|
("commit-msg", COMMIT_MSG_HOOK_SCRIPT, ("COMMIT-MSG GATE",)),
|
||||||
):
|
):
|
||||||
hook_path = hooks_dir / h_name
|
hook_path = hooks_dir / h_name
|
||||||
|
|||||||
@@ -1334,7 +1334,7 @@ def test_ipld_quant_and_mcp_server() -> None:
|
|||||||
):
|
):
|
||||||
assert ci_prov_mirror.read_text(encoding="utf-8") == ci_prov_txt, f"Out-of-sync ci_provision_ingglish.py mirror: {ci_prov_mirror}"
|
assert ci_prov_mirror.read_text(encoding="utf-8") == ci_prov_txt, f"Out-of-sync ci_provision_ingglish.py mirror: {ci_prov_mirror}"
|
||||||
|
|
||||||
# Verify Plan #58: Pre-Commit Preparation & Gates D1-D8 for push-all-to-git-libre-audio.sh & deploy/sync-vps-repos.sh
|
# 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
|
||||||
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
|
||||||
|
|
||||||
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)
|
||||||
@@ -1383,7 +1383,7 @@ def test_ipld_quant_and_mcp_server() -> None:
|
|||||||
assert geom_audit.get("border_crossing_count") == 0
|
assert geom_audit.get("border_crossing_count") == 0
|
||||||
assert geom_audit.get("text_overlap_count") == 0
|
assert geom_audit.get("text_overlap_count") == 0
|
||||||
|
|
||||||
# Verify Plan #63 & Plan #65: Homepage Navigation Immutability + Intra-Page & Cross-Page UI Style/Font/Background Parity (Gates S1-S3)
|
# Verify Plan #63 & Plan #65: Homepage Navigation Immutability + Intra-Page & Cross-Page UI Style/Font/Background Parity (STYLE-GATE-S01.NO_SLATE_BG..STYLE-GATE-S03.HEADER_PARITY)
|
||||||
from hyperstitionstud_io.ci.public_regression import verify_ui_style_and_navigation_consistency
|
from hyperstitionstud_io.ci.public_regression import verify_ui_style_and_navigation_consistency
|
||||||
|
|
||||||
style_audit = verify_ui_style_and_navigation_consistency(workspace_root=cfg.workspace_root)
|
style_audit = verify_ui_style_and_navigation_consistency(workspace_root=cfg.workspace_root)
|
||||||
|
|||||||
Reference in new issue
Block a user