feat(rules): unsafe reaches foreign defs, fuel sees U32.to_nat, bend 2.0.34 text - #219
Merged
Merged
Conversation
…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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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, thenError: N defs rely on unsafe or foreign code:, exit 1) when any def it loads is@unsafeor 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 onlyimport "./x.c"/import "./x.js"lines, the shape ruleforeignalready 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 newImports.trailBFS) and says to move the effect into a sibling module no law file imports. The header rationale is rewritten for 2.0.34.Digest.Unsafegets aforeign: Boolfield, andDigest.ofappends the file's top-level foreign defs.import 0x…/paththrough 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 anoqa: U006with the reason.hole
The header now quotes bend's
1 TODO found./N TODOs found., printed underSOME PROOFS FAILwith exit 1. The staleAll terms check.quotes in AGENTS.md and docs/rfc/bolt-spec.md now sayALL PROOFS CHECK.Verification
ALL PROOFS CHECKon bend 2.0.34.nix flake check -Lpasses (0 errors, 73 warnings, the same L001 warnings as main).U32.to_nat(N)bound on an IO/walk loop, and those repos grade U006 as an error.🤖 Generated with Claude Code