agent: builder model: sonnet max_turns: 100 budget_usd: 20 —

Brief: #655 step 1, a view pushed into a local Vec that never leaves is not kept (NK2302 false positive)

Score: bugs lane (docs/priorities.md): a false refusal in the checker that holds a detour in our own code (check_arguments’ arm index and check_arguments_at); small, one area (views.nika). Steps 3 and 4 of #655 are done (2003b4c, deed9ad, f4dfb8c); steps 2 and 5 come in later briefs.

Issue text (#655, item 1 and step 1)

NK2302 false positive. expanded.push(Arg { given: given[at] }) into a local Vec that never leaves the function is refused. The rule is views.nika a_field_built; a local struct is already allowed (views_a_local_struct). To build 1: NK2302: a push into a local that does not escape is treated like views_a_local_struct. After that, check_arguments drops its arm index and check_arguments_at.

Probe (reproduces on f4dfb8c: error[NK2302]: \count` keeps `given` after this call` at line 11)

struct E {
    n: i64
}

struct Arg {
    given: ref E?
}

fn count(given: ref Vec[E]) -> i64 {
    let mut expanded: Vec[Arg] = []
    expanded.push(Arg { given: given[0] })
    return expanded.len()
}

fn main() {
    let g = [E { n: 1 }, E { n: 2 }]
    println(f"{count(g)}")
}

Expected after the fix: prints 1. Matrix to run after the one build: (a) the probe; (b) the same, but return expanded (the Vec leaves: NK2302 stays, as now); (c) expanded handed to another function as mut (stays refused unless that function’s contract keeps nothing; say which in the commit); (d) push of given[0] straight into a local Vec[ref E?] that does not leave (if it fails for the lowering reason of #655 item 2, that is step 2’s, not yours: note it under Tests:).

Locations

Done when

nikaia test tests/compiler --both-settings passes, plus the it filters naming NK2302 (nikaia run scripts/where.nika -- NK2302 lists them). Commit A view pushed into a local Vec that does not leave is not kept (Part of #655); no Fixes (steps 2 and 5 remain). Changelog line: yes (checker accepts more).

Stop and report if

The rule needs a choice the issue does not make (e.g. a local Vec later read by a closure): Result: blocked, the question under Owner:.

Read docs/builder-facts.md.

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

Report (at most 15 lines, to exactly /home/user/Nikaia/docs/briefs/b655-push-local-view.md.report.md)

Fields of docs/architect.md, Briefs and reports: Result: done|noop|partial|blocked (the bare word first; Owner: is a question for the owner or none, never a role), Files, Commit, Fixes, Pushed, Tests, Gate (green|red), Deviation, Found, Needs, Changelog, Owner, Disk freed. none where nothing, and then the bare word: Deviation: none (a note) cuts the batch (batch.nika compares exactly); a note goes into the commit message. Found: is only for a defect outside your change (it cuts the batch); how you solved your own step goes into the commit message. Deviation: is only a step of the brief built otherwise than written or not built; how you verified (e.g. a test not run against the unfixed compiler) goes under Tests:. A noop says why under Tests: (what was probed), not under Deviation:. Final answer, one line: done <sha>, report <path> (or BLOCKED: ... / PUSH REJECTED ...).

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

This site is open source. Improve this page.