You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[tests] crypto suites (bigint/rsa/crypto) not executable: stale unsafe:/-> void syntax #1053
Zero executable coverage of lib/std/crypto/bigint.w (and the same staleness in tests/test_rsa.w, tests/test_crypto.w) at 450733e: with test tests/test_bigint.w fails on syntax drift — unsafe: statement prefix rejected at every call site ("requires a newline and indented block") and -> void ("unknown type 'void'"). The module's arithmetic values spot-check correct against python3 oracles, so this is a coverage gap, not a wrong-code report — but it means neither #1051 nor the fixed-buffer defect above has any executable backstop in-repo.
Notes
Pre-existing drift since 613be15, not caused by the crypto module. Fix is mechanical (current unsafe { } block syntax, removal of -> void), plus promotion of the #1051 vectors (610-bit modpow boundary, oracle-computed) into the suite.
Verdict. Established: the three crypto test files do not compile, so lib/std/crypto/bigint.w has no executable coverage. Both reported drift errors reproduce. Two corrections, both making the situation worse than reported: the "fix is mechanical" characterization is incomplete, and there are more blockers than the two named. After fixing unsafe: and -> void, the tests still fail because (a) their extern fn int_to_string/with_eprintln shadow prelude functions, and (b) every i31_* function is module-private, so a separate file that use std.crypto.bigint cannot call them at all. On top of that, the tests/ directory is wired into no test target, so even a compiling file would never run. This is a coverage gap, not a wrong-code report, as the report says.
Tested.
Source
main @ 5809ac1 (2026-09-14); the three files and bigint.w's private visibility are unchanged since the reported revision 450733e (all date to 613be15)
Compiler
with v0.15.2.1 built from 5809ac1 in a staging worktree
Platform
macOS Darwin 25.6.0 arm64
Reproductions (with check):
tests/test_bigint.w:55: error: unsafe: requires a newline and indented block; use unsafe { ... } or unsafe *ptr (16 unsafe: sites in this file; 5 each in test_rsa.w/test_crypto.w).
tests/test_crypto.w:12: error: unknown type 'void'; With uses Unit for no value and c_void for C void pointers (one -> void per file, on extern fn with_eprintln).
Both match the report. Then, mechanically rewriting test_bigint.w (unsafe: X → unsafe { X }, -> void → -> Unit) and re-checking surfaces the further blockers:
error: extern fn 'int_to_string' shadows prelude function 'int_to_string' (and with_eprintln is likewise now a prelude name) — additional drift the report does not mention.
After removing those externs: error: symbol 'i31_word_count' is private to module '<embedded-std>/std/crypto/bigint.w' (and the same for every other i31_* call).
Source facts.
All 13 i31_* functions in lib/std/crypto/bigint.w are declared unsafe fn ..., none pub. Per spec §18.3, cross-module access to a non-pub symbol is a compile error, so a file in tests/ that use std.crypto.bigint cannot reach them regardless of syntax. The test was written when it lived alongside the module or before visibility was enforced.
The repo's test suite globs live under test/ (singular): test/behavior/*.w, test/spec/*.w, etc. (build.w:2497 onward). No .Test target globs tests/ (plural), where these three files live. The only tests/ references in the build are unrelated glob-tests fixtures written into a temp dir by build/selfhost.w. So these files are not part of with build :test.
Root cause. Test rot since 613be15 (the BearSSL bigint/RSA port): the tests were never updated for the current unsafe { } block syntax, Unit return type, prelude int_to_string/eprintln, or the module-privacy of i31_*, and were placed in a directory the suite does not scan. No compiler defect. Direct source/check evidence; no debugger needed.
Why it matters. As the report notes, this is why the serious crypto defects #1051 (mlen>=20 wrongness) and #1052 (mlen>=80 overflow) have no in-repo executable backstop, and why both are green in CI. That is the real cost of the gap.
Related.#1051, #1052 (the defects this coverage would catch). No open PR.
Recommendation — champion, but the fix is larger than "mechanical." To get a working, running crypto test:
Give bigint.w a test-visible surface: either mark the needed i31_* entry points pub (they are already unsafe, so callers stay explicit), or add a thin pub test-only API, or co-locate the tests inside the module. Privacy is the load-bearing blocker; syntax is the easy part.
Modernize syntax: unsafe { ... } blocks, -> Unit, and drop the int_to_string/with_eprintln externs in favor of prelude .to_string() / eprintln.
Wire the files into the suite: move them under test/behavior/ (or add a tests/*.w target), so with build :test runs them.
Acceptance criteria: with build :test compiles and runs a crypto suite that includes an oracle-checked modpow above 576 bits; a red result appears if #1051 or #1052 regresses.
Not tested. I did not attempt to run the fully-repaired suite end to end (it needs the privacy change to compile at all); I established each blocker by incremental check. Linux/Windows not exercised.
Triage 2026-10-25, with v0.15.3.0 (main a261b65): reproduced; none of the three crypto test files compiles.
$ with test tests/test_bigint.w
error: unsafe: requires a newline and indented block; use unsafe { ... } or unsafe *ptr
--> tests/test_bigint.w:55:13
$ with test tests/test_rsa.w
error: unsafe: requires a newline and indented block; use unsafe { ... } or unsafe *ptr
--> tests/test_rsa.w:51:21
$ with test tests/test_crypto.w
error: unknown type 'void'; With uses Unit for no value and c_void for C void pointers
--> tests/test_crypto.w:12:36
post-release: test coverage, and the earlier review found the repair is more than mechanical.
Activity
ehartford commentedon Sep 16, 2026
Review: reproduced
Verdict. Established: the three crypto test files do not compile, so
lib/std/crypto/bigint.whas no executable coverage. Both reported drift errors reproduce. Two corrections, both making the situation worse than reported: the "fix is mechanical" characterization is incomplete, and there are more blockers than the two named. After fixingunsafe:and-> void, the tests still fail because (a) theirextern fn int_to_string/with_eprintlnshadow prelude functions, and (b) everyi31_*function is module-private, so a separate file thatuse std.crypto.bigintcannot call them at all. On top of that, thetests/directory is wired into no test target, so even a compiling file would never run. This is a coverage gap, not a wrong-code report, as the report says.Tested.
main@ 5809ac1 (2026-09-14); the three files andbigint.w's private visibility are unchanged since the reported revision 450733e (all date to 613be15)with v0.15.2.1built from 5809ac1 in a staging worktreeReproductions (
with check):tests/test_bigint.w:55:error: unsafe: requires a newline and indented block; use unsafe { ... } or unsafe *ptr(16unsafe:sites in this file; 5 each intest_rsa.w/test_crypto.w).tests/test_crypto.w:12:error: unknown type 'void'; With uses Unit for no value and c_void for C void pointers(one-> voidper file, onextern fn with_eprintln).Both match the report. Then, mechanically rewriting
test_bigint.w(unsafe: X→unsafe { X },-> void→-> Unit) and re-checking surfaces the further blockers:error: extern fn 'int_to_string' shadows prelude function 'int_to_string'(andwith_eprintlnis likewise now a prelude name) — additional drift the report does not mention.error: symbol 'i31_word_count' is private to module '<embedded-std>/std/crypto/bigint.w'(and the same for every otheri31_*call).Source facts.
i31_*functions inlib/std/crypto/bigint.ware declaredunsafe fn ..., nonepub. Per spec §18.3, cross-module access to a non-pubsymbol is a compile error, so a file intests/thatuse std.crypto.bigintcannot reach them regardless of syntax. The test was written when it lived alongside the module or before visibility was enforced.test/(singular):test/behavior/*.w,test/spec/*.w, etc. (build.w:2497onward). No.Testtarget globstests/(plural), where these three files live. The onlytests/references in the build are unrelatedglob-testsfixtures written into a temp dir bybuild/selfhost.w. So these files are not part ofwith build :test.Root cause. Test rot since 613be15 (the BearSSL bigint/RSA port): the tests were never updated for the current
unsafe { }block syntax,Unitreturn type, preludeint_to_string/eprintln, or the module-privacy ofi31_*, and were placed in a directory the suite does not scan. No compiler defect. Direct source/checkevidence; no debugger needed.Why it matters. As the report notes, this is why the serious crypto defects #1051 (mlen>=20 wrongness) and #1052 (mlen>=80 overflow) have no in-repo executable backstop, and why both are green in CI. That is the real cost of the gap.
Related. #1051, #1052 (the defects this coverage would catch). No open PR.
Recommendation — champion, but the fix is larger than "mechanical." To get a working, running crypto test:
bigint.wa test-visible surface: either mark the neededi31_*entry pointspub(they are alreadyunsafe, so callers stay explicit), or add a thinpubtest-only API, or co-locate the tests inside the module. Privacy is the load-bearing blocker; syntax is the easy part.unsafe { ... }blocks,-> Unit, and drop theint_to_string/with_eprintlnexterns in favor of prelude.to_string()/eprintln.test/behavior/(or add atests/*.wtarget), sowith build :testruns them.Acceptance criteria:
with build :testcompiles and runs a crypto suite that includes an oracle-checked modpow above 576 bits; a red result appears if #1051 or #1052 regresses.Not tested. I did not attempt to run the fully-repaired suite end to end (it needs the privacy change to compile at all); I established each blocker by incremental
check. Linux/Windows not exercised.ehartford commentedon Oct 25, 2026
Triage 2026-10-25,
with v0.15.3.0(main a261b65): reproduced; none of the three crypto test files compiles.post-release: test coverage, and the earlier review found the repair is more than mechanical.
Issues batch D: crypto known answers that run (#1053 #1055 #1063); de…