Skip to content

feat(rules): unsafe reaches foreign defs, fuel sees U32.to_nat, bend 2.0.34 text - #219

Merged
noah-emp merged 1 commit into
mainfrom
feat/rules-bend-2.0.34
Sep 30, 2026
Merged

noah-emp merged 1 commit into
mainfrom
feat/rules-bend-2.0.34

Conversation

@noah-emp

Copy link
Copy Markdown
Collaborator

Brings three rules up to bend 2.0.32–2.0.34.

unsafe (L003, BOLT-LAW-3)

Since 2.0.32 a proof fails (SOME PROOFS FAIL, then Error: N defs rely on unsafe or foreign code:, exit 1) when any def it loads is @unsafe or foreign, whether or not a law names that def. The rule used to catch only @unsafe. Now it also reports a foreign def (a body of only import "./x.c" / import "./x.js" lines, the shape rule foreign already reads) that a LAWS.bend or PROOF.bend reaches through relative imports. The message names the shortest import path from the law file (LAWS.bend -> mid.bend -> eff/io.bend, from the new Imports.trail BFS) and says to move the effect into a sibling module no law file imports. The header rationale is rewritten for 2.0.34.

  • Digest.Unsafe gets a foreign: Bool field, and Digest.of appends the file's top-level foreign defs.
  • Hash imports (import 0x…/path through BEND_LIB) are not followed. bolt reads only the files in the run. Following them would mean new planner asks for .ez/lib/<hash>/… files and reading BEND_LIB, plus changes to the planner's laws. That is left for a follow-up.

fuel (U006, BOLT-RULE-U006)

U32.to_nat(<U32 literal>) passed as a fuel argument is now reported the same way a Nat literal is. Let-bound and parenthesized literals are still out of scope. The rationale is updated: 2.0.29 made recursion on a Nat literal linear (#983), so the checker no longer hangs. On 2.0.33/2.0.34, though, a lemma proved over every fuel and then used at a big fixed fuel overflows the checker's stack. bolt's own two IO read loops (src/lsp/files/disk.bend, src/lsp/transport/stdio.bend) now carry a noqa: U006 with the reason.

hole

The header now quotes bend's 1 TODO found. / N TODOs found., printed under SOME PROOFS FAIL with exit 1. The stale All terms check. quotes in AGENTS.md and docs/rfc/bolt-spec.md now say ALL PROOFS CHECK.

Verification

  • Every PROOF.bend prints ALL PROOFS CHECK on bend 2.0.34.
  • nix flake check -L passes (0 errors, 73 warnings, the same L001 warnings as main).
  • A binary built from this branch finds no L003 in ezaudio, ezhttp, snap or ez.
  • The wider fuel rule adds new U006 findings: 1 in snap and 15 in ez. Every one is a U32.to_nat(N) bound on an IO/walk loop, and those repos grade U006 as an error.

🤖 Generated with Claude Code

…2.0.34 text

- unsafe (L003): a LAWS.bend or PROOF.bend that reaches, by relative
  imports over the files bolt read, a foreign def (a body of only
  `import "./x.c"` / `import "./x.js"` lines) is now a finding too, since
  bend 2.0.32 fails such a proof (SOME PROOFS FAIL, then "Error: N defs
  rely on unsafe or foreign code:", exit 1). The message names the
  shortest import path from the law file to the def's file
  (Imports.trail) and says to move the effect into a sibling module no
  law file imports. Hash imports are not followed yet. Digest.Unsafe
  carries a `foreign` flag; the rationale is rewritten for 2.0.34.
- fuel (U006): `U32.to_nat(<U32 literal>)` passed as a fuel is reported
  like a Nat literal. The rationale now reflects 2.0.29's linear literal
  recursion and 2.0.33/2.0.34's stack overflow on a big fixed fuel in a
  law. bolt's own two IO read loops carry a noqa.
- hole: quotes bend's "1 TODO found." / "N TODOs found."; AGENTS.md and
  the spec RFC no longer quote "All terms check.".

BOLT-LAW-3 and BOLT-RULE-U006 rows, their laws and proofs updated.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@noah-emp
noah-emp enabled auto-merge (squash) September 30, 2026 00:41
@noah-emp
noah-emp merged commit 639d1fe into main Sep 30, 2026
1 check passed
@noah-emp
noah-emp deleted the feat/rules-bend-2.0.34 branch September 30, 2026 00:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant