Skip to content

Commit 698901a

Browse files
Merge branch 'main' into phase-0/wiki-and-machine-docs
2 parents c132f59 + 7d32728 commit 698901a

36 files changed

Lines changed: 704 additions & 190 deletions

.github/copilot-instructions.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333

3434
## Banned Languages
3535

36-
- No TypeScript (use ReScript)
36+
- No TypeScript (use AffineScript)
3737
- No Node.js / npm / bun (use Deno)
3838
- No Go (use Rust)
3939
- No Python (use Julia or Rust)

.github/workflows/dogfood-gate.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ jobs:
143143
-not -path '*/.deno/*' -not -path '*/target/*' \
144144
-not -path '*/_build/*' -not -path '*/deps/*' \
145145
-not -path '*/external_corpora/*' -not -path '*/.lake/*' \
146-
-type f \( -name '*.rs' -o -name '*.ex' -o -name '*.exs' -o -name '*.res' \
146+
-type f \( -name '*.rs' -o -name '*.ex' -o -name '*.exs' -o -name '*.affine' \
147147
-o -name '*.js' -o -name '*.ts' -o -name '*.json' -o -name '*.toml' \
148148
-o -name '*.yml' -o -name '*.yaml' -o -name '*.md' -o -name '*.adoc' \
149149
-o -name '*.idr' -o -name '*.zig' -o -name '*.v' -o -name '*.jl' \
@@ -213,7 +213,7 @@ jobs:
213213
fi
214214
215215
# Check for Groove endpoint code (Rust, Elixir, Zig, V)
216-
if grep -rl 'well-known/groove' --include='*.rs' --include='*.ex' --include='*.zig' --include='*.v' --include='*.res' . 2>/dev/null | head -1 | grep -q .; then
216+
if grep -rl 'well-known/groove' --include='*.rs' --include='*.ex' --include='*.zig' --include='*.v' --include='*.affine' . 2>/dev/null | head -1 | grep -q .; then
217217
HAS_GROOVE_CODE="true"
218218
fi
219219

.github/workflows/e2e.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
#
66
# Runs on every PR and push to main. Three jobs:
77
# structural — fast structural checks (no compiler required)
8-
# smoke — Node.js smoke test (ReScript parser + example files)
8+
# smoke — Node.js smoke test (AffineScript parser + example files)
99
# build-e2e — Full Idris2 + Zig build then E2E
1010
# cargo-verify — Cargo workspace build + test (typed-wasm-verify crate)
1111
name: E2E Validation
@@ -38,7 +38,7 @@ jobs:
3838
# Job 2: Smoke test — Node.js parser validation
3939
# --------------------------------------------------------------------------
4040
smoke:
41-
name: Smoke test (Node.js ReScript parser)
41+
name: Smoke test (Node.js AffineScript parser)
4242
runs-on: ubuntu-latest
4343

4444
steps:
@@ -53,7 +53,7 @@ jobs:
5353
- name: Install npm deps (rescript build prerequisite)
5454
run: npm install --no-audit --no-fund --silent
5555

56-
- name: Build ReScript parser
56+
- name: Build AffineScript parser
5757
run: node_modules/.bin/rescript build
5858

5959
- name: Run smoke test

.github/workflows/hypatia-scan.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -406,7 +406,7 @@ jobs:
406406
comment += `</details>\n\n`;
407407
comment += `*Powered by Hypatia Neurosymbolic CI/CD Intelligence*`;
408408
409-
github.rest.issues.createComment({
409+
github.affinet.issues.createComment({
410410
owner: context.repo.owner,
411411
repo: context.repo.repo,
412412
issue_number: context.issue.number,

.github/workflows/rhodibot.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ jobs:
150150
# --- 7. Check dangerous patterns ---
151151
DANGEROUS=""
152152
for pattern in "believe_me" "assert_total" "Admitted" "sorry" "unsafeCoerce" "Obj.magic"; do
153-
count=$(grep -r "$pattern" --include='*.idr' --include='*.v' --include='*.lean' --include='*.hs' --include='*.ml' --include='*.res' . 2>/dev/null | grep -v node_modules | wc -l || echo 0)
153+
count=$(grep -r "$pattern" --include='*.idr' --include='*.v' --include='*.lean' --include='*.hs' --include='*.ml' --include='*.affine' . 2>/dev/null | grep -v node_modules | wc -l || echo 0)
154154
if [ "$count" -gt 0 ]; then
155155
DANGEROUS="$DANGEROUS\n- \`$pattern\`: $count occurrences"
156156
fi

.hypatia-ignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
# Honored by hyperpolymath/standards/.github/workflows/governance-reusable.yml
66
# (the "Check for ReScript / Go / Python (banned language files)" step).
77
#
8-
# ReScript exemptions: the current parser surface is written in ReScript and
8+
# AffineScript exemptions: the current parser surface is written in AffineScript and
99
# will be replaced by a tree-sitter-derived Idris2 parser (Track A in the
1010
# project roadmap). Until that work lands the source must remain checked in
1111
# so the smoke + aspect + level tests have something to import.

CHANGELOG.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1111
## [Unreleased]
1212

1313
### Added
14-
- **typed-wasm-verify** Rust crate (`crates/typed-wasm-verify/`) — post-codegen verifier for L7 (aliasing) + L10 (linearity) on emitted wasm modules. Rust port of `hyperpolymath/affinescript:lib/{tw_verify,tw_interface}.ml`. 50/50 tests pass (40 unit + 10 cross-compat integration). Replaces the ReScript verifier path which is on its way out.
14+
- **typed-wasm-verify** Rust crate (`crates/typed-wasm-verify/`) — post-codegen verifier for L7 (aliasing) + L10 (linearity) on emitted wasm modules. Rust port of `hyperpolymath/affinescript:lib/{tw_verify,tw_interface}.ml`. 50/50 tests pass (40 unit + 10 cross-compat integration). Replaces the AffineScript verifier path which is on its way out.
1515
- C1 (#19) — Scaffold: crate skeleton, public types (`OwnershipKind`, `OwnershipError`, `CrossError`, `FuncInterface`, `VerifyError`), `OWNERSHIP_SECTION_NAME` constant, stubbed entry points.
1616
- C2 (#20) — `affinescript.ownership` custom-section codec (parse + encode), 11 unit tests covering wire-format round-trip and OCaml-parity leniency.
1717
- C3 (#21) — Per-path `(min, max)` use-range analysis with a control-flow frame stack over wasmparser's operator stream. `verify_function` + `verify_from_module` implement the intra-fn L7+L10 rules. 9 algorithmic + 9 end-to-end tests.
@@ -23,4 +23,4 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2323
- TypedQLiser plugin exists at typedqliser/src/plugins/wasm.rs (541 lines, 9 tests)
2424

2525
### Changed
26-
- Repo is now polyglot Idris2 + Zig + Rust (added a Cargo workspace at the root, `crates/typed-wasm-verify/` is its first member). ReScript files in `src/parser/*.res` remain in tree as the v1.1 surface parser, but the post-codegen verifier no longer depends on them.
26+
- Repo is now polyglot Idris2 + Zig + Rust (added a Cargo workspace at the root, `crates/typed-wasm-verify/` is its first member). AffineScript files in `src/parser/*.affine` remain in tree as the v1.1 surface parser, but the post-codegen verifier no longer depends on them.

EXPLAINME.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ L11 and L12 are formally specified in `src/abi/TypedWasm/ABI/Tropical.idr` (L11:
3030

3131
**From README**:
3232
____
33-
When Module A (compiled from Rust) shares memory with Module B (compiled from ReScript), **neither source-level type system can verify the boundary.**
33+
When Module A (compiled from Rust) shares memory with Module B (compiled from AffineScript), **neither source-level type system can verify the boundary.**
3434
3535
typed-wasm declares the shared schema once. Both modules import it. The typed-wasm checker verifies structural agreement at compile time, before any module runs.
3636
____

Justfile

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -59,29 +59,29 @@ init:
5959
# BUILD & COMPILE
6060
# ═══════════════════════════════════════════════════════════════════════════════
6161

62-
# Build the project — ReScript parser + Zig FFI
62+
# Build the project — AffineScript parser + Zig FFI
6363
build *args:
6464
@echo "Building {{project}}..."
65-
rescript build
65+
affinescript build
6666
cd ffi/zig && zig build
6767
@echo "Build complete"
6868

6969
# Build in release mode with optimizations
7070
build-release *args:
7171
@echo "Building {{project}} (release)..."
72-
rescript build
72+
affinescript build
7373
cd ffi/zig && zig build -Doptimize=ReleaseFast
7474
@echo "Release build complete"
7575

7676
# Build and watch for changes
7777
build-watch:
7878
@echo "Watching for changes..."
79-
find src -name '*.res' | entr -c just build
79+
find src -name '*.affine' | entr -c just build
8080

8181
# Clean build artifacts [reversible: rebuild with `just build`]
8282
clean:
8383
@echo "Cleaning..."
84-
rescript clean
84+
affinescript clean
8585
rm -rf lib/bs lib/ocaml
8686
rm -rf ffi/zig/zig-out ffi/zig/.zig-cache
8787
rm -rf src/abi/build
@@ -94,10 +94,10 @@ clean-all: clean
9494
# TEST & QUALITY
9595
# ═══════════════════════════════════════════════════════════════════════════════
9696

97-
# Run all tests — ReScript parser tests + Zig FFI tests
97+
# Run all tests — AffineScript parser tests + Zig FFI tests
9898
test *args:
99-
@echo "Running ReScript parser tests..."
100-
rescript build
99+
@echo "Running AffineScript parser tests..."
100+
affinescript build
101101
node tests/parser/ParserTests.mjs
102102
@echo ""
103103
@echo "Running contract tests..."
@@ -126,15 +126,15 @@ test *args:
126126
# Run tests with verbose output
127127
test-verbose:
128128
@echo "Running all tests (verbose)..."
129-
rescript build
129+
affinescript build
130130
node tests/parser/ParserTests.mjs
131131
cd ffi/zig && zig build test
132132
node tests/smoke/e2e-smoke.mjs
133133

134134
# End-to-end smoke test — parse example, verify ABI correspondence
135135
test-smoke:
136136
@echo "Running E2E smoke test..."
137-
rescript build
137+
affinescript build
138138
node tests/smoke/e2e-smoke.mjs
139139

140140
# ABI contract tests
@@ -145,7 +145,7 @@ test-contract:
145145
# End-to-end test surface
146146
test-e2e:
147147
@echo "Running end-to-end tests..."
148-
rescript build
148+
affinescript build
149149
node tests/smoke/e2e-smoke.mjs
150150
node tests/e2e/e2e-driver.mjs
151151

@@ -168,7 +168,7 @@ test-proof:
168168
# Parser benchmark surface
169169
bench:
170170
@echo "Running parser benchmark..."
171-
rescript build
171+
affinescript build
172172
node benchmarks/parser-bench.mjs
173173

174174
# Type-check Idris2 ABI modules (formal proofs)
@@ -192,19 +192,19 @@ fix: fmt
192192
# Format all source files [reversible: git checkout]
193193
fmt:
194194
@echo "Formatting source files..."
195-
npx rescript format
195+
affinescript format
196196
zig fmt ffi/zig/build.zig ffi/zig/src/main.zig ffi/zig/test/integration_test.zig ffi/zig/test/echidna_oracle_test.zig >/dev/null
197197

198198
# Check formatting without changes
199199
fmt-check:
200200
@echo "Checking formatting..."
201-
npx rescript format --check
201+
affinescript format --check
202202
zig fmt --check ffi/zig/build.zig ffi/zig/src/main.zig ffi/zig/test/integration_test.zig ffi/zig/test/echidna_oracle_test.zig
203203

204204
# Run linter
205205
lint:
206-
@echo "Linting ReScript sources with warnings-as-errors..."
207-
npx rescript build --warn-error "+3+4+45+102"
206+
@echo "Linting AffineScript sources with warnings-as-errors..."
207+
npx affinescript build --warn-error "+3+4+45+102"
208208

209209
# ═══════════════════════════════════════════════════════════════════════════════
210210
# RUN & EXECUTE
@@ -580,11 +580,11 @@ release-tag version:
580580
581581
# Count lines of code
582582
loc:
583-
@find . \( -name "*.rs" -o -name "*.ex" -o -name "*.exs" -o -name "*.res" -o -name "*.gleam" -o -name "*.zig" -o -name "*.idr" -o -name "*.hs" -o -name "*.ncl" -o -name "*.scm" -o -name "*.adb" -o -name "*.ads" \) -not -path './target/*' -not -path './_build/*' 2>/dev/null | xargs wc -l 2>/dev/null | tail -1 || echo "0"
583+
@find . \( -name "*.rs" -o -name "*.ex" -o -name "*.exs" -o -name "*.affine" -o -name "*.gleam" -o -name "*.zig" -o -name "*.idr" -o -name "*.hs" -o -name "*.ncl" -o -name "*.scm" -o -name "*.adb" -o -name "*.ads" \) -not -path './target/*' -not -path './_build/*' 2>/dev/null | xargs wc -l 2>/dev/null | tail -1 || echo "0"
584584
585585
# Show TODO comments
586586
todos:
587-
@grep -rn "TODO\|FIXME\|HACK\|XXX" --include="*.rs" --include="*.ex" --include="*.res" --include="*.gleam" --include="*.zig" --include="*.idr" --include="*.hs" . 2>/dev/null || echo "No TODOs"
587+
@grep -rn "TODO\|FIXME\|HACK\|XXX" --include="*.rs" --include="*.ex" --include="*.affine" --include="*.gleam" --include="*.zig" --include="*.idr" --include="*.hs" . 2>/dev/null || echo "No TODOs"
588588
589589
# Open in editor
590590
edit:
@@ -606,7 +606,7 @@ doctor:
606606
@command -v just >/dev/null 2>&1 && echo " [OK] just" || echo " [FAIL] just not found"
607607
@command -v git >/dev/null 2>&1 && echo " [OK] git" || echo " [FAIL] git not found"
608608
@echo "Checking for hardcoded paths..."
609-
@grep -rn '$HOME\|$ECLIPSE_DIR' --include='*.rs' --include='*.ex' --include='*.res' --include='*.gleam' --include='*.sh' . 2>/dev/null | head -5 || echo " [OK] No hardcoded paths"
609+
@grep -rn '$HOME\|$ECLIPSE_DIR' --include='*.rs' --include='*.ex' --include='*.affine' --include='*.gleam' --include='*.sh' . 2>/dev/null | head -5 || echo " [OK] No hardcoded paths"
610610
@echo "Diagnostics complete."
611611
612612
# Auto-repair common issues

LEVEL-STATUS.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,12 @@ natural home for "striation is cheaper" proofs once it lands.
2828

2929
| Feature | Grammar | AST | Lexer | Parser | Checker | Tests |
3030
|---------|---------|-----|-------|--------|---------|-------|
31-
| `const` top-level | spec/grammar.ebnf | Ast.ConstDecl | Const | **DONE** parseConstDecl (Parser.res:2088) | Checker.constValueIsLiteral | **DONE** |
32-
| `match` on union | spec/grammar.ebnf | Ast.MatchStmt | Match | **DONE** (Parser.res:1191) | Checker.matchIsExhaustive | **DONE** |
33-
| Block-expr `if` | spec/grammar.ebnf | Ast.BlockIfExpr | Yield | **DONE** (Parser.res:529) | Checker.blockIfBranchesAgree | **DONE** |
34-
| Split `effects` | spec/grammar.ebnf | functionDecl.caps | (contextual) | **DONE** parseEffectsClause (Parser.res:1554) | (opaque until L15) | **DONE** |
31+
| `const` top-level | spec/grammar.ebnf | Ast.ConstDecl | Const | **DONE** parseConstDecl (Parser.affine:2088) | Checker.constValueIsLiteral | **DONE** |
32+
| `match` on union | spec/grammar.ebnf | Ast.MatchStmt | Match | **DONE** (Parser.affine:1191) | Checker.matchIsExhaustive | **DONE** |
33+
| Block-expr `if` | spec/grammar.ebnf | Ast.BlockIfExpr | Yield | **DONE** (Parser.affine:529) | Checker.blockIfBranchesAgree | **DONE** |
34+
| Split `effects` | spec/grammar.ebnf | functionDecl.caps | (contextual) | **DONE** parseEffectsClause (Parser.affine:1554) | (opaque until L15) | **DONE** |
3535
| `striated` regions | spec/grammar.ebnf | regionDecl.layout | Striated | **DONE** | Checker.striatedLayoutIsWellFormed | **DONE** |
36-
| Reserved keywords (L13-L16) | spec/L13-L16-reserved-syntax.adoc || contextual (per-block) | **DONE** (Parser.res:2685-2718) || **DONE** (v1.4/v1.5 rejection tests) |
36+
| Reserved keywords (L13-L16) | spec/L13-L16-reserved-syntax.adoc || contextual (per-block) | **DONE** (Parser.affine:2685-2718) || **DONE** (v1.4/v1.5 rejection tests) |
3737

3838
**v1.1 surface sugar fully landed: parser, checker, tests all live.
3939
88/88 parser tests pass (verified 2026-04-18). LEVEL-STATUS table was stale
@@ -96,7 +96,7 @@ toolchain remains future work.
9696
| Effects.idr | 0 | 0 | 0 | In package |
9797
| Lifetime.idr | 0 | 0 | 0 | In package |
9898
| Linear.idr | 0 | 0 | 0 | In package |
99-
| MultiModule.idr | 0 | 0 | 0 | In package. Flagship no-spoofing theorem proven A6 (2026-04-18): `FieldMatches`, `SchemaSub` preorder (`schemaSubRefl`, `schemaSubTrans`), `ModuleCompat` indexed on modules + schemas (`compatRefl`, `compatTrans`), and the flagship `noSpoofing : ModuleCompat from to imp exp -> FieldMatches f imp -> FieldMatches f exp`. Worked Rust-exports / ReScript-imports example (4-field export, 2-field import subset) constructs a live certificate and applies the theorem. |
99+
| MultiModule.idr | 0 | 0 | 0 | In package. Flagship no-spoofing theorem proven A6 (2026-04-18): `FieldMatches`, `SchemaSub` preorder (`schemaSubRefl`, `schemaSubTrans`), `ModuleCompat` indexed on modules + schemas (`compatRefl`, `compatTrans`), and the flagship `noSpoofing : ModuleCompat from to imp exp -> FieldMatches f imp -> FieldMatches f exp`. Worked Rust-exports / AffineScript-imports example (4-field export, 2-field import subset) constructs a live certificate and applies the theorem. |
100100
| ModuleIsolation.idr | 0 | 0 | 0 | In package (v1.2 / L13) |
101101
| SessionProtocol.idr | 0 | 0 | 0 | In package (v1.3 / L14) |
102102
| ResourceCapabilities.idr | 0 | 0 | 0 | In package (v1.4 / L15) |

0 commit comments

Comments
 (0)