for mut v in all over a Vec[Vec[String]] of outside data: `for i in…Open and answer this issue on GitHub.
blocked, safety · opened 2026-11-15 · updated 2026-11-16 · 6 comments
Filed by the driver from the Found: of the run of issue-1624 (#1624) (owner, 2026-11-06).
a for mut v in all over a Vec[Vec[String]] of outside data: for i in 0..<v.len() { v.clear(); n += v[i].len() } gets no NK1302 and no outside line in check --bounds (only checked): the outside walk does not taint a list element’s length, so the index is not asked (prover/outside walk, outside_source in prover_walk.nika).
nikaia run scripts/probe.nika -- SNIPPET).tests/compiler/.The probe gives the specified result and its test is green.
Generated by Claude Code
Brief queued: issue-1628
agent: builder model: opus max_turns: 200 budget_usd: 30 effort: medium —
Your work order is issue #1628, 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/1628/comments -F body=@file,
ending with the Claude Code footer), rule I13.
develop in the main checkout; other agents’ uncommitted files are not yours: never touch or stage them.target/fast/nikaia run scripts/commit.nika -- REPORT (it adds exactly the report’s Files:); the driver pushes.cargo build --profile fast -p nikaia, lower-std and its fixpoint when a tools/*.nika changed, cargo fmt, cargo clippy --all-targets -- -D warnings, nikaia run scripts/pre-push.nika, the tests the issue names and the ones your change touches.CHANGELOG.md, badges and NK codes are the supervisor’s. New tests in Nikaia only: a Rust test file an older issue names is built as a tests/compiler/tests/ program, no Deviation: and no Issue: point (I9, #1671).Body:. Found: is only for what lies outside the area, cannot be fixed this run or needs a decision; the driver files it as an issue.std or the toolchain lacks stops the work, unless an ADR or Part I-III refuses it (name it): Result: blocked, Found: the gap with a probe, Needs: supervisor decision.NIKAIA_CACHE_LIMIT=2G; at the end delete your own clone’s target/ and target/release/nikaia-scratch.Result: partial with what you ruled out, the probe, and the suspected file and function./home/user/Nikaia/docs/briefs/safety/issue-1628.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.
Result:, Gate: (green or red <check>), Deviation:, Found: and the other fields with nothing to say hold the bare word: done, none. Anything after it reads as content.Result: done only when the issue’s Done when holds; partial with the items left otherwise.Deviation: only for an item of the issue built otherwise than written, or not built. Found: only for a defect outside your area, or one this run cannot fix: one defect per Found: line, with its probe and the output it gives, only the shapes that fail today, and the suspected file and function or cause unknown (#1695); a by-design behaviour is none (#1677). A correct program your own change refuses (a fail-closed check’s false refusal) is no Deviation: but one Found: line per shape, with its probe (#1680). Everything else goes into Body:; how you verified goes into Tests:.Issue: by docs/issues.md, How a run judges its issue: complete, or broke I<n>: ..., rules-gap: ..., wrong I<n>: ..., joined with ;; a point your own commit built gets (built) after its kind (rules-gap (built): ...), and the driver does not file it.done <sha>, report <path> (or BLOCKED: ... / PUSH REJECTED ...).Generated by Claude Code
Run: issue-1628, Result: blocked
Tokens: input 46, cache read 1231777, cache write 68791, output 13815 Cost: 1.11 USD, time 2 min 58 s, turns 23
Result: blocked
Files: none
Commit: none
Body: Reproduced on HEAD 12bced718. The defect is not about for mut, clear or list elements. Outside data handed to a private function through a list parameter never makes the callee’s indexes “from outside”. The outside walk (prover_outside, prover_calls.nika, #1573) marks function results and struct fields (by Type.field) as outside, never parameters. Inside the callee, outside data is asked only as a derived precondition over its parameters (unwritten_call/outside_call, prover_state.nika). An index whose goal cannot be stated over the parameters (an element of a parameter list, a length the walk forgot, a let k = v.len() - 1) is just “checked”. #1624’s field test is refused only because F.lines is outside by type. The same body written in main is refused NK1302 (p2, p7). There are two fixes and both are design choices: (a) taint, inside the callee, a parameter that a caller in the package fills with outside data (a new ProverOutside.params, seeded into scope.tainted). That changes D1’s “asked at that call” path for whole-number parameters, goes against the “not carried back” note (ADR-269 D6) on outside_call, and may refuse new sites in tools/packages/examples (D4). (b) Record an unstatable check in the callee that is refused at an outside call only. Nothing committed.
Fixes: none
Pushed: none
Tests: probes on HEAD’s binary, all check --bounds. p1 (the issue’s shape, fn lists(mut all: Vec[Vec[String]]) with for mut v in all { for i in 0..<v.len() { v.clear(); n += v[i].len() } }, all from process::run(...).stdout.split(" ").collect() in main): v[i] “checked: no fact bounds what it reads”, no outside line, Checked; run stops “index out of bounds: the len is 0 but the index is 0”, exit 101. p2 (the same loop in main): NK1302. p7 (for v in all { let k = v.len() - 1; n += v[k].len() } in main): NK1302 “k from all”. p6 (p7’s loop in fn lists(all: Vec[Vec[String]])): checked, no NK1302. p8 (fn last(v: Vec[String]) -> i64 { let k = v.len() - 1; return v[k].len() } called with the split list): checked, no NK1302, no derived line.
Gate: green
Deviation: To build item 2 (fix and test) not built: it needs the decision below
Found: outside data handed to a private function through a list parameter is not asked in the callee unless its goal is a precondition over the parameters: fn lists(all: Vec[Vec[String]]) -> i64 { let mut n = 0; for v in all { let k = v.len() - 1; n += v[k].len() }; return n } called as lists(all), where all: Vec[Vec[String]] = [process::run("echo", ["ab cde"]).stdout.split(" ").collect()], gives “v[k] checked: no fact bounds what it reads”, Checked. It should give NK1302 (ADR-396 D1: “The walk follows the value through every call whose body it reads in the package”), as the same loop in main does (“k from all: refused NK1302”). Also fn last(v: Vec[String]) -> i64 { let k = v.len() - 1; return v[k].len() }: checked, no derived precondition. Cause: prover_outside/prover_outside_block (prover_calls.nika) taint results and fields, never parameters; unwritten_call (prover_state.nika) asks only checks whose goal can be stated over the parameters
Needs: supervisor decision: should a parameter that a caller fills with outside data be tainted inside a private callee (fix a), or should a check the callee cannot state be refused at an outside call (fix b)? With the answer this issue can be built
Changelog: none
Issue: wrong I5: the Found blames list-element length and for mut, but the defect is outside data through any list parameter (p6, p8), and outside_source is in prover_calls.nika, not prover_walk.nika; broke I4: the probe is a fragment without its fn, main or use lines, so whether all was a local or a parameter (the whole defect) had to be guessed
Owner: none
Comment: none
Friction: none
Disk freed: none; target/nikaia-project-tests 8.0G, / 8.7G free (78 %); no cache entries created this run
Attribution:
Co-Authored-By: Claude Opus 5.5 noreply@anthropic.com
Claude-Session: https://claude.ai/code/session_01UVxJDv4ha75BSeuJhmqFAL
all: a local or a parameter. The fragment didn’t say. It took about 6 probes (p1–p8) to show the defect is any list parameter filled with outside data, not for mut or clear.prover_outside in prover_calls.nika) and unwritten_call/outside_call in prover_state.nika. I also hit a wrong path: prover_walk.nika now lives under compiler/, not tools/. A brief line naming the outside-walk files and #1573’s design (only results and fields are marked outside) would have saved about 5 turns.check --bounds and run on the probes, with HEAD’s binary. No builds and no tests. p4 (a constant index) was wasted: it proved nothing.main and behind a function parameter; a difference means the defect is in how outside data crosses calls.” That would have reached the real cause in two probes.broke I4: the probe is a fragment, with no fn signature, main or use lines.wrong I5: the cause names the length of a list element and outside_source in prover_walk.nika. The real cause is that parameters are never marked outside, and outside_source is in prover_calls.nika.rules-gap: no rule asks a Found to say whether outside data reaches the index through a call or within one function.Fact: prover | The outside walk (#1573, prover_outside in prover_calls.nika) marks only function results and struct fields (by Type.field) as outside, never parameters; in a callee, outside data is asked only as a precondition over its parameters (unwritten_call, prover_state.nika).Fact: prover | A probe for NK1302 behaves differently in main and behind a private function's list parameter; run both before judging a walk defect.Generated by Claude Code
Supervisor decision (2026-11-16), from the run’s report: fix (b). The specification already leans this way:
Fix (a) would go against both. It would also refuse a callee’s index at every call, including calls that pass inside data only.
The rule:
let k = v.len() - 1; v[k].NK1302 at that call, naming the callee’s index.The run found two problems with the issue text:
for mut, but the defect is outside data passed through any list parameter.fn, main or use lines.The full probe is in the run’s report.
NK1302 at an outside call, with a note naming the callee’s index.tests/compiler/tests/ with both probes from the run:
lists(all) with all from process::run(...) gives NK1302;fn last(v: Vec[String]) called with outside data gives NK1302, and called with a literal list gives Checked.Both probes give NK1302 at the outside call, the inside call still checks, and the test is green.
Generated by Claude Code
Run: issue-1628, Result: partial - built and green on both probes, kept as draft wip/issue-1628 (524e2e7, tree restored to HEAD): lower-std refuses 2 correct compiler sites the walk cannot prove, so ADR-396 D4 bars merging; left: fix those 2 walk gaps, then commit the draft
Tokens: input 184, cache read 6313252, cache write 189279, output 60501 Cost: 4.18 USD, time 34 min 9 s, turns 92
Result: partial - built and green on both probes, kept as draft wip/issue-1628 (524e2e7, tree restored to HEAD): lower-std refuses 2 correct compiler sites the walk cannot prove, so ADR-396 D4 bars merging; left: fix those 2 walk gaps, then commit the draft
Files: none committed (draft wip/issue-1628: prover_{calls,claims,passes,scope,state,walk}.nika + lowered, adr-396.md D1, 2 tests an_index_its_callee_cannot_state_)
Body: ProverScope.fed maps names to the params their data reads; pass 1 records UnstatableCheck (index value fed by params, no statable bound) per fn, carried through calls; pass 2 refuses NK1302 at a call handing such a param outside data; unwritten_call now counts x.len() of an outside x as outside (outside_of), which is why last gets refused
Pushed: no
Tests: draft’s 2 new tests pass –both-settings; the refusal test FAILED on old binary (Checked); examples/ and packages/* entry files check clean; no Rust changed
Gate: green
Deviation: none
Found: walk has no term for division by a constant: let d = b as i64; digits[d / 16] over 16-entry digits (lsp.nika lsp_path_uri; literal list too) gives “checked: no fact bounds what it reads”, should be proved (b is a byte); suspect prove_terms.nika lin_term (no BinaryOp::Div/Rem); blocks wip/issue-1628 at lsp.nika:275
Found: for k in i..<a { was[k] } in fix.nika fix_diff (a <= was.len(), i >= 0 by the loop) “checked: a counter the loop … changes” (#1634); blocks wip/issue-1628 at fix.nika:74
Needs: supervisor decision whether wip/issue-1628 waits for both walk fixes (D4) or lands with those 2 sites guarded
Changelog: none yet (draft) - entry when merged: “An index a private function cannot state over its parameters is refused NK1302 at a call that hands it outside data (ADR-396 D1, #1628)”
Issue: wrong I5 (blamed list elements and for mut, named prover_walk.nika; the cause is prover_calls/state: unstatable checks never recorded, and lengths of outside lists not counted as outside); broke I4 (probe was a fragment); probe 2 with .split(" ") is safe in fact (split gives len >= 1), needs .lines()
Comment: #1634 blocks the merge of the #1628 draft (wip/issue-1628): fix.nika fix_diff was[k], for k in i..<a, refused at fix.nika:74 under it
Friction: none
Disk freed: 0 (cache 8.0G, disk 7.3G free; no new entry over 100 MB)
Attribution:
Co-Authored-By: Claude Opus 5.5 noreply@anthropic.com
Claude-Session: https://claude.ai/code/session_01UVxJDv4ha75BSeuJhmqFAL
last) stayed Checked. Three causes were tangled: split gives at least one element, so the call was safe; the check was statable, so it went through outside_call; and outside_call never counted x.len() as outside. Close behind were the two compiler sites lower-std refused, which I traced to prover gaps I could not fix in this run.unwritten/unstated, known_*); the prover_a_call and prover_a_method_call signatures (neither had holes_of); from_outside and prover_outside_index (only the index is asked); lin_term (no / or %); how --bounds-trace works under lower-std. ADR-396 D1, D4 and D8 too.--bounds and --bounds-trace on scratch copies, the cycle (three builds), the two tests on both binaries, the scan of examples and packages.lower-std --unproved-claims warn --bounds (the flag was ignored and it printed 7,600 lines), and a first lu.nika copy cut at the wrong line.lower-std with the new rule and list the sites it refuses in the compiler; if one needs a prover extension, stop before the draft.” D4 ended my run, and that cost came at the end, not the start.wrong I5: it named prover_walk.nika, list elements and for mut. The real cause was in prover_calls/prover_state: unstatable checks were never recorded, and lengths were not counted as outside.broke I4: the probe was a fragment, not a whole program.wrong I4: probe 2 fed by split is safe, since split gives at least one element; it needed .lines().rules-gap: the issue did not list the compiler sites the rule would refuse under D4 (fix.nika:74, lsp.nika:275).| Fact: Core | A new NK1302 rule first runs lower-std and lists the compiler sites it refuses; D4 bars merging while any remain. |
| Fact: lowering | s.trim_end_matches(x).to_string() returned from a -> String function draws NK1104 (ref String); write .clone(). |
| Fact: prover | lin_term has no term for / or % by a constant, so xs[d / 16] is never proved, even when d is a byte. |
| Fact: prover | split(...).collect() carries a length of at least 1, so a probe for an empty list from outside needs .lines(). |
Generated by Claude Code
Supervisor (2026-11-16): run 2 built fix (b) as draft wip/issue-1628 (both probes NK1302, inside call Checked). Under ADR-396 D4 it does not land with guarded sites: it waits for #1786 (division by a constant in the walk, lsp.nika:275) and #1634 (relational loop facts, fix.nika:74). Note for the re-run: the draft also refused 31 sites in scripts/drive.nika, mostly value.split(" ").collect()[0] (split gives at least one part), so scripts/*.nika must be checked with the draft too. Marked blocked.
Generated by Claude Code
From the report of the run of issue-1786 (#1786):
lsp.nika:404-405 (digits[d / 16], digits[d % 16] in lsp_path_uri) are proved since the fix for #1786; wip/issue-1628 no longer blocks there
Generated by Claude Code