The traps already met and the rules for moving Rust into Nikaia; the short
Core every builder gets is in docs/builder-facts.md. Nobody reads this file
whole: nikaia run scripts/syntax.nika -- KEYWORD prints the lines of a topic
(with the spec section and an example test), and scripts/agent.nika puts the
sections a brief names (Facts: Probes, Grammar) into the prompt, or, without
that line, the sections whose Paths: line (the first under each ###
heading: path fragments and words, any case) has a fragment in the brief or its
issues, at most three (#2002). A new trap goes into the section of its topic,
in one line, with the run that paid for it; a new section gets a Paths: line.
A topic section (CI and caches, Ledger and bounds proofs) holds what a work
area’s next builder needs first: its files, its measure command and its latest
figures, each with date and commit or run. A builder adds to it through its
debrief (Fact: <topic> | ...); the supervisor, reviewing, replaces a figure a
newer one superseded and deletes what no longer holds.
Paths: parser, Expr::, AsyncGroup, syntax tree
Expr::AsyncGroup gains two Option fields with #986 (the async
lane): a new match on it in tools/*.nika is written with
.., so it does not break when the fields land.Paths: tests/compiler/tests/, .stdout, .stderr, --bless, nikaia test, cargo test, fails-before
nikaia test --project tests/compiler --filter NAME
(several --filters allowed, #1238). Without --filter it runs everything:
write the output to a file and grep it, never | tail (b933).--bless creates a missing .stdout, never a .stderr; --bless-stderr
does both. A program the compiler refuses is blessed into its .stderr
only (no .stdout) when that .stderr exists or --bless-stderr is given;
with neither, plain --bless fails it and writes nothing, so a test meant to
run that fails so is a refusal to fix, not a missing flag
(project_tests_bless_program, #1238, #1236; issue-1431). With --filter it blesses only that test. A new test is run
through nikaia test, not only nikaia run: print writes no newline and
the .stdout holds the bytes exactly (7c1643d)..stdout holds raw bytes: nikaia test reads a program’s
standard error lossily as UTF-8 (project_tests_relocated, #1182), so a
.stderr or .stops test cannot show non-UTF-8 bytes; test those on
standard output and keep standard error ASCII (issue-1859, #1860).tests/compiler runs target/fast/nikaia: never run the it binary
beside it, it relinks the binary (j2). Some tests spawn target/fast/nikaia
by relative path and fail from a copy (a_trait_column_*,
a_library_trait_with_no_impl_runs, bounds_expectation_guards_a_proof;
v16): run those with target/fast/nikaia. A failure from a vanished binary
is not yours: re-run that test singly. An untracked test of another agent
may fail: name it under Tests:.--both-settings runs past 10 minutes: background with the long timeout (y9).cargo test ... --test it -- a:: b::: the -- is needed. Read an it
run with grep -E '^test result:|FAILED|panicked', anchored (M3b).it binary, no filter: many tests hold
programs as Rust strings (9936c70).grep -rn '<old fragment>'
crates/nikaia/tests/it/ and run each test it names (b1029).self moves baselines outside
tests/compiler: the specification’s EXPECTED.txt (regenerate with cargo
run --profile fast -p nikaia --example specification >
tests/specification/EXPECTED.txt), COMPILES.txt, and the examples’
ledgers. Look at git status before the commit (v11).NAME.stops (#1260,
ADR-269 D22): the file holds what the stop writes on standard error, and the
test passes only when the run stops (exit 101) writing exactly that
(NAME.stdout compared too). --bless rewrites a .stops but never makes
one: create it empty, then --bless --filter NAME fills it.nikaia test
counts it as a failed build, so it cannot be a .stderr test yet.range_spelling,
shipped_ledger, the std ledger in contracts): a script’s a..b or a new
unsafe fn fails them.rustup
check shows a newer one and your change touches Rust, also run
CARGO_TARGET_DIR=/home/user/nikaia-clippy-new cargo +<version> clippy
--all-targets -- -D warnings (install with `rustup toolchain install
target/fast: a test that runs the toolchain takes the
nikaia that runs it (readlink /proc/$(cut -d' ' -f4 /proc/$PPID/stat)/exe).
A red test that passes locally: check what CI lacks first.crates/unsafe/* crate is its own workspace: it has no fast
profile (cargo test --profile fast there fails, profile fast is not
defined), and a plain cargo test inside it builds a cold target/ of
its own. Run its checks from the root against one shared target dir, kept
between runs under the git-ignored target/: cargo test --manifest-path
crates/unsafe/NAME/Cargo.toml --target-dir target/unsafe (clippy the
same); nothing to delete afterwards. (#1917)tests/compiler program that spawns nikaia finds it only under nikaia test: its toolchain() takes the parent of its parent, which is nikaia only there; under nikaia run it falls back to the relative target/fast/nikaia, and process::run(nikaia, ..; dir: tmp) resolves that in the program’s tmp dir, so a symlink in your working directory does not help (no such file or directory: target/fast/nikaia, #2060). Run it with nikaia test --project tests/compiler --filter NAME; a copy run by hand (a fails-before run, a scratch probe) gets the absolute path written into its toolchain() (and root()): /home/user/Nikaia/target/fast/nikaia, or $NIKAIA_OLD for fails-before. (issue-1333, issue-1414, issue-1665, issue-1705)cargo build, so a sub-build in the same target dir waits for ever on Cargo’s lock. Nothing says so: the nested cargo runs --quiet (comptime_bundle.nika, grammar_run.nika), so Cargo’s Blocking waiting for file lock never shows, and nikaia test ends a test program’s build only after NIKAIA_TEST_BUILD_TIME_LIMIT seconds (default ten times NIKAIA_TEST_TIME_LIMIT, so 3000 s; 0 is no limit; #1774, #1775): such a program then fails with build timed out after N s and a hint naming this ps check. A cold build or test silent for minutes is checked once with ps -ef --forest | grep -B2 -E 'cargo (rustc|build) .*--target-dir': such a cargo under a nikaia that an outer cargo build started, both on one target dir, is this wait; kill it, do not wait it out. (issue-1705, #1727)$PPID and /proc/self/exe are the test binary (.../target/nikaia/bin/program_test), not nikaia: a script that runs $(readlink /proc/$PPID/exe) run ... starts the test again, without end. Find nikaia as toolchain() in tests/compiler/tests/nikaia_test_time_limit.nika does (the parent of the parent, checked by its basename nikaia), or from NIKAIA where it is set. Such a fork storm filled pid_max and took the machine down (#1919); since then nikaia test caps a program’s run at NIKAIA_TEST_PROCESS_LIMIT tasks (4096; the program fails with ran into its cap of N processes and threads) and ends its whole group when the runner ends, killed included. (#1919)ref String draws NK1261 (ref is redundant); write String. (issue-1496)nikaia test runs fails tests at random: rerun the failed
ones alone before calling them failures. Under --both-settings it shows
as FAILED (the settings disagree) on tests that pass alone (the settings
ran different binaries), or as Error: running .../nikaia (deleted); a
test that spawns nikaia (every drive_*) runs its own ancestor, so run
a filter of many such tests with $NIKAIA_OLD. (issue-1414,
#1837)--lib filters in one cargo test call (emit:: sysroot::) printed nothing for me; run one filter per call. (issue-1279)cargo test -p nikaia-std --lib emit_core_args:: matches no test, because lowered modules have no unit tests; skip it for a tools/*.nika change. (issue-1290)crates/nikaia-std source, so a fix in a std runtime .rs file passes on the old binary too; for fails-before, copy HEAD’s version of that file back in for one run, then restore yours. (issue-1268)tests/compiler/src/X_beside.nika and the user in X_beside_caller.nika, and the program in tests/ calls it as compiler_tests::fn. (issue-1272).stdout, .stderr, .stops, .bounds and .loops.bounds expectations until .asserts (#1350); a new report expectation goes through project_tests_bounds_outcome and the host’s explained(args). (issue-1350)check --asserts header breaks it tests assert::asserts_reports_every_claim and assume::asserts_lists_every_assume, which match it exactly. (issue-1350)cargo test --test it can fail at link time with “undefined hidden symbol”; delete only target/fast/deps/it-* and target/fast/incremental/it-*, then rebuild. The same error linking nikaia itself: cargo clean --profile fast -p nikaia-std -p nikaia cured it (a 7.3 GiB rebuild); deleting only target/fast/incremental/nikaia-* and nikaia_std-* first is cheaper and untried. (issue-1366, #1671)cargo test -p nikaia --lib prove:: and --lib check:: run 0 tests; the prover is covered by the it tests prove::, assert::, assume:: and by tests/compiler programs. (issue-1358)tests/compiler/tests/ are already unformatted on HEAD; fmt --check on them proves nothing about your change. (issue-1361)test result: with the colon; ^test result also matches it tests named result_source::…. (issue-1310)nikaia fmt or fmt --check on a file outside a project formats with tabs, and the committed tests/compiler tests fail --check too; it proves nothing about a new test. (issue-1327)fs::read returns Bytes, so a catch { "" } on it is NK1103; in a test program, read text with process::run("cat", …).stdout. (issue-539).stdout: put the refused case in its own test with a .stderr. (issue-1375)print-throws rewrites test programs, the accepted_sweep.rs allow-list hashes change. The sweep’s failure log pairs each new refused hash with the old “no longer checked” one, so replace the old hash with the new one. (qa-task)nikaia test processes on tests/compiler at the same time can make migrate_views3_reads_package_tests_with_the_package fail with “cannot read TMP/json/tests”; it also fails alone on develop, so it is not your change. (issue-1334)target/release/nikaia is absent); a fails-before run for a fix already on develop needs a build of the fixing commit’s parent, so report it as not done. (issue-1356).stderr files and the lsp_diagnostics*.stdout files; grep tests/compiler for the old phrase before building. (issue-1403)nikaia test run with a scratch copy of the binary fails migrate_views3_reads_package_tests_with_the_package (No such file); rerun it with target/fast/nikaia before calling it a failure. (issue-1460)tests/compiler/tests/NAME.nika (with .stdout and an empty .bounds before --bless), not in tests/compiler/. (issue-1470)NAME.stderr beside NAME.stdout, since stdout alone passes on the unfixed compiler too. (issue-1420).stdout-only test passes even when the compiler prints a warning; add an empty .stderr beside it to pin “no warning”. (issue-1491)a_list_element_past_a_jump_is_refused_where_an_own_value_is_wanted is red on develop before #1501 (the by_val NK1102 is missing), so don’t chase it in a list filter run. (issue-1501)nikaia test needs a src/ with at least one .nika, or the test run fails with “cannot read …/src”. (issue-1236)gh run view <id> -R Nikaia-Foundation/Nikaia --log-failed reads a CI log read-only; a CI-only failure is traced from the whole failing shard, including its other failures. (issue-1584)git archive HEAD (drive_badges_head) see only committed files, so they fail on a tree whose fix is not yet committed; rerun them after the commit. (issue-1600)NIKAIA_TEST_BATCH=LIST nikaia build --project CARRIER (LIST holds NAME<TAB>ENTRY lines, each program with its own nikaia.toml); LIST.included names what lowered, and NIKAIA_LOWER_THREADS=1 makes it run in a fixed order. (issue-1639)nikaia test, a refusal in the tested package never reaches a batch: the batch’s own package depends on the tested package, refuses first, and every program is then built alone. (issue-1639)ProgramHost::ran in crates/nikaia/src/project.rs, not in project_tests.nika, and std::process::run cannot replace them because it returns text only (NotText on bytes). (issue-1672)NK1111 only where a brace group names something of the outer file (ADR-309 D15, by design, its accepted cost): "{ran.get()}" warns when the test file has a fn ran or a binding ran, while "{finished.get()}" beside it is silent. Write such a line as f"{{ran.get()}}": in an f"…" a doubled brace is one brace, so it prints {ran.get()} with no warning; no rename. (issue-2235)NIKAIA_TEST_TIME_LIMIT (default 300 s; a build’s limit, NIKAIA_TEST_BUILD_TIME_LIMIT, is ten times it unless set, 0 for none, #1775: a nested nikaia test with a tiny run limit sets the build’s to 0) on its nested nikaia test, which turns a fails-before run of a hang into a few seconds on the new binary; on the old binary, wrap it in timeout. (issue-1672)Paths: probe, reproduce, fails-before, develop
nikaia run scripts/probe.nika -- SNIPPET (--check,
--file F.nika) runs a snippet with target/fast/nikaia, no cargo, no
lower-std; its output is the probe a report or an issue quotes.nikaia run scratch.nika on a scratchpad
copy (b1006). nikaia lower F.nika writes F.rs itself; plain rustc
cannot link nikaia_std; nikaia run refuses a file inside tests/compiler.nikaia check
--tethers F.nika prints what each result views, and the nikaia.contracts
beside a lowered probe shows the ledger; they name the pass (buffers.nika,
tether.nika, views.nika).number_where_no_number_is.simd probe reads ADR-377 D3 first (nikaia run scripts/syntax.nika
-- simd): Lanes[T] offers only what keeps the output the same at every
width, so lane(i), a lane’s index, is on Fixed[T, N] only, and a probe
that calls it on Lanes stops at that name. (issue-1806, #1835)git log -S on that line: a later commit may have removed it on purpose. (issue-1125)develop because a later fix masks it; vary the shape (index, .iter(), a second call site of another kind) before judging the defect gone. (issue-1210)keep parameter keeps it” needs a callee that really keeps (stores or spawns); fn hold(keep w: W) -> i64 { w.k } only gets an NK1334 warning and proves nothing. (issue-1225)nikaia lower F.nika in the scratchpad writes F.rs beside it; read __nikaia_main there before guessing at an emitter cause. (issue-1289)Copy element type (give the struct a String field), or the emitter copies the element and the defect does not show. (issue-1228)loop or |x| closures and declares mutables with let mut; write probes with while true and fn(x) { … }. (issue-1261)String argument (h.f(g)) is a rustc error on develop; avoid it in probes until it is fixed. (issue-1264)all.push(x) into a list declared outside the loop), or the checker lends the parameter and no move happens. (issue-1366)a..b includes b; use 0..<n for n turns. (issue-1366)nikaia check accepts HashMap[String, i64]’s insert(5, 7) (std method arguments are not checked against bound types), so a probe that passes check can still fail in rustc; always run it. (issue-1345)String in a probe is let mut g = String() plus g.push_str("…") or a fn returning String; .to_string()/.clone() on a literal is NK1301 and String::new() is NK1149. (issue-1356)String made by a call (fn make() with push_str), because a literal-filled String is tiered to &str and hides NK1343. (issue-1404)keeps.nika trait_keeps (pending #1012 step 3), so NK2105 there is not your defect. (issue-1448)git log -400 --oneline | grep on the topic, pin the probe in a test program, and report fails-before as not done. (issue-1458)null => x = y fails to parse); write null => { x = y }. (issue-1478)collections::BTreeMap has no extend (NK1171), and from a function reached by a sync caller the refusal first shows as NK2202 “can pause”; mark the callee sync to see the real error. (issue-1478)split()/map() is a list of views of the argument, so a probe of “owned items” must build them with a + "…" or push_str. (issue-1481)Paths: check_, checker, text_tiers, tiers.nika, view_changes, keeps.nika, ref String, views-3, emit_, emitter
keep anywhere in a file turns NK2302 on for the whole file
(v9-v11): a probe for a views change carries one keep function.return x and as let r = x; return r, with the field really
a view (built from a trim() in a function, not a literal in main) (y21).Self in a trait’s signature is Ty::Named { name: "Self" }, not a
Ty::Var; substitute (ty.nika) does not replace it. A call through a
bound is typed in check_core_call_on.nika via bound_that_answers
(check_decls.nika); Eq, Ord, Clone are STANDARD_BOUNDS (v15).match on a kind are Part II 10.3’s (I64, F64, Text,
Bool, Maybe(A), List(A), Map(K, V), Struct(S)); the catch-all is
else (j2).for x in v.drain(); for x in v
over an owned Vec only borrows them.Ty the checker assigns before writing a predicate on it
(v18b): the text view is Ty::Named { name: "str", view: true }, not a
String view; own copying enums are lent as &T.Array[T] parameter is decided in five places (v21): lending in
lends_with (lends.nika), the length generic in emit_function.nika, the
& at a call in check_arguments.nika (the lent rule), &mut in
lent_to_a_mut_parameter (check_references.nika), a part’s length to the
prover in length_given (prover_state.nika).check_arguments.nika; several early continues
there (about line 353, a view handed to a lent String) skip
the_compiler_writes_the_reference (v18b).crates/nikaia/src and tests/it: grep for them before the bootstrap
(v18b).let c: ref Array[T] = v (or = x.field) of a Vec local moves it (NK2105 on the next use); only an index or piece (v[1..], v[0]) lends. (issue-1270)=x (owned text, no refusal, ADR-282 D12) in a free function, but !x (NK2302) in an impl of a trait whose result writes from, because the contract follows the trait. (issue-1280)impl case the checker also gives NK1104 with the help “write ref”; following it leaves only NK2302, and it test views_handed_back::following_nk1104s_help_is_a_program checks that help word for word. (issue-1280)unviewed_type of the text view must give owned String, not str, or .cloned().collect() comes out as Vec[str]. (issue-1388)! (NK2302) only when its type is not textless (rsrc_textless); a struct of only numbers gets no NK2302, so a checker refusal of it must stay. (issue-1386)return and for a function’s last value both go through expect_kept_asked (check_arm_leaves.nika) with what == "returns", so one guard there covers both. (issue-1386)ref” (way_out_of_a_mismatch, check_types.nika), and return ref s of a local in a trait impl with a from result is an NK1343 internal error. (issue-1386)for-binding roots and on mut-parameter roots; from gives NK1104 on all three, so a help must not offer it. (issue-1403)from self is still NK1131, and -> ref U? on a method is NK1343. (issue-1403)value_leaves (or the block_tail leaves of a choice: a function’s or a lambda’s last value) after the arms are checked must not re-type a leaf with check_core_expr unless its root is a parameter (a_place_of_a_lent_parameter), or names a match pattern bound give NK1117 in ast.nika during lower-std (comptime_tree.nika, emit_reach.nika). (issue-1425, #1911)pub fn with a mixed String result keeps it owned (ADR-282 D22), so a borrowed-field arm needs the per-arm NK1131; probe both the tail form and the return if form. (issue-1425)CheckFacts.method_callees holds the ledger key of every described method call, std’s too (Bytes::text, str::trim, net::Connection::read(within)), filled in check_core_call_on_described, not only the user’s own methods its comment’s Holder::put suggests; !method_callees.contains_key(on_node) therefore excludes std calls as well. Tell a user method from a std one by the key’s type part (starts_with("str::"), == "Bytes::text", as emit_core_calls.nika does) or by std_receivers. (issue-1870, #1900)tools/buffers.nika, is_a_buffer in tether.nika) treats only text and bytes as buffers, so a view of a list or struct local handed back is NK2304 (ADR-tether-v1 D9), never NK2303, which is not a refusal. (issue-1155)let over a field of a ref parameter (let k = index.keys) is NK2106 by design; read the field in place at each use. (issue-1279)text_tiers.nika, ADR-282), not the keep code: lower the probe and check whether a Vec[String] became Vec<&str>. (issue-1287).to_string() of text is emitted as the bare receiver (text_as_is, ADR-282 D8); copying text out of a view is .clone(), and a kept view of a temporary is NK1102 by design. (issue-1287)T::X (variant, method value, T::fields, integer limits) is in check_core_expr_path in tools/check_core_expr.nika. (issue-1294)int, i32, i64, u8, u32 and u64 (Part I 2.2); integer_named in check_names.nika tests for the fixed widths, and int is rewritten to i64 only in emitted types (emit_core_types.nika), not in paths. (issue-1294)from fix for text must also be probed with a struct type: the trait lowers only text from as a view, so a fix in keeps.nika breaks the struct case. (issue-1250)+ is a Binary node that the emitter recognises by facts.concatenations.contains(span.start as i64), using the operator span, not node_key. (issue-1251)let bound by x ?? null used to lose x’s ref (it was typed as the null); if a & appears in front of a match in the lowered code, check the checker’s result type of the ?? first (check_core_ops.nika). (issue-1340)String result is a refusal with a .clone() hint by ADR-282 D8 and ADR-views-v4 D12/D14, whatever an issue’s expected output says. (issue-1263)Ty is Named { name: "str", view: true } (printed as ref String), and is_a_view_of_a_string misses it; match TEXT_VIEW too. (issue-1264)String is wanted must exempt static text: ask text_literal(world, a_string_type(), value, true), or "x" is refused too. (issue-1264)let x: Array[T] (no length) is made a view by lv_let_views in text_tiers.nika, like fields (sf_slice_fields) and results (hb_fn); extend those passes rather than the checker. (issue-1270)BesideFields in crates/nikaia/src/text_tiers.rs (built in beside_fields, read by refine_with); add a field there rather than a new parameter at each caller. (issue-1272)cargo test -p nikaia --lib text_tiers:: runs 0 tests; the tier pass is covered by tests/compiler programs and by the it tests text_tiers:: (crates/nikaia/tests/it/text_tiers.rs). A checker change to lending or moving (hands_over, parts_lent, lent_args) is a touched test of cargo test --profile fast -p nikaia --test it -- text_tiers:: too: #1740’s first fix broke m[line] of a view there, and no program caught it. (issue-1272, #1753)hands_over_path_of and CheckRepeats (check_takes.nika, check_state.nika); revived there also drives narrowing (ADR-382), so a new exemption needs its own set. (issue-1366)let mut y = p before the loop, then use(x); x = y; y = [2] in the body brings a parameter to x only on the second turn without a clone (rust_owner_rebound_to_a_copy_is_followed). (issue-1713)unmarked_hole (tools/check_host.nika), and the brace scanning helpers are in tools/check_words.nika. (issue-1361)let of a choice mixing owned text and a view is typed ref String by the checker but emitted as EitherText; a missing & at a call is a lent_args question in check_arguments.nika, not an emitter one. (issue-1310).to_string() of a text slice is a view in the checker as well (NK1105 when assigned to a String local), not only in the emitter. (issue-1310)Named{"str", view:true} and Named{"String", view:true} (the latter from ref $T with T=String, e.g. .iter() and or_insert), and both print as ref String. (issue-1316)ty.nika substituted: the String-slot form means &String/&mut String to the emitter, and writes through or_insert break; normalise in the one check that needs it. (issue-1316)ref String, but the let declares ref String” is the two view forms meeting, not a tier question. (issue-1316)from fix in a trait must change both sides together: the impl’s types in hb_trait_from (text_tiers.nika) and the trait’s in emit_item_lent_view (emit_item.nika); one alone gives rustc a trait/impl mismatch. (issue-1327)Found: of the #1254 runs means tests/accepted/NNN_*.nika migrated by dropping ref from its parameters; reproduce on that file, not only on the reduced probe. (issue-1334)container_of in tiers.nika returns null for ref types, so the tiers pass does not follow a ref Vec[...] parameter, and its Strings stay String below (lent_whole). (issue-1449)b[a..<c] on a Bytes as an owned Bytes (ADR-320 D7), but the emitter writes a &[u8]; the fact bytes_cuts marks such a cut. (issue-1345)check_crossings_arguments gets the unbound contract, so want there is the type variable K; the substituted types are expected/bound in check_core_call_on, and entry’s key is ? (use bound["K"]). (issue-1345)vc_view_of (view_changes.nika) to see the let as a view, or a later write to the source passes the checker and becomes a rustc NK1343 internal error. (issue-1362)let bound to a cut (v[0..]) or a std method result (s.trim()) is a view only if vc_view_of in view_changes.nika sees it; otherwise a later change becomes a rustc NK1343 instead of NK2305. (issue-1363)borrows entries for std methods (String::trim is missing from described.contracts), so the view-change walk cannot tell that a method result points into its receiver. (issue-1363)a_word_by_its_kind (numbers, bool, char, scalar, payloadless enums, ledger copies); a_copy_by_value covers only the first four, and a copy-out keyed on it misses Symbol and enums. (issue-1460)let x: V? = m.get(k) or m[k] is typed ref V? by #297’s of_a_map block in check_core_stmt.nika; a value-typed read must be exempted there. (issue-1460)check_facts.nika) are pure Nikaia with no Rust mirror: a new field needs only its declaration and its initializer there. (issue-1411)declared_function (declared.nika) from ledger_items.nika; a generic impl is written impl Box[T], never impl[T] Box[T]. (issue-1448)T result still keeps its argument (fn second<T>(x: &T, y: T) -> T). (issue-1448)VcAsk field also needs the Rust adapters view_changes.rs analyse, check/host.rs view_change_findings and contracts/keep.rs buffer_plans, plus emit_contracts.nika and the check_walked.nika trait. (issue-1478)views_what_it_is_called_on (tiers.nika) is the existing list of text methods whose result is a view of their receiver; reuse it, don’t write a new list. (issue-1478)-> ref(a) String or a: borrowed in the ledger for a String parameter comes from the text-tier pass (lendable_parameter, a_keeping_target in text_tiers.nika), which runs before the keep inference and the checker. (issue-1491)keep marks the old binary already warned NK1334 on; when your fix makes keep mean kept, drop such marks where the file means lent. (issue-1491)put_viewed) only when a view of it leaves the function, e.g. let v = parse(text); return v; a plain user program with a map lookup never gets a keep frame. (issue-1073)walk.kept_names maps each kept name to its let’s start, and emit_stmt_block_plain restores it at the end of each block; a new binder that shadows a name needs no special handling, because the checker’s declared/bound_at facts resolve each use. (issue-1073)CheckFacts.declared and bound_at (#1396) are filled on every build, so the emitter can resolve a variable use to its binding’s span through them. (issue-1073)Paths: lowered/, lowered.rs, lower-std, sysroot, lower_mine
cargo check --profile fast -p nikaia-std
--features compiler --message-format short right after the first
lower-std; without the feature the check is a false green (k3a2).*.nika or described.contracts change, run lower-std with
a binary built from that tree and commit the diff; it reads and writes the
checkout the binary was built in (set NIKAIA_SYSROOT=/home/user/Nikaia/crates
for a binary built in a private copy). It lists every refusal of a file: fix
them all before the next cycle. A new .nika needs one lower-std run
before cargo build, and a row in scripts/self_hosting.py.lower-std
(v28): text, struct, tuple and generic T are spelled apart in emit_core_types.nika;
one probe each on the draft binary saves a ten-minute bootstrap cycle. The before-binary
is a fresh build of HEAD: after a cut run, target/fast may hold the last draft.keeps.nika (lends_with in lends.nika) drives both the view migration and
what the tool files lend (v24): a change to the keep rule rewrites how 20 or
more tool files lower. Probe first that they still compile under the new rule.$NIKAIA_OLD). After
editing the rule: build, then lower-std with the new binary and cargo check
(above). If the lowered files do not compile, restore them by name, fix the
rule or the tools .nika, and never run lower-std again from a binary that
was built from lowered files that do not compile: start over from the old
binary.nikaia lower f.nika or nikaia
run f.nika. One that shows only in tools/ needs a throwaway function in a
tools file and lower-std; restore both after..map(fn(x) { x.clone() }) trips map_clone) goes
into the allow list of the tools module in crates/nikaia-std/src/lib.rs,
never into the lowered file (P5d).code_on_a_cycle is not
package-wide yet (#1129).sync (#1014): declare a function
sync when a body change could make it async. Remove when #1014 closes.NK1127 and no reason: the sub-program is
<project>/target/nikaia/build-time/comptime/<hash>/main.rs. A new
comptime value shape must survive as a literal (comptime_literal_of) (j5).std.contracts method Rust has under the same name needs only the
contract; the file is built into the binary, so rebuild after editing it.Item::Fn name is Symbol?, so ask.names.resolve(name) is refused (NK1102); use the plan’s key instead. (issue-1155)&mut is hoisted into a let (emit_call_hoisted); only place reads and lambdas reach rustc, so a check on arguments must leave out what the lowering hoists. (issue-1209)check_visit_stmt returns every subexpression (so search inside search.proof), and check_visit_children does not descend into lambda bodies; a place-path check needs its own top-level walk plus check_visit_expr_blocks. (issue-1209)String: Plus<EitherText> from rustc means a tiers defect made a String parameter mixed; the checker never allows that itself, so fix the tiers, not concat.rs. (issue-1210)KeepAt::Param needs an Escape::Returned entry in plan.escapes, or the ledger never marks the function as taking a keep and __keep is missing. (issue-1218)migrate views-3 works on tokens and runs migrate_views3_code twice (once to drop ref, once to write keep), so a rewrite keyed on ref must still hold on the already-rewritten text. (issue-1224)keeps.nika, a value handed back goes through hand_over/reached_of, so anything added there also keeps on return, which D8 forbids; put store-only escapes on Stmt::Assign instead. (issue-1225)infer_package_parallel), never in project builds. (issue-1277)lower_compiler_files_cached re-parses files with test blocks (with_tests_as_functions), so package-wide values computed from parsed do not cover those files’ test functions. (issue-1279)__keep_N in the wrong scope comes from the keep plan in buffers.nika (decide_source, keyed by walk.statement), not from the emitter. (issue-1289)of_a_trait), so a view that one side of a trait/impl gets from emit_item_lent_view must be mirrored into the impl’s AST (hb_trait_from), not inferred. (issue-1250)ty.is_view on a String in an AST rewrite makes NK1261 warn about a ref the user never wrote, unless the position’s key (param K n / result K) goes into parsed.text_views. (issue-1250)String param that a mixed result hands back through let o = own(a) ?? return null lowers as EitherText by value, which gives a rustc move error, not an NK refusal. (issue-1254-r1)for over a Vec[String] place lowers to .iter(), so its element is &String below; only numbers, bool, char and &str are copied out with let x = *x. (issue-1268)let is put into the keep by emit_stmt_kept (plan.puts, emit_stmt.nika), decided in buffers.nika decide, and for non-text lists in plan_of via untethered_returns. (issue-1276)let now carries late_puts and is put by a shadowing let after its last change; the reassignment puts (#293 reputs) before that point are dropped. (issue-1276)std contracts write fn(T) for code whose result they leave open (Seq::filter), so a Ty::Fn with result == null means “hands back nothing” only for the program’s own types. (issue-1321)emit_core_flow plain, failing and kept paths, and the pausing path in emit_core_args), and an emitter fix must cover each one. (issue-1321)world.library is std only; to know a dependency’s errors, ask name_of_error (it checks own_contracts.types), not error_kind. (issue-539)EitherText parameter is lent or moved is decided by the late-read walk in text_tiers.nika (late_argument, late_args), not by the emitter. (issue-1334)Vec<&'static str>, so ref $T binds T to a view and a walk gives &&str; AsRef::<str>::as_ref treats &str, &&str and &String alike. (issue-1388)emit_lends_mut (facts mut_receivers/mut_args); use it rather than a new checker fact. (issue-1445)emit_core_index_read, and it hoists inside a *{ let ..; get(..) } block. (issue-1445)& (&&C does not satisfy C: Bound). (issue-1342)Ty::Named (listed in state.type_parameters), not Ty::Var; Ty::Var appears only in contracts and signatures from parameterise. (issue-1342)impl<'a> (EmitLifetimes::Inner), EmitLifetimes::Named means the impl’s 'a, so a store into self ties the source to it without declaring a new lifetime. (issue-1344)ref Array[T] is Ty::Pointed { slice: true, mutable: false } in the checker, not Named { view: true }, and a Vec fits it, so !found.fits(want) guards never fire for it. (issue-1362)name == "String" misses it. (issue-1368)check_core_returns decides lending before check_core_expr runs, so a fact recorded while checking the value must be read after found. (issue-1368)let over a local’s field is lent by the emitter (lent_lets); its binding type must be a view too, or a later keeper becomes NK1343. (issue-1404)'static widening, 'e, 'r) are chosen in emit_function.nika around borrows_from_something / widens; emit_core_types.nika only writes the EmitLifetimes it is handed. (issue-1420)buffer_plans) see only the items of one file, while the tier pass sees package facts only through BesideFields, so a shape that works within one file can be rustc NK1343 when the callee is in another file. (issue-1481)let to write its type on (map parts, list literals walked in place) has its type written as a suffix on every literal; skip number_lets for it, or the emitter has nowhere to put the type. (issue-1485)buffers.rs map key to EitherText). (issue-1490)from is set for a call result too; to test “this local views another”, add !local.made. (issue-1490)walk.adopted must insert into walk.reads.adopted without a condition, or the round that adopts never walks the unit again. (issue-1501)names_in counted a struct-literal field label as a read of a local of that name. This is fixed in ba1ec3be; a stray let v = v; in lowered output points at this kind of false read. (issue-1501)PROJECT/target/nikaia/cache/, and its key changes with every compiler rebuild, so a planted entry must go in after the last build. (issue-1582)lower-std lowers the other agents’ unfinished .nika too: one half-written can refuse your cycle (an NK code whose --> names a file git status shows modified and not yours), and their lowered/*.rs change under your cycles. Save the list once before the first cycle (git status --short crates/nikaia-std/src/compiler > $S/before.txt); a refusal or a lowered change in a file on it, or new since, is theirs: no defect, no Found:, no fix, never staged (commit.nika adds only your Files:). Judge your change by your own files and the new binary’s lower-std; name the refusal once under Tests:, not as friction. Such a refusal makes the tree’s lower-std write no file at all, yours neither: nikaia run scripts/lower_mine.nika -- YOUR_FILES... lowers HEAD plus only your files in target/lower-mine and names each lowered file your change moves (--write copies into the tree only the lowered files of the FILEs given, never lowered.rs, and names the others it moves not written, #1918; --exe $NIKAIA_OLD for the cycle’s first run) (#1875). Their .nika may also lower to Rust the build refuses (a rustc error in lowered/X.rs of a file on the list): for each build, put HEAD’s copy of only that lowered file back (git show HEAD:PATH > PATH, the one sanctioned exception to never restoring lowered/ by hand; their next lower-std writes it again), never stage it, and name it once under Tests:, not as friction or Found:. (issue-1759, #1762, #1794).nika change, the cycle’s first lower-std must run with the before binary ($NIKAIA_OLD); target/fast/nikaia still holds the logic of the previous attempt. (issue-1209)NIKAIA_LOWER_CACHE_SALT=<fresh> plus lower-std --sysroot <copy> gives an uncached reference run to diff -r against for byte-identity, without touching the shared cache. (issue-1277)git archive HEAD | tar -x -C $S/head copy, diffing the copy’s lowered/ against git show HEAD:...; a plain git diff of the shared lowered/ also shows the files other agents lowered mid-run (bounds_rules.rs, bounds_walk.rs in #1763’s run). A Found: from such a run names HEAD’s subject and sha and the binary’s, so the next run can bisect once the tree moves on. (issue-1763, #1793)nikaia check on a single crates/nikaia-std/src/compiler/*.nika fails with NK1135 for imported types (Span); only the lower-std cycle checks a tool file. Its first step needs no build: after each edit of a tools file run $NIKAIA_OLD lower-std alone (seconds to a minute, one file re-lowered), and fix what it refuses before the 5-minute build (let mut v = "" later given a String is NK1105 by ADR-282; start it as String()). (issue-1289, #1764)lower-std with $NIKAIA_OLD can fail on files nobody changed; the new binary’s lower-std is the one that counts, and that failure goes in the report. (issue-1228)lower-std fails on files nobody changed, put HEAD’s version of your own .rs files back, build, lower, then restore them and build again. (issue-1350)$OLD lower-std), or the change never reaches lowered/. (issue-1388)lower-std with the old binary resets lowered files a broken build left behind; after a failed build, restart the cycle from the old binary, not the new one. (issue-1344)lower-std --sysroot takes the crates directory of the copy (X/crates); given X it fails at once with “reading X/nikaia-std/src”. (issue-1473)lower-std runs into one grep without a marker; you cannot tell which binary raised the error, so echo a label between them. (issue-1425)crates/nikaia-std/src/compiler/ means editing SYSROOT_COMPILER in sysroot_cache.nika and in its lowered .rs by hand before the first build, because the old binary cannot lower from the new path. (issue-1600)__nikaia_tupleN names in lowered files are byte offsets, so any change to a .nika comment’s length renumbers them in the lowered output; that is not a behaviour change. (issue-1600)lowered.rs changes on every lower-std after a .nika edit (LOWERED_DIGEST): commit it with your lowered file, and check stability by comparing it before and after the second build. When the tree’s lowered.rs also holds another agent’s include! line, list it under Partial: with your hunks staged (the digest hunk at least): commit.nika refuses a staged include! of a lowered file the commit lacks and a lowered change without its lowered.rs, and writes the digest of the set as committed into the staged copy itself. (issue-1657, #1709)crates/nikaia/src/main.rs or sysroot.rs to a function a .nika change adds does not compile until lower-std has written it: write the .nika, run lower-std with the old binary, then add the Rust call and build. (issue-2082)lowered/<name>/ with its own index, so a list gathered across std (its tests, say) must also fold in each dependency’s list under its name. (issue-2082)lower-std writes the new form (a std test block that pauses, say) as Rust rustc refuses (E0728 in run_config.rs), so nikaia-std does not build and no new binary comes. Write the fix in the compiler first, cycle (old binary’s lower-std, build), and only then write the .nika that uses the form and run the new binary’s lower-std; a draft that already holds both sets that code aside for the first cycle and puts it back after. One cycle saved. (issue-2316, #2365)async part is started and joined in place by
emit_async_task(..., "join"); tasks that must run side by side are started
as let __task_N and joined through walk.async_joining
(emit_async_operands). emit_async_binding must not clear all of
walk.async_joining: that wipes an enclosing expression’s joins (cff73e5a2).? leaves
a group early (against ADR-async-v7 D21; #2981): suspected in the
Rest/ChildHandle drop in task/group.rs (2026-11-30).let mut in a .nika std test passes lower-std but fails clippy on the lowered file: run cargo check after lower-std, before the clippy round. (issue-2953)Paths: grammar, parser
grep -c
"$(grep -o 'rev = "[0-9a-f]*"' Cargo.toml | grep -o '[0-9a-f]\{7,\}' | head -1)"
target/fast/nikaia prints 1 or more; if 0, touch crates/nikaia/build.rs
and rebuild. Otherwise rustc says “multiple different versions of crate”.42; the generated Rust is
under ~/.cache/nikaia/run/main-*/target/nikaia/gen/ (ls -dt). A lowercase
rule skips whitespace before each element; rule WS = "" -> { } turns that off.
grammar G {
rule WS = "" -> { }
entry rule doc(n: i64) -> i64 = d:dec[i64](digit+) eof -> { d + n }
}
fn main() throws {
let input = Bytes("41".bytes().collect())
let r = G::doc(input, 1) catch {
println("error")
return
}
println(f"{r}")
}
nikaia check and nikaia lower FILE first (y9). A label’s type comes from
CheckState::pattern_type (check_grammar.nika); a rule’s tier also from
grammar_pattern_kinds (text_tiers.nika): a new pattern kind needs an arm
in both (y10). A guard: bind_grammar_pattern (#1032) and the
Pattern::Guard arm of emit_pattern.nika (#1033); probe it alone (y2c).peek, not, a cut, a guard and fail cannot be bound. A published
field may not hold both a view and owned text (ADR-282 D22). nikaia fmt can
break a rule line holding if(cond, "label") (#1015): check it still parses.ready; never written around): #1001 branches of
different types reach rustc; #1002 hex_digit undefined; #1004 a temporary
Bytes(..) as an entry argument. An option after ; needs a default; a
helper called from an action is sync. Remove a line when its issue closes.Paths: nikaia.toml, nikaia.lock, nikaia.proofs, ledgers, packages/, examples/, artifact, nikaia build
tests/compiler is the package
compiler_tests; its pub items in src/main.nika are reached with use
compiler_tests (#1037).nikaia.contracts and nikaia.derived when they
changed, never nikaia.lock or a nikaia.proofs you did not cause. Write a
new test’s .nika before the first nikaia test --project run (3-4
minutes) and --bless in that run, only once nikaia check is clean: a
package that fails to build blesses a .stderr for every test (y21, y27).
An NK1127 on a default after your change: nikaia run a scratch copy with
the defaults written out to see rustc’s error.nikaia run takes the run_fast path without Cargo: probe a build-time change with a cold nikaia build, not nikaia run. (issue-1705)cargo --target, proc-macro crates land in <dir>/debug/deps, not <dir>/<triple>/debug/deps. (issue-1705)nikaia.lock is a ledger, stable across builds (#1945): it
holds the toolchain, the units’ source hashes and the resolved dependencies,
not the compiler’s identity (ADR-021 D2, D3: that is in the cache key under
target/), so a rebuild of the compiler leaves it as it is. Every in-place
project’s lock and ledgers are tracked and checked (#2797: ledgers.nika
-- --list names them, tests/compiler among them); only
benches/yaml/*, examples/foreign-runtime/{crossing,smuggled} and the
toolchain’s own packages keep theirs ignored.
Commit the lock with a change to its package’s sources; one you did not
touch that changed in the tree comes from the driver’s drive_ledgers or
another run’s ledgers.nika --refresh, which commits it: leave it
unstaged. nikaia run scripts/ledgers.nika -- --check says whether your
change made a ledger or a lock stale (issue-1691, #1945). A stale one is often stale on
develop already: one run of ledgers.nika -- --check --tree HEAD --exe
$NIKAIA_OLD (HEAD’s ledgers, the before binary) settles it; stale there
too, it is not yours, say so under Tests: and do not refresh it (#1712).
ledgers.nika --check and --refresh build every ledger directory
(-- --list names them, 19 today) cold, in a fresh NIKAIA_CACHE_DIR:
many minutes, past the tool’s foreground limit. Run it with
run_in_background and its output in a file (> $S/ledgers.txt 2>&1),
never piped through head: its output is already short (a line per
directory, 40 per failure, ledgers_head), and a foreground run piped
through head was killed (exit 144) and ended the session (#1777).qualify (ty.nika) leaves unqualified, so a dependency’s H never matches the caller’s lib::H; check that before the lend logic. (issue-1417)mktemp two-package setup of tests/compiler/tests/dependency_struct_in_a_hole.nika and runs run in {tmp}/app. (issue-1417)fn by its bare name, private or not (mod x is a parse error). Mark a fn pub only where another package or the Rust host (crates/nikaia/src, crates/orchestrator) calls it: the bounds walk derives no precondition for a pub fn (ADR-prover-found-facts-v1 D14), so a needless pub leaves its sites checked; nikaia run scripts/pub-callers.nika lists the compiler’s pub fn nothing outside names. (issue-1481, #1831)nikaia cache prune counts only directories two levels down (<kind>/<key>) that hold a .nikaia-used stamp; a test that builds in an unstamped directory grows the cache unseen. (issue-1469)nikaia cache prune test sets the entry’s age with touch -d '3 days ago' <entry>/.nikaia-used and points NIKAIA_CACHE_DIR at a temp directory; on unix an entry used recently is still removed, unless a build holds its lock. (issue-1469)--locked run in place uses the package’s own target/nikaia/cache; to search every proof again, run a copy of the package without target/ and with fresh NIKAIA_CACHE_DIR and CARGO_TARGET_DIR. (issue-1513)--locked flake on an example is usually a stale nikaia.proofs hidden by a warm cache; check git log -- examples/X after the failing run before suspecting timing (the prover’s LgBudget counts steps, not time). (issue-1513)cp -al $(rustc --print sysroot) $T/.rustup/toolchains/NAME, run with RUSTUP_HOME=$T/.rustup RUSTUP_TOOLCHAIN=NAME, works on the same filesystem. (issue-1584)NIKAIA_CACHE_DIR is shared by every nested nikaia run, so a test that changes HOME or the toolchain leaks into the other tests through it. (issue-1584)crates to the repo’s crates; a copy gives cargo’s “package collision in the lockfile”. (issue-1591)fn main needs artifact = "rust-library" in its manifest; build and check --rustc refuse it otherwise (NK1351), and scripts/ledgers.nika builds every directory with build. (issue-1591, #1657)artifact = "rust-library" has its own path in project_drive_drive_to (crate_build): a subcommand added there needs both the program case and the library case probed. (issue-1657)Paths: scripts/, drive.nika, agent.nika, badges, pre-push
text::parse_i64(s); arguments for a in
cli::args() { args.push(a) }; a text is cut only at a position find
returned (NK1214), else strip_suffix(..) ?? "".scripts/X.nika runs the tests that name it: grep -l X
tests/compiler/tests (7970db8).use another script or find its own binary; a test
cannot set RUSTFLAGS or see git state: check by hand runs, say so under
Deviation.sync tools function cannot call fs::write (NK2202); write through the host, e.g. host.write_if_changed. (issue-1582)nikaia flag is declared in clap in crates/nikaia/src/main.rs (Rust): the command line cannot be Nikaia-only, so a flag needs that Rust plumbing even under no new Rust. A development aid read deep inside is kept in a static OnceLock set there, not passed through every caller. (issue-1495)pre-push prints badges stale (the driver's) when a .nika or a
Rust change moved the self-hosting share: it fails nothing, and the badge is
the driver’s (owner, 2026-11-15), so a builder neither regenerates nor
commits it; version leaves the badges out (bump.py check --no-badges,
#2414).--dry-run text fails when scripts/*.nika wording changes; bless it from the project dir (nikaia test --filter NAME --bless in tests/compiler) and review the diff. (qa-task)qa-input.txt files exist (docs/briefs/ and docs/briefs/views/); read the one in the lane directory your task names. (qa-task)scripts/where.nika -- NKnnnn can run past the 120 s tool timeout; grep the NKnnnn in crates/ and the spec row instead. (issue-1155){repo}/scripts/drive.nika -- --SUBCOMMAND with dir: set to a temp git repo, as in tests/compiler/tests/drive_relower.nika; a step with no subcommand gets one added. (issue-1348)badges.py’s self-hosted share reads crates/nikaia/src/**/*.rs plus the COMPILER_NIKA tools files, so a temp repo for it needs those paths from git archive HEAD, without lowered/. (issue-1348)assets/badges/self-hosted.svg stale at HEAD: a builder’s pre-push only shows badges stale (the driver's) (its version leaves the badges out, #2414); pre-push -- push turns badges and version red until the driver runs badges.py. (issue-1582)cargo on PATH whose built “compiler” bakes in the source it was built from; with a BUILD of true the old code finds no compiler and the test passes there for nothing. (issue-1665)Paths: sv_, logic_, prover, prove.rs, bounds_, --bounds, --asserts, solver
a = self.col[c][i], then self.atoms[a]) stays checked whatever length relation the lists have, until ADR-prover-found-facts-v1 D7 is built; a local list of lists is proved already (D7). Sort such a site under D28, not under #385 (that is values computed from the same table). (issue-1470)ref mut self method of the type keeps it (checked at each return; most_facts() is 48, rules_rounds() is 8). One method that loses it (as score did for sv_walk) drops it for the whole type. So a probe for a field rule is reduced from the real type: the target function plus every ref mut self method, with stub types. A synthetic probe can pass while the real code stays checked. (issue-1470)most_facts()) and drops the oldest without a word. Re-pushing many facts after each loop or branch evicts the length facts a proof needs; add rule facts only where a goal reads them (walk.rule_facts, added in bounding_known). shape.bound includes the parameters, so “bound by the body” must also exclude args. (issue-1470)node_key is a node id): a goal’s line is its statement’s first byte (walk.at, set in the statement loop), as in the --bounds report; --bounds-trace LINE shows the goals of statements starting on that line. (issue-1495)rules_give pushes about 3 facts per length rule, so a type with many equal-length fields fills the 48-fact cap and later goals fail without a word (ADR-prover-walk-v1 D7, #1500, moves the cap to the question). To see why a rule is dropped or a goal fails, put an env-gated eprintln! into the lowered .rs (walk.rule_failed.insert in bounds_rules.rs, the goal in bounds_walk.rs), rebuild without lower-std, then restore the file by name; it finds in one build what guessing took 15 turns for. (issue-1470)#turn variable, so “facts connected to the goal” through shared names takes in every list the loop grows; weight a name by how many facts name it. (issue-1500)rules_settle recomputes rules_holding (the fixpoint over every ref mut self method of the type) for every body it walks, so a change that adds field-rule candidates multiplies the cost of a type like sv_walk’s; only bounds_fields (a plain ask, no ledger) may cache it, since ask_in writes each proof into nikaia.proofs per function. (issue-1470)let end = a.min(n) (end <= n), so s.bytes[0..<end] stays checked whatever n is, until #1514. (issue-1496)lower-std --bounds writes nothing and reads no cache, so the old and new binaries can measure the same tree in parallel and be diffed site by site. (issue-1500)lower-std grows from minutes to tens of minutes. (issue-1500)bounds_*.nika, run nikaia check --bounds --bounds-trace LINE F.nika (lower-std --bounds --bounds-trace fixed.nika:95 for a toolchain file: the bare name, matched against the end of the path; one that matches no file prints nothing, #1780): for each goal of a statement starting on that line it prints the goal, every fact it was asked with (rule facts and ledger facts included), how many the 48-fact cap evicted, and the type’s field rules. (issue-1495)bounding_each_guarded turns it into len(xs) <= 0 || fact, and bounding_each_present gives len(xs) >= 1 where an element is actually read. A new kind of rule (as D28’s inner) states its element facts through these, or it proves anything under an empty list. (issue-1483)main writes is dropped from the rule candidates, so a rule test fills its lists only through ref mut self methods. (issue-1483)self parameter, so a method that takes only self gets none. (issue-1483)if ks.len() >= 1 { let y = ks[0] } proves from its own guard and shows nothing about a join or a rule; ask a goal over another list that only the tested fact reaches (if ks.len() == 2 { let y = r.ks[1] } for a kept ks.len() == r.ks.len()). (issue-1702, #1889)derived_claims (bounds_derived.nika) and only stated at the call by bounding_derived_side (bounds_walk.nika): a claim never proposed shows no row in --bounds, not even an unproved one. (issue-1571)let whose value the walk cannot write as a linear term or a bounded range is a number only through the checker’s whole_fields (calls, fields, and x ?? d); a value outside it drops every guard fact on the name. (issue-1571)nikaia check --bounds FILE checks a file alone; a tools file is
measured with lower-std --bounds --asserts > R and nikaia run scripts/proved.nika -- R,
before and after on the same tree. Where the walk stops:
docs/formal-verification.md §2.
The two can differ: check --bounds FILE proved a site D23 reaches that
lower-std --bounds did not (#1465); a figure is claimed only from
lower-std. (issue-1414)--asserts lists assert claims only (ADR-361 D7); an index or
counter the walk leaves checked, with the loop its reason names, shows in
--bounds. An issue that asks for it under --asserts means --bounds. (issue-1634)nikaia check --asserts (or --bounds) measures a whole package:
it reads every file of the package of the FILE it is given, and its report
covers each of them under a --- src/F.nika line (project_check_explain).
So “how many asserts does this change newly refuse in packages/P” is one
call per binary, check --asserts packages/P/src/main.nika > R, diffed
between the old and new binary; never a loop over the files, which checks
the whole package once per file (#2232: 35 files, about 20 minutes).--bounds reason’s wording is quoted verbatim by the .bounds files
(23 for the loop reasons): before changing one, grep -l 'PHRASE'
tests/compiler/tests/*.bounds and bless them all in one nikaia test run
(one --filter per test). (issue-1634)for binding is a number of the walk (CheckFacts.whole_loops):
check it before blaming the prover when a guard on for k in ks is lost.
(issue-1414).bounds keys sites by line: an edited comment keeps its line
count, or bless again. A precondition on a parameter’s length is carried to
the function’s start (ADR-269 D20); a call is carried back only from the top
of a body. After a precondition change run the grep -rln 'assert('
crates/nikaia/tests/it/ modules, not the whole it binary.i8; widening is i64::from. Valgrind needs x86-64-v3.benches row) is checked with nikaia
check --bounds FILE until every index proves, before it is counted: one
checked index in the inner loop costs more than the lanes save (#1806’s
first shapes counted 938 and 451 instructions a step against the plain
program’s 326), and a harness run takes about 4 minutes. What proves:
Array[T, N] fields, not Vec; indexes written as linear terms of for
bindings (4 * i + j - 1); a counter that grows in a loop proves only by
ADR-361 D13’s turn bound, so read its --bounds row before relying on it.
(issue-1806, #1835)nikaia test --bless writes NAME.bounds and NAME.loops.bounds only when they exist, a new test’s included: create an empty NAME.bounds first. (issue-1397, issue-1414).bounds test checks a private function’s body only through its callers: private functions get derived preconditions (ADR-prover-found-facts-v1 D11), so make the tested functions pub for the expectation to read the body. (issue-1414)bounding_length_named (typed i64, capped at 2^60 when its elements take space, ADR-prover-walk-v1 D13); a bare variable as a length proves nothing past + 1. (issue-1465)Expr::Call covers constructor paths (collections::BTreeMap()): a walk arm on
Call names its callee, or it poisons map roots; only the prove_ tests showed it. (issue-1453).len() already appears in a fact: a change
that forgets lengths restates one. Roots come only from read_let (bounds_shape.nika);
whole_loops is filled by the checker (check_core_stmt.nika), not by the walk. (issue-1453)check but not in lower-std: first suspect ADR-prover-found-facts-v1 D11 (a callee also called from another file of the package takes no bound from its callers). Rebuild it as a two-file package, the callee called from the second file, before suspecting the solver budget or the toolchain; a whole-package scratch run takes minutes, the two-file one under a second. (issue-1465)f.rank[f.find(c)] (a ref mut method call in an index of the same value) passes the checker and fails rustc (E0502): a defect, #1445; until it lands, a test probe binds the call to a let, and no code under tools/ relies on the form. (issue-1414)BodyShape.bound holds the parameters too: “the body never binds it again” is !twice.contains(name). BoundsChanged.lengths counts growth as well as shrinking; “never shrinks” reads falls. (issue-1397, issue-1414)emit/host.rs), so under ADR-prover-found-facts-v1 D3 its pub fields of pub types are never seen-only-by-Nikaia. Element-bound machinery: fields_seen, fields_declared, bounds_fields. (issue-1414)changes_length_in plus rebinds (bounds_body.nika, bounds_basic.nika); parameters are registered in prover_walk.nika’s function walk, near has_a_length. (issue-1375)project_drive.nika, host lower in crates/nikaia/src/project.rs) from Settings::from_env(): an emit setting changed only in lower_member never reaches gen/; a per-crate choice passes through the wrapper’s lower (as program does). (issue-1543)[lib] next to the program, so a once-per-binary item (#[global_allocator], a main hook) is emitted only for --crate-type bin. (issue-1543)resume_unwind (as OverBudget does) or expect only stdout. (issue-1543)std.contracts’ keeps column decides whether a std method takes its argument by value: without it a parameter handed there is lent as &T and rustc refuses (NK1343). (issue-1544)T handed to a std method whose Rust impl has a bound (Sender::send DeepSize, HashSet::insert Hash + Eq) fails rustc, because ledger signatures carry no bound (ADR-024 D9); decided in #1559 (implied DeepSize, [T: Eq] lowers to Eq + Hash). (issue-1544)use std::channel; rx.recv() ?? x inline gives NK1342: bind first, let v: T? = rx.recv(). (issue-1544)lower-std runs the bounds walk, so a slower walk slows every lower-std (one ran past 20 minutes and was killed): while you change the walk, lower with the binary before your change and measure with yours once. (issue-1470)bounds_*.nika, each lower-std re-proves std with the new walk: 10-13 minutes, not the 40 s of builder.md. Plan one such cycle per hour; iterate with check --bounds on a probe reduced from the real site, and find a slowdown with a few gdb stack samples (a minute), not callgrind (an hour). (issue-1470)match arm, an ?? fallback) in a scratch program and nikaia run it with the old binary; it reaches rustc in a second, where check and the cycle’s first lower-std pass it. match lit { true => 3, else => m.get(k) } over a BTreeMap[String, i64] checks clean and is rustc NK1343 (Option<&i64>, #2170): #2161’s run lost two 10-minute cycles to that and to m[k]. (#2171)bounds_*.nika makes your cycle re-prove std too (lower-std reads the working tree): run git status --short crates/nikaia-std/src/compiler/bounds_*.nika before the first cycle; with one modified there, plan 10 minutes per lower-std, run it in the background, and need fewer cycles; do not touch their file. (issue-1731, #1745)nikaia.proofs stale (the examples’, a package’s): build --locked then fails with “N questions were searched”, but only on a clean target, since a warm cache hides it. The driver refreshes them before each push and after merging origin/develop (drive_ledgers), and CI fails a stale one; by hand, nikaia run scripts/ledgers.nika -- --check finds them and -- --refresh rewrites them, so commit the added entries with the change. (qa, 3c055bf5; #1591)lower-std --bounds prints only verdicts; a site’s goal and facts come from lower-std --bounds --bounds-trace FILE.nika:LINE (the bare file name, fixed.nika:95: it matches the end of the path, so the old tools/fixed.nika:95 matches nothing since the move to compiler/, and a trace that matches no file prints nothing, no error), which is cheaper than re-running the whole walk to re-measure one site. Name the .nika line, never the lowered .rs one. (issue-1496, #1780)sv_*.nika goes into packages/logic/src/ (the package logic, ADR-270 D26, #2020); scripts/solver.nika keys and builds the rod from the whole package, so no file list names it. (issue-1339, issue-2020)test is a reserved word, and the error shows only once the concatenated solver program is built. (issue-1339)prover_*.nika) reads only the syntax tree; a checker fact reaches it only by adding a field to ProveComptimes, filled in comptimes_of (prove.rs, called from check/host.rs) and copied into ProverState by prove_state. (issue-1358)for’s binding, and the prover proposes only for a while; past a for, bound a counter by its turns (D13), not by an invariant over the counter. (issue-1383)Paths: Partial:, autostash, MERGE_HEAD, sweep, two commits
git merge --no-commit --autostash, by design, #1333): .git/MERGE_HEAD exists and git stash list shows the autostash. Never type the edit again (the autostash pop then conflicts); wait in one call for the merge to end (Monitor until .git/MERGE_HEAD is gone), check the edit is back, then run the cycle again (#1830). Meanwhile commit.nika refuses (a merge is in progress, #1901). An edit still missing after the merge ended is in an autostash git could not put back: git stash list, then git stash show -p stash@{N} (#1901). Where the merge also changed a lowered file of yours, the driver gives that file HEAD’s copy and prints MERGE autostash conflicted in ...: run lower-std again; a conflict in a source escalates, and the stash keeps your side (#1862).git status and your file, then rebuild; name others’ UU files under Needs: (BT, b1043).Partial:,
not Files:: stage only your hunks (git apply --cached), and
commit.nika commits what is staged of it without git add (#1704).
When their edit is in the same compiler .nika as yours, its lowered
.rs mixes both and cannot be split by hunks (the __nikaia_tupleN
names are byte offsets): lower HEAD plus your hunks once in a copy and
stage its blobs (scripts/lower_mine.nika does the copy and the
lowering for whole files, #1875). git archive HEAD | tar -x -C $S/head, git diff
F.nika > $S/p.diff, drop their hunks, git -C $S/head apply, then
NIKAIA_LOWER_CACHE_SALT=$RANDOM target/fast/nikaia lower-std --sysroot
$S/head/crates; for the .nika, its lowered/*.rs and lowered.rs:
git update-index --cacheinfo 100644,$(git hash-object -w
$S/head/PATH),PATH, list them under Partial: (issue-1839, #1858)..nika): make it your run’s last
step and commit it in one go (edit, lower-std, build, commit), never left
uncommitted across probes or test runs; every other run meanwhile has to
stage its own files hunk by hunk around it (#1808, #1850).commit.nika stages whole Files: (or list it under Partial: with only
the fix hunks staged): commit the fix (the .nika and its
lowered .rs) before starting the step in that file. Met late, put HEAD’s
version plus the fix hunks in place, commit, then restore the step
(issue-1470, issue-1691). Two fixes in different .nika lowered in one
cycle are two commits too: the first lists its .nika, its lowered
.rs and lowered.rs (commit.nika writes the digest of what is
staged, so the tree’s lowered.rs still differs for the second); a
lowered .rs both fixes move is staged for the first from lower_mine.nika
-- FIRST.nika (git update-index --cacheinfo of its blob in
target/lower-mine, under Partial:, as for a file another agent also
edits, above) (#1883).git merge --no-commit --autostash keeps the other agents’ changes stashed until the merge is committed, so regenerate inside the uncommitted merge, never after it. (issue-1333)git status --porcelain also lists the files the merge staged; use git diff --name-only (worktree against index) to see only what a regeneration changed. (issue-1333)Paths: callgrind, measure, instructions, cost, bench, valgrind
io-method = "blocking" (#1874’s io_uring_enter wait, docs/measuring.md): a game-bench binary counted by hand, outside benches/game/game.nika, runs as NIKAIA_RUNTIME_CONFIG=target/game-bench/io-blocking.toml valgrind --tool=callgrind BIN < target/game-bench/out/NAME.input (the file game.nika’s nikaia_env writes; elsewhere a file holding that one line), and with timeout -s KILL, since a plain timeout does not end the hang. (#2072, #2361)lower-std under callgrind takes hours; an A/B of it is user time with the bash time keyword, two interleaved rounds, twin binaries built from the same source. Uncached: set NIKAIA_LOWER_CACHE_SALT and pass --sysroot a copy laid out as X/crates with X/packages beside it. To profile one phase, run it with NIKAIA_LOWER_TIMES=1: each phase and ledger pass prints a lower-std~ NAME ended line the moment it ends, so callgrind_control -d then dumps the phase so far (--dump-after= misses them, the phase functions are inlined). A criterion in instructions over a whole lower-std (ADR-361 D15) is counted on its parts as docs/measuring.md says. (issue-1473, #1979, #1980)lower-std cache key includes the Build settings, so an A/B of two settings needs a warm-up run for each binary; the first run with a fresh salt is the cold figure. (issue-1473)NIKAIA_RUNTIME_CONFIG naming a file with io-method = "blocking" (docs/measuring.md): valgrind 3.22 runs the executor’s io_uring_enter wait without blocking, so a program reading standard input (a benches/game binary rerun outside game.nika) waits for ever, silently. game.nika writes that file as target/game-bench/io-blocking.toml: NIKAIA_RUNTIME_CONFIG=target/game-bench/io-blocking.toml valgrind --tool=callgrind ... BIN < target/game-bench/out/NAME.input. Bound every such run with timeout -s KILL (a plain timeout does not end it). (#1874, #2361)Paths: .github/workflows, suite.yml, nikaia.yml, shard, mtime, CI run, job duration
A topic section: the files, the measure and the latest figures of the work area, each figure with its date and commit or run; a newer figure replaces the older one.
.github/workflows/nikaia.yml (the entry, calls suite.yml once per architecture), .github/workflows/suite.yml (build once, test in shards, sweep; the shard list and its comments carry the measured figures). (#2082, #2403)cargo-incr-<Cargo.lock hash>-<sha>) and restored from the newest prefix; the sources unchanged since the cached commit are dated to 2000-01-01 first, or the checkout’s fresh mtimes rebuild every workspace crate. (#2403)mcp__github__actions_get / actions_list (a builder has no GitHub tool: the supervisor quotes it, or the report asks for it); per-test times come from the job log. (#2474)std once); arm64 with no cache 4:53; a warm cache before the mtime fix 3:08 with no crate changed (run 44711416045). (#2403)bytes::the_corpus_needs_no_tether 108 s -> 676 s, contracts::a_toolchain_module_is_not_part_of_std 33 s -> 266 s, fmt step 100 s -> 200 s; it-2 test step 240 s -> 635 s. (#2474)Paths: ledger, bounds_walk, bounds_proven, proven_taken, panics::infer, Ledger::infer, bounds proof
A topic section as above: files, measure, latest figures with date and commit.
crates/nikaia-std/src/compiler/ledger*.nika (the ledger and its first search), panics.nika (panics::infer, asks bounds::proven_for_lowering), bounds_*.nika (the proof; bounds_proven.nika keeps a unit’s Proven with a digest, bounds::proven_taken reuses it when the digest matches). There is no compiler/contracts/ directory. (5651724e)nikaia check src/main.nika on a copy of packages/logic with target/ removed; the corpus tests (crates/nikaia/tests/it/bytes.rs, contracts.rs, tethers.rs, sharing.rs) run only the ledger over the whole corpus. (5651724e, #2474)Figures (2026-11-21, 5651724e, ADR-361 D16): packages/logic ledger parallel first search 179.9 G -> 493.9 G Ir (through loops), lowering’s second proof 352.2 G -> 45.1 G, total 554.5 G -> 565.0 G. (#2451)
touch.nika (lock_doors, TouchPass, passed_on) and compared by argument binding in order.nika a_call_reaches (ADR-288 D23 as amended 2026-11-30). access_all/update_all, SafeMethod doors and recursive units still give an unnamed lock touch, which collides with every lock (conservative). (edcbe9dd, #2953)MethodsCalled.resolved keys carry no receiver: a per-receiver touch re-walks the body (lock_doors). Further work on per-lock touches starts in touch.nika unit_touches/touches_of_unit/absorb/methods_reach, order.nika a_call_reaches/argument_named/OneCall and foreign.nika Seen::Call. (issue-2953)Paths: wip/, draft
git diff HEAD...wip/X | git apply, after git diff --stat BASE HEAD shows HEAD has not touched its files; after lower-std, an empty git diff --stat wip/X -- crates/nikaia-std/src/compiler/lowered shows its lowered files are current. (issue-1470)git diff --stat wip/X -- crates/nikaia-std/src/compiler/lowered after lower-std: empty means the lowered files committed on the wip are current. (issue-1470)target/fast/nikaia already holds it; build the before binary by checking out HEAD’s version of only your own files, building, then git apply your saved patch. (issue-1473)Paths: slice, move, crates/nikaia/src/
Checker and the
emitter’s state become Nikaia structs (#558); a method moves into an impl
in Nikaia once everything it calls has moved; the recursive core (value_of,
stmt, call; expr_as_written, a_stmt) moves in one step. grep
'Finding {' and format!( find the cheap message-building first. A walk
that cannot move yet takes a callback (fn(ref Expr) -> i64 sync, see
bounds_basic.nika).libraries.nika + libraries.rs, assets.nika,
parse_numbers.nika (callbacks), interpreter.nika. The Rust module stays as
the adapter that calls nikaia_std::compiler::<m>::f.tools/*.nika: prefix type and function names with
the module; calls to other tools files are unqualified.std::ptr::eq). Destructure map
loops (for (name, value) in map, for (name, _) in map), not
entry.0/entry.1.for x in xs.f[a..] wrong (NK1343, expected Symbol, found &Symbol); after the checker fix in fb2698e9, the first build of a tool that uses it needs the index-skip form, then a switch back. (issue-1383)for rule in found lends each element from the named local, so held.push(rule) in the loop is refused (NK1102, a borrowed value moved); write held.extend(found). (issue-1470)Paths: tools/, crates/nikaia-std/src/compiler/
grammar is a reserved word: a binding named grammar in tools/*.nika is refused by lower-std. (issue-1431)
tools/*.nika has no loop; write while true. (issue-1266)for x in E ?? return null { does not parse; bind E with let first. (issue-1266)for (i, mut x) in v.iter_mut().enumerate() is refused (mut in a tuple pattern); use one read-only enumerate loop and a separate for mut x in v loop. (issue-1266)a..b includes b in Nikaia; write a..<b for the half-open range. (issue-1218); after it is a parse error (“Expected }”). (issue-1224)match’s catch-all arm is else => ...; _ => is refused. (issue-1352)match s.find(..) { at => .. } loses its origin (NK1214); write let at = s.find(..) ?? return null in a helper. (issue-1339)i64 has no checked_div_euclid/checked_rem_euclid; guard MIN / -1 and use div_euclid/rem_euclid. (issue-1339); does not drop a value and let _ = x is NK1144, so a value can’t be discarded explicitly; a body’s last value is dropped only where the function type hands back nothing. (issue-1321)let mut s = "" and then assigning an owned String is NK1105; start it as String(). (issue-539)for over a list literal of strings binds views, so pushing the loop variable into a struct field needs .clone() (NK1106). (issue-1404)T? is matched with x => … and null => …: if let and Some(x) are refused (NK2704), so write probes that way. (issue-1417)?? whose left side reads a map value (m[k] ?? []) is NK1185 in tools code; write m[k]?.clone() ?? [] behind a contains_key check. (issue-1485)Classes (CLAUDE.md, A missing form stops the work): [design] holds,
build that way; [gap #N] stops the slice (Result: blocked); [defect #N]:
fix it or wait; [works]: use it, do not copy an old way around.
if let: x ?? default, match, or starts_with
then strip_prefix(..) ?? "";*x; loop variables over a ref Vec are values;.to_owned() is NK1189: write .clone();String; never ref on a
number, bool or a data-less enum (NK1257). Until #654 step 0, ref
String only in: a field; a type argument; an option after ;; a function’s
or rule’s result; a parameter the result points into; a parameter used as a
key of a map keyed by ref String. A parameter only read is String;opt ?? "" moves the option: (opt ?? "").clone()
for a second use; a method on a String? is opt?.len() ?? 0; a T? local
needs ?.clone() (NK1125);?. chain does not carry on: x[k]?.set.contains(v)
is NK1125 on the T? field; write ?. at each step,
x[k]?.set?.contains(v) ?? false (issue-2953);{{ }};fn(ref X) -> T sync; a Span by
reference is copied with s.clone();view_of is signature::view_of: a false NK1104
(returns ref String, but declared ref String) means the wrong one;Some(..)/None are no patterns of a T?: bind how
?? ... first; a String? field is matched as it is (null => .., x => ..);ref String? parameter takes a bare String (ref String? is
NK1261, write String?);pub edit: Edit? =
null,), and a literal in any file of the package leaves it out: a field
added to a struct with many literals (CheckFinding) gets one, not an
edit: null in each; literals in hand-written Rust still name it;mut on one name of a tuple marks that name alone:
let (a, mut b) = …; for (k, mut v) in m lowers to m.iter_mut(),
for (_, mut v) in m to m.values_mut(); only a lambda’s tuple parameter
is still NK1307;a..b includes b, half-open is a..<b; the
catch-all arm is else =>;m.iter(), for (k, v) in m, a.iter().zip(b.iter());
in-place change of a map value let mut c = m[k] ?? continue (#952); [gap
#950] no BTreeSet::extend, no BTreeMap::entry; [gap #949] no
mem::take; [design: Part I 2.6] a text is cut only where it handed out a
position (NK1214): hex.scalars.take(16).collect(); [design: Part III]
fs::read is async and gives Bytes; read_dir gives sorted names.Paths: host.rs, host trait, lowered/, crates/nikaia/src/
String is &str where a view suffices and String where owned (ADR-282
D2), ref T is &T, String? is Option<String>. Most Rust errors after a
move are & against owned. Check that Display equals Ty::text() before
replacing {ty}.throws lowers to Result<T, Box<dyn std::error::Error>>;
keep an anyhow refusal in a RefCell of the host to hand it back. A
body-less trait method’s text parameter is written ref String. Host state
is a RefCell field; the Nikaia side names units by i64 index (M3b).Vec in the Rust host is Nikaia’s List: most of crates/nikaia/src
(project.rs, emit/, sysroot.rs, …) imports nikaia_std::block::names::{Vec, vec, ...},
and block.rs has pub use super::List as Vec. A plain Rust buffer there
(bytes read from a pipe, Command args, a value handed to std or libc
code) is written std::vec::Vec / std::vec::Vec::new(), as project.rs
already does; cargo check --release -p nikaia --message-format short
catches the slip before a build. (issue-1919, #1923)