Files
ingglish-hyperdope-gematria/HYPERDOPE-INGGLISH-CI-INTEGRATION-GUIDE.md
T

146 lines
16 KiB
Markdown
Raw Permalink 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.
# Step-by-Step Technical Guide: The `hyperdope-ingglish-ci` Integration Pipeline
**Author:** Hermes Agent (`m00t` / Nous Research)
**Target Upstream:** `malonehunter/hyperdope-gematria` (`v2.6.1+`)
**Pipeline Version:** `0.1.0` (`1,117` Verified Ingglish Entries / `231,060` Total `db.txt` Entries)
**Date:** November 4, 2026 UTC
---
## 1. Executive Overview & Three-Repository Topology
The `hyperdope-ingglish-ci` integration pipeline bridges the deterministic phonetic orthography of **Ingglish** (backed by the 126,051-word Carnegie Mellon University Pronouncing Dictionary) with the browser-based **Hyperdope-Gematria** (`Cypher Calculator`) multi-cipher workbench. It automates extraction, bracketed gloss formatting, four-gate continuous integration (CI) verification, newcomer onboarding documentation, zero-ambiguity Pull Request (PR) artifact generation, and full local `db.json` / `db_lite.json` precomputation.
To prevent nested Git index contamination, `/workspace` is organized as **three peer sibling Git repositories**:
| Repository Path | Primary Role | Active Branches | Remote Target |
| :--- | :--- | :--- | :--- |
| `/workspace/ingglish-hyperdope-gematria` | Canonical source archive (`ingglish-aq-archive/*.md`) and deterministic automation scripts (`ingglish-aq-archive/scripts/ci_provision_ingglish.py`) | `main`, `testing` | `origin` (`seasharp/ingglish-hyperdope-gematria.git`) |
| `/workspace/hyperdope-ci-build` | Dedicated lightweight CI/PR staging repository containing only the upstream target files, CI reports, and PR payloads | `master`, `main`, `feat/ingglish-aq-corpus` | `origin` (`seasharp/ingglish-hyperdope-ci.git`) |
| `/workspace/hyperdope-gematria` | Full local clone of `malonehunter/hyperdope-gematria` (`v2.6.1`) with precomputed `db.json` (`77 MB`), `db_lite.json` (`19 MB`), and UI extensions | `master`, `main`, `feat/ingglish-aq-corpus`, `feat/ingglish-priority-toggle` | `origin` (`github.com/malonehunter/hyperdope-gematria.git`), `downstream` (`seasharp/haiperdohp-jemaytreeah.git`) |
---
## 2. Automated Daily Cron Schedule (`00:00 GMT` -> `00:10 GMT`)
Two chained daily cron jobs feed and execute the pipeline automatically at the UTC midnight rollover (`19:00` and `19:10 EST`):
1. **Job 1 — `current-events-isopsephic-exegesis-daily-0000-gmt` (`0 19 * * *` EST / `00:00 UTC`):**
- Runs `TZ=UTC python3 /workspace/ingglish-hyperdope-gematria/ingglish-aq-archive/scripts/collect_news_aq.py` to harvest the completed 24-hour UTC global news cycle (`target_date_utc = now_utc - 24h`) from Wikipedia `Portal:Current_events`, BBC News, and the Associated Press.
- Translates headlines and atomic entities into Ingglish, identifies cross-story isopsephic collision classes and English-to-Ingglish isometric locks (`Δ = 0`), and writes a new dated dossier (`ingglish-aq-archive/48-dossier-news-YYYY-MM-DD.md`) plus updates `00-index-and-methodology.md`.
2. **Job 2 — `hyperdope-ingglish-ci-daily-0010-gmt` (`10 19 * * *` EST / `00:10 UTC`, `context_from` Job 1):**
- Invokes `ci_provision_ingglish.py` against `/workspace/ingglish-hyperdope-gematria/ingglish-aq-archive`.
- Automatically ingests the newly written news dossier alongside all existing archive ledgers, runs the 4-gate CI audit, updates `/workspace/hyperdope-ci-build`, regenerates onboarding documentation, and commits the updated corpus to `feat/ingglish-aq-corpus`.
---
## 3. Step-by-Step Pipeline Execution (Stages 1 to 6)
### Step 1: Canonical Archive Feeding & Corpus Extraction (`extract_archive_corpus`)
- **Single Source of Truth Rule:** `ci_provision_ingglish.py` scans every `.md` file inside `/workspace/ingglish-hyperdope-gematria/ingglish-aq-archive/` (`26` canonical markdown files). Rather than modifying the extractor to scan scattered root files, any new lexicon words from lectures or compendiums are appended in canonical format to `01-ingglish-aq-lexicon.md`, and multi-word equations are appended to `10–19-ledger-*.md` or dated `20–48+-dossier-*.md` files.
- **Two-Tier Classification:**
- **Tier 1 (`343` Atomic Lexicon & Bridge Items):** Single words, homophone compression hubs (`Nait [Ingglish: Night / Knight]`), Type II/III compensatory isometries (`Aiern [Ingglish: Iron] = 92`, `Gohst [Ingglish: Ghost] = 114`, `Spaider Hed [Ingglish: Spider Head] = 179`), and proper nouns. Bare single-word Type I invariants (`thing`, `flesh`, `monster`, `portal` — `47` words total) whose Ingglish spelling is identical to Standard English are automatically skipped because they already exist in `db.txt`.
- **Tier 2 (`774` Multi-Scale Equations):** Verified `333`, `666`, `777`, repdigit (`111..999`), Numogrammatic (`81, 108, 216, 495`), and prime/cross-story equations harvested across the archive ledgers and dossiers.
---
### Step 2: Bracketed Gloss Formatting & Proper-Case Normalization (`format_provisioned_entry`)
- **How `hyperdope-gematria` Evaluates Phrases:** Both the browser runtime (`calc/gematria.js` when `optAllowPhraseComments = true`) and the JSON compiler (`tools/generate_db_json.py` via `re.sub(r"\[.+\]", "", phrase).strip()`) strip everything inside square brackets `[...]` before calculating cipher values, while retaining the full string in `row[0]` for display in the UI.
- **Formatting Rule:** Every extracted pair `(ing_raw, eng_raw)` is formatted as:
- `<Proper-Case Ingglish> [Ingglish: <Proper-Case English Gloss>]`
- Example: `Chaildz In Dha Wiskee [Ingglish: Childs In The Whiskey]` (scored strictly on `Chaildz In Dha Wiskee` = `333`).
- **Long-Clause Dictionary Density Safeguard:** Upstream `tools/classify_candidates.py` (Step 10) flags lines with `15+` space-separated tokens if fewer than `40%` of the tokens (`dict_hits < nw * 0.4`) appear in `/usr/share/dict/words`. When a phonetic clause has `15+` total words and falls below `40%` dictionary hits, `format_provisioned_entry()` automatically expands the bracket prefix to `[Ingglish Phonetic English: <Gloss>]` (or `[Ingglish Standard Phonetic English Translation: <Gloss>]`), adding verified English dictionary words inside the stripped comment brackets so unmodified upstream `classify_candidates.py` passes `100%` of entries.
---
### Step 3: Four-Gate Automated CI Verification (`run_four_gate_audit`)
Before any file in `hyperdope-ci-build` or `hyperdope-gematria` is modified, `ci_provision_ingglish.py` enforces four deterministic verification gates and records the results in `ci-audit-report.json`:
| CI Gate | Upstream Tool / Mechanism | Verification Invariant | Latest Audit Result |
| :--- | :--- | :--- | :--- |
| **Gate 1: Case Idempotence** | `tools/normalize_caps.py` (`xform_line`) | Every line satisfies `xform_line(line) == line`; `[Ingglish:` and `]` brackets remain intact; short syllables in `INGGLISH_NON_ROMAN = {"di", "li", "mi", "vi", "iv", "ci", "xi"}` are never uppercased as Roman numerals. | `gate1_normalize_idempotent: true` (`0` failures across `1,117` entries) |
| **Gate 2: Junk-Filter Pass** | `tools/classify_candidates.py` (`classify`) | Runs all 11 upstream junk heuristics (`tiny-fragment`, `no-vowel-mash`, `consonant-run`, `long-scraped`, `no-signal`, etc.) and requires a `100.0%` keep rate. | `gate2_classify_keep_rate: 1.0` (`dropped_count: 0`) |
| **Gate 3: Comment-Strip Hygiene** | `re.sub(r"\[.+\]", "", line).strip()` | Confirms that stripping `[...]` leaves the exact target Ingglish phrase and checks that no stray unbracketed glosses or unintended digits leak into the scored string. | `gate3_comment_strip_clean: true` (`0` failures) |
| **Gate 4: Base-36 AQ Math** | `compute_aq(stripped)` (`0-9=0-9, A=10..Z=35`) | Recomputes Base-36 AQ on every stripped Ingglish string and verifies `0` mismatches against the archive's claimed AQ value. | `gate4_aq_mismatches: 0` (`1,117 / 1,117` exact) |
---
### Step 4: Newcomer Onboarding Documentation & Zero-Ambiguity PR Artifacts
When invoked with `--generate-docs` and `--out-dir /workspace/hyperdope-ci-build`:
1. **Onboarding Guide Generation:**
- Writes `docs/ONBOARDING-INGGLISH-AQ.md` (and compiles the 2-page PDF `ONBOARDING-INGGLISH-AQ.pdf` via ReportLab, verified with `pypdf` and `pdfplumber`).
- Explains gematria and `hyperdope-gematria`'s 69 simultaneous ciphers from first principles, contrasts Standard English (`Gen 0`, diachronic spelling with silent-letter "ghost mass" like `knight = 123`) against Ingglish (`Gen 1`, synchronic phonemic spelling `nait = 80`), and provides a 3-minute hands-on quickstart.
2. **Zero-Ambiguity Git & GitHub PR Artifacts:**
- `db_ingglish_entries.txt`: Standalone sorted file of all `1,117` verified `Ingglish [Ingglish: Gloss]` lines prefixed with `CREATE_GEMATRO_DB`.
- `commit-message.txt`: Conventional Commit title (`feat(db): provision verified Ingglish phonetic lexicon and AQ attractor corpus`) and itemized audit summary.
- `pr-body.md`: Complete GitHub Pull Request markdown description with architectural notes, sample equations table, and pre-verified `[x]` test plan.
- `pr-payload.json`: Strict UTF-8 JSON payload for `POST /repos/malonehunter/hyperdope-gematria/pulls` (`"base": "master"`, `"head": "feat/ingglish-aq-corpus"`) with SHA-256 digests of all build artifacts.
- `submit-pr.sh`: Executable non-interactive script that stages `db.txt`, `tools/normalize_caps.py`, `config.default.js`, and `docs/ONBOARDING-INGGLISH-AQ.md`, commits using `commit-message.txt`, and (when `SUBMIT_REMOTE=1`) pushes to `origin` and opens the PR via `gh pr create` or the GitHub REST API.
3. **Staging Repo Commit & Branch Alignment (`/workspace/hyperdope-ci-build`):**
- Run command: `TZ=UTC python3 /workspace/ingglish-hyperdope-gematria/ingglish-aq-archive/scripts/ci_provision_ingglish.py --archive-dir /workspace/ingglish-hyperdope-gematria/ingglish-aq-archive --repo-dir /workspace/hyperdope-ci-build --out-dir /workspace/hyperdope-ci-build --tier 2 --apply-repo --generate-docs`
- Because `--apply-repo` runs `submit-pr.sh` before writing the final `ci-audit-report.json` and `pr-payload.json` hashes, remove any duplicate root `/workspace/hyperdope-ci-build/ONBOARDING-INGGLISH-AQ.md` (keeping `docs/ONBOARDING-INGGLISH-AQ.md`), stage the updated CI/PR artifacts with `git add -u`, commit them to `feat/ingglish-aq-corpus`, and fast-forward `master` and `main` to match `feat/ingglish-aq-corpus`.
---
### Step 5: Syncing `/workspace/hyperdope-ci-build` into `/workspace/hyperdope-gematria`
Integrating the verified CI corpus into the full `hyperdope-gematria` application repository (`/workspace/hyperdope-gematria`) while preserving custom UI feature branches follows a strict branch-isolation sequence:
1. **Checkout the Corpus Branch First (`feat/ingglish-aq-corpus`):**
- Run: `git -C /workspace/hyperdope-gematria checkout feat/ingglish-aq-corpus`
- *Why this is critical:* `submit-pr.sh` executes `git checkout -B feat/ingglish-aq-corpus` if the current branch is not `feat/ingglish-aq-corpus`. Checking out `feat/ingglish-aq-corpus` before running `--apply-repo` ensures the database commit lands cleanly on the corpus branch without pulling UI commits from `feat/ingglish-priority-toggle` into the upstream database PR branch.
2. **Apply the Provisioned Corpus to `/workspace/hyperdope-gematria`:**
- Run: `TZ=UTC python3 /workspace/ingglish-hyperdope-gematria/ingglish-aq-archive/scripts/ci_provision_ingglish.py --archive-dir /workspace/ingglish-hyperdope-gematria/ingglish-aq-archive --out-dir /workspace/hyperdope-ci-build --repo-dir /workspace/hyperdope-gematria --tier 2 --apply-repo`
- What happens inside `apply_to_repo()`:
- Ensures `INGGLISH_NON_ROMAN` is present in `/workspace/hyperdope-gematria/tools/normalize_caps.py`.
- Appends the `1,117` formatted Ingglish entries to `/workspace/hyperdope-gematria/db.txt` (`231,011` existing lines + `1,117` entries = `232,128` raw lines).
- Runs `python3 tools/normalize_caps.py db.txt db.txt`, which case-insensitively deduplicates the `1,068` previously provisioned Ingglish entries, sorts the entire database alphabetically, and writes `231,060` net entries (`+49` net new entries) with `0` unexpected case changes.
- Updates `/workspace/hyperdope-gematria/docs/ONBOARDING-INGGLISH-AQ.md`.
- Increments `databaseVersion` in `/workspace/hyperdope-gematria/config.default.js` (`4 -> 5`) to cache-bust browser fetches (`db.json?v=5`).
- Commits the result on `feat/ingglish-aq-corpus` (`c1e6a98`).
- Restore `/workspace/hyperdope-ci-build/ci-audit-report.json` (`git -C /workspace/hyperdope-ci-build checkout -- ci-audit-report.json`) so `hyperdope-ci-build` retains its own `repo_commit` metadata.
3. **Rebase Stacked UI Branch (`feat/ingglish-priority-toggle`) & Align `main` / `master`:**
- Run:
- `git -C /workspace/hyperdope-gematria checkout feat/ingglish-priority-toggle`
- `git -C /workspace/hyperdope-gematria rebase feat/ingglish-aq-corpus`
- `git -C /workspace/hyperdope-gematria checkout main && git -C /workspace/hyperdope-gematria reset --hard feat/ingglish-priority-toggle`
- `git -C /workspace/hyperdope-gematria checkout -B master feat/ingglish-priority-toggle`
- This stacks the UI toggle commit (`01aee23`: `optPrioritizeIngglish`, `chkbox_PIM` in the Options menu, `ING ↑` header button `#queryIngPriorityBtn`, and `compareQueryMatches()` in `calc/database.js`) cleanly on top of the updated `231,060`-entry corpus.
---
### Step 6: Precomputing `db.json` & `db_lite.json` for Browser Serving
Because `hyperdope-gematria` loads precomputed JSON bundles in the browser (`db_lite.json` for instant fast-paint across 16 common ciphers, followed by `db.json` in the background across all 82 ciphers), updating `db.txt` requires recompiling both JSON files:
1. **Sync Runtime Config (`config.js`):**
- Run: `cp /workspace/hyperdope-gematria/config.default.js /workspace/hyperdope-gematria/config.js`
- Ensures the untracked local `config.js` matches `databaseVersion: 5` and `prioritizeIngglishMatches: false`.
2. **Compile `db.json` and `db_lite.json` (`timeout=600`):**
- Run (with a 600-second timeout, as scoring `231,060` phrases × `82` ciphers takes ~180–210 seconds):
- `cd /workspace/hyperdope-gematria && python3 tools/generate_db_json.py db.txt db.json`
- Output artifacts (gitignored in `.gitignore`, served directly by the web server or attached to tagged releases):
- `/workspace/hyperdope-gematria/db.json`: `77 MB` (`231,060` entries in `data`, all ciphers).
- `/workspace/hyperdope-gematria/db_lite.json`: `19 MB` (`231,060` entries in `data`, 16 lite ciphers).
3. **Verify & Serve:**
- Verify entry counts in Python: confirm `len(json.load(open("db.json"))["data"]) == 231060` and `len(json.load(open("db_lite.json"))["data"]) == 231060`.
- Serve locally via `python3 -m http.server 8080 --bind 127.0.0.1 --directory /workspace/hyperdope-gematria`.
- From the host environment (where SSH keys reside), publish updated branches to remotes:
- `git -C /workspace/hyperdope-ci-build push origin master main feat/ingglish-aq-corpus`
- `git -C /workspace/hyperdope-gematria push downstream master main feat/ingglish-aq-corpus feat/ingglish-priority-toggle --force-with-lease`
---
## 4. Operational Pitfalls & Safeguards Checklist
- **Roman Numeral False Positives (`normalize_caps.py`):** Short Ingglish words (`di`, `li`, `mi`, `vi`, `iv`, `ci`, `xi`) match the Roman numeral regex `ROMAN`. Always ensure `INGGLISH_NON_ROMAN` is patched in `tools/normalize_caps.py` before running normalization so case-sensitive ciphers are never altered.
- **Interior Bracket Words (`[Ingglish: ...]`):** `normalize_caps.py` skips tokens containing `[` or `]`, meaning the first word (`[Ingglish:`) and last word (`Whiskey]`) are skipped, while interior English gloss words pass through `xform_word()`. Always format the English gloss in strict Proper Case.
- **Branch Contamination on `--apply-repo`:** Always `git checkout feat/ingglish-aq-corpus` in `/workspace/hyperdope-gematria` prior to running `ci_provision_ingglish.py --apply-repo`, then rebase `feat/ingglish-priority-toggle` onto `feat/ingglish-aq-corpus` afterward.
- **Squashed Corpus Rebasing (`--onto`):** If multiple `feat(db)` commits on `feat/ingglish-aq-corpus` are ever squashed, rebase `feat/ingglish-priority-toggle` using `git rebase --onto feat/ingglish-aq-corpus <old_corpus_sha> feat/ingglish-priority-toggle` to avoid replaying superseded `databaseVersion` bumps.
- **Precomputation Timeout (`generate_db_json.py`):** Compiling `231,060` rows takes ~3 minutes. Always invoke `tools/generate_db_json.py` with `timeout=600` so the process finishes writing both `db.json` and `db_lite.json` cleanly.