Issue #2817: benches/brc/fast.nika no longer builds at HEAD 78b2a90c (0.0.1556,…

Open and answer this issue on GitHub.

blocked, bugs · opened 2026-11-23 · updated 2026-12-01 · 4 comments

Filed by the driver from the Found: of the run of issue-2811 (#2811) (owner, 2026-11-06).

Found

benches/brc/fast.nika no longer builds at HEAD 78b2a90c (0.0.1556, target/perf/nikaia, a project of [package] name = "perf" with [build] user-parallelism = "no", optimization either “” or “remove-bounds-checks:on,remove-overflow-checks:on,skip-free-at-exit:on”, [build.x86_64-linux] opt-level = 3 codegen-units = 1, src/main.nika = benches/brc/fast.nika, nikaia build): error[NK1300]: assert(pos >= 0 && len >= 0 && pos + len <= buf.len()), the precondition of Table::slot_of, is not proved: 2 calls do not prove it (main.nika:82, calls on lines 143 and 184) and error[NK1300]: assert(stop > 0 && stop <= buf.len() - MARGIN ...), the precondition of Table::run, is not proved: 2 calls do not prove it (main.nika:115, calls on 174 and 178). It should build, as brc.sh builds it and benches/brc/README.md quotes its counts. examples/1brc.nika and benches/brc/naive.nika build with the same manifest. check --asserts says derived slot_of: 0 <= pos, pos <= buf.len(), proved at the calls on lines 143, 184, but not the len part. Cause unknown; the regression’s commit is not bisected (last edit of fast.nika: 2ed52c4b0, 2026-11-14).

To build

Done when

The probe or check gives the expected output the first item names from its ADR or Part I-III section, and a tests/compiler/tests/ test (or the named check) that failed on the unfixed tree is green; or the probe already passes on develop and a test pins it, naming the commit that fixed it; or the issue is closed as by design, naming the function or ADR.


Generated by Claude Code

Comments

keywan-ghadami, 2026-12-01

Brief queued: issue-2817


agent: builder model: opus max_turns: 200 budget_usd: 30 effort: medium —

Issue #2817

Your work order is issue #2817, inlined below with its comments. There is no brief written around it: plan your own steps from its To build list, build them in order, commit after each finished step, and end when its Done when holds (or at the limits of builder.md, reporting what is left). The facts in your prompt are Core of docs/builder-facts.md; more on a topic: nikaia run scripts/syntax.nika -- KEYWORD, a probe: nikaia run scripts/probe.nika -- SNIPPET.

Measure the issue against docs/issues.md while you work: what it lacked, what was wrong in it. That answer goes into the report’s Issue: field. A finding, a changed plan or a finished item also goes into the issue as a comment (gh api repos/Nikaia-Foundation/Nikaia/issues/2817/comments -F body=@file, ending with the Claude Code footer), rule I13.

Rules (CLAUDE.md; shared checkout)

Report (at most 15 lines, to exactly /home/user/Nikaia/docs/briefs/bugs/issue-2817.md.report.md)

Fields: Result, Files, Commit, Body (optional), Fixes, Pushed, Tests, Gate, Deviation, Found, Needs, Changelog, Issue, Owner (a question for the owner), Comment (#N <text>, what to say on another issue; the driver posts it, one line each), Friction, Disk freed, and last Attribution: with your commit trailer lines below it.


Generated by Claude Code

keywan-ghadami, 2026-12-01

Run: issue-2817, Result: partial

Tokens: input 246, cache read 7149839, cache write 190003, output 45898 Cost: 4.20 USD, time 5 min 2 s, turns 123

Report

Result: partial Files: crates/nikaia-std/src/compiler/prover_loops.nika crates/nikaia-std/src/compiler/prover_walk.nika crates/nikaia-std/src/compiler/lowered.rs crates/nikaia-std/src/compiler/lowered/prover_loops.rs crates/nikaia-std/src/compiler/lowered/prover_walk.rs crates/nikaia-std/src/compiler/lowered/logic/lowered.rs crates/nikaia-std/src/compiler/lowered/logic/lowered/sv_sat.rs tests/compiler/tests/a_counter_bounded_by_one_conjunct_of_the_guard_is_proved.nika tests/compiler/tests/a_counter_bounded_by_one_conjunct_of_the_guard_is_proved.stdout tests/compiler/tests/a_mask_first_taken_by_a_fallback_is_below_64.nika tests/compiler/tests/a_mask_first_taken_by_a_fallback_is_below_64.stdout benches/brc/fast.nika Commit: prover: a loop’s counter is bounded by one conjunct of its guard; Mask::first’s ensures hold under ?? Body: prover_loops loop_record: a condition claim_term cannot read whole still gives its readable && parts (claim_parts) to the turn, its exit stays empty (new way_out param of loop_record_of, so the exit is never weakened); loop_candidates tries each conjunct of the guard for the counter-against-bound and interval rules (while cut > 0 && b[cut - 1] != 10 { cut -= 1 } now proves cut >= 0). prover_walk prover_found_facts: a std ensures without result == null || is said of the number the option holds (ADR-377 D7), so m.first() ?? -1 then if hit >= 0 proves hit < 64. Lowered: logic sv_sat.rs gains a proven write (falsified[at]). fast.nika’s merge passes s.name.len() so slot_of’s precondition holds. Both new tests failed with NK1300 on the unfixed binary. No bisect: history starts 2026-11-15. Part: #2817 Tests: both new tests/compiler tests green –both-settings (each NK1300 on the unfixed binary); clippy –all-targets clean; lower-std fixpoint clean; fast.nika still 3 unproved calls (lines 143, 174, 178) Gate: green Deviation: none Found: a loop inside an if branch loses its facts after the join: fn scan(b: ref Bytes) -> i64 { let n = b.len(); let mut cut = 0; if n > 5 { while cut < 3 { cut += 1 } }; assert(cut <= 3); return cut } with nikaia check --asserts gives “refused, not proved: nothing before it shows it”, should be proved as without the if (“proved through the loop that changes cut, with the invariant cut >= 0 && cut < 4”); suspected prover_scope.nika forget (line 253) drops the branch’s LoopRecord when the join forgets cut, and prover_join_arms carries no loop fact past the join (check: trace scope.loops at prover_join_arms); this blocks benches/brc/fast.nika scan (run calls at lines 174, 178) Found: benches/brc/fast.nika line 143 self.slot_of(w0, w1, len, buf, pos) in run is not proved (NK1300 precondition pos + len <= buf.len()): needs the outer while true invariant pos < stop with stop <= buf.len() - MARGIN and len <= 100; cause unknown, not traced (probe: target/fast/nikaia check src/main.nika on a package holding benches/brc/fast.nika as main.nika) Needs: #2817 again after the Found on loop facts past an if join is built Changelog: Prover: a loop’s guard is read conjunct by conjunct — while cut > 0 && b[cut - 1] != 10 bounds cut though the byte test is unreadable — and Mask::first’s ensures hold of the number under ??. Issue: fits docs/issues.md; the Found’s single cause was really three (Mask::first under ??, a guard’s conjuncts, loop facts past an if join) Comment: #2817 two of three causes fixed (guard conjuncts, Mask::first under ??); left: loop facts inside an if branch are lost after the join (scan), and the outer-loop bound for slot_of in run Friction: none Disk freed: none, cache 2.0G, disk 12G free, no new entry over 100 MB Reviewed: cdc8aef41f45d5894d24559c69201cfdb89ba5097600280ebf76a1d9abdab2ff Pushed: local 0a3515230db066f0e3901ed49bd5faed19c84462 Attribution: Co-Authored-By: Claude Opus 5.5 noreply@anthropic.com Claude-Session: https://claude.ai/code/session_01UVxJDutPTwP5Xj5HkGuidk

Debrief

  1. Most turns: peeling back the causes one at a time. Each fix uncovered the next unproved call in fast.nika, and I found three causes in sequence: Mask::first under ??, a loop guard read part by part, and loop facts lost after an if. Reading prover_loops.nika and prover_walk.nika to learn how loop records and the turn and exit conditions work also took many turns.
  2. Looked up: how the prover finds loop invariants (ADR-361 D5, loop_record and loop_candidates), that a std ensures without result == null || is said of the number the option holds (ADR-377 D7), claim_term against claim_parts, and that nikaia run refuses a file in tests/compiler/tests, so nikaia test --filter is the way.
  3. Checks: reduced probes through v.sh with check --asserts; both new tests run with --both-settings; clippy; lower-std and its fixpoint; pre-push; the dry run of commit.nika. Wasted: one probe broken by \&\& escaping, one that put assert(...) inside assert(...), and a first try of each test without throws on main.
  4. Change that would have saved the most: when a run reports NK1300 against a bench, the issue should list every unproved site with its line (check prints them all at once), split into one reduced probe per site. I would have seen three separate causes at the start instead of one by one.
  5. What the issue lacked:
    • broke I5: the Found named only “no longer builds”, with no failing lines and no reduced probe per refused claim.
    • rules-gap: no rule asks for the last commit at which the bench still built. Bisecting was impossible because the history starts on 2026-11-15.
    • knowledge: Ledger and bounds proofs | a std ensures without result == null   ` is read of the option’s number only in the bounds walk, not in prover_found_facts, until 0a351523.`
  6. Traps the next builder will meet:
    • Fact: Ledger and bounds proofs | facts a loop inside an if branch proves are lost after the join (forget in prover_scope.nika drops the LoopRecord), so if c { while … }; assert(…) is refused.
    • Fact: Core | x ?? text.clone() on a view of a String draws NK1185; write ?? text.
    • Fact: Core | a tests/compiler program that prints needs fn main() throws (NK2605).
  7. For the next builder in this area:
    • Fact: Ledger and bounds proofs | loop invariants: prover_loops.nika loop_record, loop_record_of (turn condition against way_out exit), loop_candidates; probe with nikaia check –asserts FILE, which prints each assert's invariant.
    • Fact: Ledger and bounds proofs | benches/brc/fast.nika at 0a351523 (2026-12-01): 3 unproved calls, lines 143 (slot_of in run), 174 and 178 (run in scan).

Generated by Claude Code

keywan-ghadami, 2026-12-01

From the report of the run of issue-2817 (#2817):

two of three causes fixed (guard conjuncts, Mask::first under ??); left: loop facts inside an if branch are lost after the join (scan), and the outer-loop bound for slot_of in run


Generated by Claude Code

keywan-ghadami, 2026-12-01

Two of the three causes are fixed and on develop (26f7dc9c): a loop guard is now read conjunct by conjunct, and Mask::first’s ensures hold under ??.

Still open:

This issue is labelled blocked until #3021 is built.


Generated by Claude Code

Back to Open Issues