Skip to content

WIP: AffineScript co-development — migration practice, frontier guide, verified cross-repo proofs - #531

Merged
hyperpolymath merged 1 commit into
mainfrom
claude/cool-keller-gr5sl
Jun 4, 2026
Merged

WIP: AffineScript co-development — migration practice, frontier guide, verified cross-repo proofs#531
hyperpolymath merged 1 commit into
mainfrom
claude/cool-keller-gr5sl

Conversation

@hyperpolymath

Copy link
Copy Markdown
Owner

What this is

A co-development branch practising the idaptik ReScript → AffineScript → wasm migration for real, harvesting the lessons into the affinescript frontier-practices guide, and working out the proofs/conflicts that surface when AffineScript meets a real game.

Working agreement for this branch: writes land in the affinescript repo only. Anything destined for another repo (idaptik, echo-types, standards) is staged as a reviewable, diff-able artefact under proposals/ — never written into its home repo without review.

Landed so far

proposals/echo-types/ — verified soundness proof ✅

A machine-checked Agda module, EchoEncodingFaithfulness.agda, that certifies the soundness of the co-processor integerization pattern ("the integer IS the X"):

  • lossless half — an injective host-boundary encoder makes the integer a faithful name (every fibre unique);
  • lossy half — a code collision provably destroys the distinction (no decode can type-check);
  • the clamp-to-sentinel hazard — the canonical "default bad input to 0/Open" migration bug, exhibited as a checked concrete instance of localized controlled loss.

Typechecks under --safe --without-K with Agda 2.6.3 + agda-stdlib 2.3, zero postulates, zero funext. Independently re-verified in-session. Reuses echo-types' existing injective-fibres-proj-unique / no-section-of-collapsing-map — adds no new primitive, only the migration-engineer packaging + worked SecurityRank-shaped instance. See proposals/echo-types/README.adoc for the land-it steps.

Incoming (in progress)

  • proposals/idaptik/ — a pure-integer coprocessor kernel migrated to .affine end-to-end, with its differential-parity harness (broad sweep → deep verified exemplar).
  • frontier-practices guide chapters — co-processor integerization, differential parity as the acceptance bar, the String host-boundary ABI, written for both human and agent readers.
  • proposals/toolchain/ — the variable-string-backend gap, --deno-esm to retire the TS harnesses, compiler-emitted Echo boundary obligations, release-cadence coupling.
  • proposals/standards/ — estate-standards implications.

Toolchain note

Built against the github-only network policy (crates.io / deno.land / opam.ocaml.org are 403-blocked; GitHub + ubuntu-archive reachable). Agda+stdlib, ocaml/dune, deno, and panic-attack are all installed and verified by routing every install around the block.

Draft — will be updated as the streams land.

https://claude.ai/code/session_01WoKhFQePiRsAj7aqnxbG8s


Generated by Claude Code

…ho-types)

Stage a machine-checked Agda module certifying the "the integer IS the X"
co-processor integerization pattern used by the idaptik ReScript -> AffineScript
migration: lossless half (injective encoder => unique fibres), lossy half
(collision => no section), and the clamp-to-sentinel hazard as a checked
instance. Typechecks under --safe --without-K with agda 2.6.3 + stdlib 2.3,
zero postulates / funext.

Staged under proposals/ (target: hyperpolymath/echo-types) for review;
not yet applied to echo-types.

https://claude.ai/code/session_01WoKhFQePiRsAj7aqnxbG8s
@github-actions

github-actions Bot commented Jun 4, 2026

Copy link
Copy Markdown

🔍 Hypatia Security Scan

Findings: 89 issues detected

Severity Count
🔴 Critical 2
🟠 High 17
🟡 Medium 70

⚠️ Action Required: Critical security issues found!

View findings
[
  {
    "reason": "Action perpolymath/standards/.github/workflows/governance-reusable.yml@main\n needs attention",
    "type": "unpinned_action",
    "file": "governance.yml",
    "action": "pin_sha",
    "rule_module": "workflow_audit",
    "severity": "medium"
  },
  {
    "reason": "Action ons/checkout@v6\n    needs attention",
    "type": "unpinned_action",
    "file": "publish-jsr.yml",
    "action": "pin_sha",
    "rule_module": "workflow_audit",
    "severity": "medium"
  },
  {
    "reason": "Action land/setup-deno@v2\n    needs attention",
    "type": "unpinned_action",
    "file": "publish-jsr.yml",
    "action": "pin_sha",
    "rule_module": "workflow_audit",
    "severity": "medium"
  },
  {
    "reason": "Issue in affine-vscode-publish.yml",
    "type": "missing_timeout_minutes",
    "file": "affine-vscode-publish.yml",
    "action": "flag",
    "rule_module": "workflow_audit",
    "severity": "medium"
  },
  {
    "reason": "Issue in casket-pages.yml",
    "type": "missing_timeout_minutes",
    "file": "casket-pages.yml",
    "action": "flag",
    "rule_module": "workflow_audit",
    "severity": "medium"
  },
  {
    "reason": "Issue in casket-pages.yml",
    "type": "missing_timeout_minutes",
    "file": "casket-pages.yml",
    "action": "flag",
    "rule_module": "workflow_audit",
    "severity": "medium"
  },
  {
    "reason": "Issue in casket-pages.yml",
    "type": "missing_timeout_minutes",
    "file": "casket-pages.yml",
    "action": "flag",
    "rule_module": "workflow_audit",
    "severity": "medium"
  },
  {
    "reason": "Issue in ci.yml",
    "type": "missing_timeout_minutes",
    "file": "ci.yml",
    "action": "flag",
    "rule_module": "workflow_audit",
    "severity": "medium"
  },
  {
    "reason": "Issue in ci.yml",
    "type": "missing_timeout_minutes",
    "file": "ci.yml",
    "action": "flag",
    "rule_module": "workflow_audit",
    "severity": "medium"
  },
  {
    "reason": "Issue in ci.yml",
    "type": "missing_timeout_minutes",
    "file": "ci.yml",
    "action": "flag",
    "rule_module": "workflow_audit",
    "severity": "medium"
  }
]

Powered by Hypatia Neurosymbolic CI/CD Intelligence

@hyperpolymath
hyperpolymath marked this pull request as ready for review June 4, 2026 17:06
@hyperpolymath
hyperpolymath enabled auto-merge (squash) June 4, 2026 17:06
@hyperpolymath
hyperpolymath merged commit cf0fcdf into main Jun 4, 2026
27 checks passed
@hyperpolymath
hyperpolymath deleted the claude/cool-keller-gr5sl branch June 4, 2026 17:08
hyperpolymath added a commit that referenced this pull request Jun 4, 2026
…k migration + frontier guide + cross-repo proposals (#532)

## What this is

Round 2 of the AffineScript co-development run (round 1 — the verified
echo-types soundness proof — merged as #531). This round **practises the
idaptik ReScript → AffineScript → wasm migration end-to-end,
host-native**, develops the frontier-practices guide, and stages the
cross-repo proposals. Writes are affinescript-only; everything targeting
another repo is staged under `proposals/` for review.

## Verified this session (every claim was run, not asserted)

| Artifact | Outcome |
|---|---|
| **`Kernel_IO`** — *fresh* re-decomposition | Compiles to wasm (2262B);
`main()` logic **6/6 green** through the wasm. The re-decomposition
*deletes* the `String.startsWith` step — compares Int arrays directly,
so no string crosses the boundary. |
| **`SecurityRank`** — existing port + proof tie-in | Differential
parity **78/78 ALL GREEN** vs a JS oracle; its out-of-band clamp is
certified as controlled loss by the echo-types
`clamp-sentinel-no-section` theorem (demonstrated live:
`rank(-5)=rank(0)=0`, `rank(99)=rank(3)=3`). |
| **`Kernel_Quantum`** — honest non-migration | Documented as
**compiler-gated** on the effect-codegen wall (module `Dict` state +
`Date.now` + `Console.log`), with the re-decomposition path it needs. |

## What's in the diff

- **Guide (first-class, `docs/guides/`)** — the co-processor
integerization chapter in `migration-playbook.adoc` (+444),
`frontier-guide.adoc` Chapter 9 (+145), and the `AI.a2ml` machine
companion (+76). Dual audience: human *and* agent. Six named patterns,
each grounded in a verified example.
- **`proposals/idaptik/`** — the two migrations + the non-migration,
source embedded (AGPL, since idaptik is AGPL-3.0-or-later; kept out of
the MPL tree as standalone files).
- **`proposals/toolchain/`** — six compiler findings: the
variable-string-backend gap (#1 leverage), compiler-emitted `@boundary`
Echo obligations, `--deno-esm` to retire the TS harnesses, the
stale-harness finding (TS + retired podman container),
github-only-network portability, release-cadence coupling, plus the
interpreter/codegen divergence bonus finding.
- **`proposals/standards/`** — drafted normative text (AS-MIG-1/2,
AS-ABI-STR-1, EST-CI-NET-1, the `--deno-esm`/TS-0 exemption amendment,
EST-REL-PIN-1).

## Lessons surfaced

Re-decompose-don't-transliterate (sometimes that means *deleting* the
String); affine types forbid casual aliasing of owned arrays; the
interpreter and wasm codegen **disagree** on a `let mut`
self-reassignment (verify through the wasm); host-native compile vs the
retired container; and the two compiler walls (string backend, effect
codegen) **are** the migration frontier — IO and Quantum are gated on
exactly those.

## Toolchain

Built entirely against the **github-only network policy** (crates.io /
deno.land / opam.ocaml.org all 403): agda+stdlib, ocaml/dune (apt, no
opam), deno (GitHub release), panic-attack — all installed and verified
by routing around the block.

Draft for review.

https://claude.ai/code/session_01WoKhFQePiRsAj7aqnxbG8s

---
_Generated by [Claude
Code](https://claude.ai/code/session_01WoKhFQePiRsAj7aqnxbG8s)_

---------

Co-authored-by: Claude <noreply@anthropic.com>
hyperpolymath added a commit that referenced this pull request Jun 5, 2026
…ks 1–5) (#533)

## What this is

Your "make 1–5 into trialable tools / components for a
nextgen-languages-evangelist" — done. Rather than five one-off fixes,
this seeds a **nextgen-languages-evangelist**: a toolkit that automates
the AffineScript-migration pipeline (triage → weak-points →
boundary-proof → parity) this session ran by hand. **Every component was
run and verified here** against the github-only firewall.

Staged under `proposals/nextgen-evangelist/` (writes stayed
affinescript-only). Builds on the merged #531 (proof) and #532
(migration + guide).

## The five components (each maps to an ask) — all trialed

| Component | Ask | Trial result (this session) |
|---|---|---|
| **echo-boundary** | #1 #2 | encoding table → LOSSLESS/CONTROLLED-LOSS
verdict + **generates & agda-typechecks** an `EchoEncodingFaithfulness`
proof (`{Open:0..Strong:3}`→LOSSLESS; `+{OOB:0}`→CONTROLLED LOSS; both
exit 0) |
| **affine-parity** | #2 #3 | generic differential-parity runner —
SecurityRank **78/78**, Kernel_IO `main()=6`, wrong-oracle negative
exits 1 |
| **affine-migratability** | #4 | `.res` triage — reproduces
Compute=MIGRATABLE, IO=STRING-GATED, Quantum=EFFECT-GATED (3/3) |
| **affine-assail** | #5 | `.affine` weak-point scanner — flags
SecurityRank's clamp `PA-AFF-001` at HIGH; reference impl for the
panic-attack gap |
| **deno-esm-spike** | #3 | **TS-0 path WORKS** — `.affine`→Deno-ESM
named exports, 5/5 driver checks, zero TypeScript |
| **evangelist** | all | orchestrator — emits one readiness report
(below) |

## Verified end-to-end (orchestrator output on the demo target)

```
① migratability:  Kernel_Compute → MIGRATABLE NOW   Kernel_IO → STRING-GATED   Kernel_Quantum → EFFECT-GATED
② weak points:    SecurityRank.affine → 1 (PA-AFF-001)   Kernel_IO.affine → 5
③ boundary proof: SecurityRank → LOSSLESS  (generated Agda, exit 0)
④ parity:         SecurityRank → 78/78 pass
```

The toolkit even surfaces a coherent story automatically: **assail
flags** SecurityRank's undeclared clamp, while **echo-boundary**
certifies the in-band table as LOSSLESS *and* the same table-with-clamp
as CONTROLLED LOSS — so it both flags the hazard and lets you discharge
it (the `@boundary` obligation from #532's toolchain proposal).

## Honest caveats

- Trial components are **Deno** (immediate runnability under the
firewall; each carries the sanctioned `hypatia: allow` pragma).
Production should be **Rust or AffineScript** per estate policy —
flagged, your call.
- `affine-parity` covers the **scalar i32 ABI**; array/string params
(the `[len:i32 LE][utf8]` + `__affine_alloc` convention) are a
follow-on.
- `deno-esm` works for pure functions; struct→`export class` + `extern
fn` lowering documented but not yet trialed (the prelude is ~440 lines).

Draft for review. Eventual home: a dedicated evangelist repo or under
`hyperpolymath/nextgen-languages` — your call.

https://claude.ai/code/session_01WoKhFQePiRsAj7aqnxbG8s

---
_Generated by [Claude
Code](https://claude.ai/code/session_01WoKhFQePiRsAj7aqnxbG8s)_

---------

Co-authored-by: Claude <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants