agent: builder model: opus max_turns: 60 budget_usd: 12 —

Brief: a sync function that may panic() runs at build time (#1108), and j5’s Vec/.remove(0) goes

Facts: Traps already met

Score: a defect j5 found in this lane’s own path (#1019 step 3b’), and the way around it j5 had to write into comptime_tree.nika (debt, CLAUDE.md Fix, do not work around); S=A, O=~0.2M tokens, C=~0.2M tokens; two tools/*.nika files, three tests.

Problem

A sync function that may panic() cannot run at build time: NK1152, “Nothing says what it touches outside the program”. Part II 10.2 (docs/specification/20-nikaia-advance.md around line 130) says a build-time run that stops, panic() included, is refused as NK1244 in the program’s words; the same function runs fine while the program runs. Because of it, j5 (974b9ac) made the build-time sub-program’s __nikaia_comptime_turn[T]() collect into a Vec and call .remove(0) instead of returning from the turn.

Probe (architect, target/fast/nikaia at 69ea78d; NK1152 at line 6 today, wanted 6):

fn pick(n: i64) -> i64 sync {
	if n > 10 { panic("too big") }
	return n * 2
}

comptime X: i64 = pick(3)

fn main() {
	print(f"{X}")
}

Decision (architect, 2026-10-31: a defect, Part II 10.2 already says it; no language change)

panic touches nothing outside the program, as it pauses nothing (Part I 7.2). One helper says so for both walks.

Cause (traced by the architect, sure): panic is in no ledger, so calls.nika callee_named returns Callee::Opaque("panic"). sync.nika pausing_call skips it through a_stop (line ~470); touch.nika reached_call (line ~246) sets reach.unknown = true for every Callee::Opaque, so the contract’s touches_known is false and build_eval.nika bt_may_not_run (~589) refuses.

Locations

To build

  1. The helper, used by sync.nika and touch.nika: a Callee::Opaque named panic reaches nothing. Tests in tests/compiler/tests/:
    • a_comptime_runs_a_function_that_may_panic.nika + .stdout: the probe (6);
    • a_comptime_that_panics_is_refused.nika + .stderr: the same function called as pick(30) is NK1244 with too big (take the text the compiler prints; it must name panic’s words and the line). Both fail on the unfixed binary (say so under Tests:).
  2. comptime_tree.nika: __nikaia_comptime_turn[T: Struct]() -> R sync returns the turn’s value with return inside the if at the field, and ends with panic("...") after the loop (a turn that names a field always finds it; the words are yours, e.g. "no field <name>"); comptime_turn_call calls it without .remove(0). Update the comments above both. The a_comptime_* and comptime_* tests keep passing (--both-settings). Commit both steps in one commit, Fixes: #1108, Part: #1019.

Done when

Both new tests pass and failed before; a_comptime_*, comptime_*, a_sync_function_* and every tests/compiler/tests program carrying NK1152 or NK2202 pass; lower-std fixpoint clean; clippy, fmt, pre-push-check.sh green.

Stop and report if

the turn function with return + panic is refused (a rustc unused_braces warning on the unrolled turn is #1110, not a refusal) by the checker or by rustc (say the message, Needs: architect decision, and keep step 1 alone in the commit); a Callee::Opaque walk other than the two named needs a different answer for panic.

Not yours

check_boxes.nika (#1109, bug lane), the body-comptime naming warning (#1110, bug lane), winnow-grammar (j8), the grammar files (grammar_*.nika, emit_grammar.nika).

Rules (CLAUDE.md; this block is pasted into every brief, also a fix-forward)

Report (at most 15 lines, to exactly /home/user/Nikaia/docs/briefs/tools/j9-1108-panic-at-build-time.md.report.md)

Fields of docs/architect.md, Briefs and reports: Result: done|noop|partial|blocked (the bare word alone on that line: Result: done, never a summary after it, which cuts the batch, b869a 2026-10-27; Owner: is a question for the owner or none, never a role), Files, Commit, Body (optional, one paragraph for the commit message), Fixes, Pushed, Tests, Gate (green|red), Deviation, Found, Needs, Changelog, Owner, Disk freed, and for a move Rs2nika: (the kept N of M lines of rs2nika --score, then the three costliest hand edits; none for a task that moves no Rust, none (redesign) for a brief with Shape: redesign and no Convert: line). none where nothing, and then the bare word: Deviation: none (a note) cuts the batch (batch.nika compares exactly); a note goes into the commit message. Found: is only for a defect outside your change (it cuts the batch); a process event such as another session resetting or rewriting your files is no Found:, it goes under Needs: (m3a 2026-10-28); a converter draft that came out wrong is no Found:, it is one of the costliest edits under Rs2nika:, which the converter lane reads (e12-4b 2026-10-27); how you solved your own step goes into the commit message. Deviation: is only a step of the brief built otherwise than written or not built (a choice the brief left to you, such as keep what X needs and say so, is no deviation: it goes into the commit message; nor is building two steps in one commit when every step is built, e12-3a 2026-10-27, nor a step another commit on develop already built, shown by your test failing with that commit’s change reverted, b889 2026-10-27: name the commit in Body:, nor a test’s expected .stdout/.stderr taken from what the program really prints where the brief’s sketch of it was short or wrong, b934 2026-10-29: say so in Body:, nor a lowering that follows the ADR governing it where the brief’s expected lowering contradicts that ADR, b933 2026-10-29: name the ADR in Body:, nor a lowering other than the brief’s where rustc cannot take the brief’s, b1029 2026-10-31: say why in Body:, nor re-keying an allow-list entry (KNOWN) whose hash changed for the same program and the same reason, b-fixforward-sweep2 2026-10-28: say so in Body:, nor an existing test’s expected .stdout/.stderr updated because your change rightly changes the message it prints, b1012b 2026-10-31: name the test in Body:); how you verified (e.g. a test not run against the unfixed compiler) goes under Tests:. A noop says why under Tests: (what was probed), not under Deviation:. Final answer, one line: done <sha>, report <path> (or BLOCKED: ... / PUSH REJECTED ...).

Attribution: Co-Authored-By: Claude Opus 5.5 noreply@anthropic.com Claude-Session: https://claude.ai/code/session_01UVxJDvLe1uS47UcqA9y1U2

This site is open source. Improve this page.