Ty::Named { name: item, args: inner, .. } without ref…Open and answer this issue on GitHub.
ready, bugs · opened 2026-11-21 · updated 2026-11-23 · 3 comments
Filed by the driver from the Found: of the run of issue-743-run6 (#743) (owner, 2026-11-06).
lower-std writes Ty::Named { name: item, args: inner, .. } without ref in check_core_index_of (lowered/check_core_places.rs; rustc E0308 is_whole_number(item) expected &str, found Text) when another function of check_core_places.nika has the arm Expr::Variable(name, _) => { let local: CheckLocal = state.binding(world.words.resolve(name)) ?? return null; return state.facts.pos_texts.get(local.id)?.clone() }; written let kept = state.facts.pos_texts[local.id] ?? return null; return kept.clone() it lowers with ref item again (my commit uses that form); a standalone program with the same match and ?.clone() shapes does not show it; renaming item or my args binding changes nothing; one function’s lowering must not depend on another’s body; suspected check_core_flow_lent_parts / CheckState::parts_lent (check_compare.nika, the handed/changed indices from, changed_from), cause unknown
develop first: the run that wrote it may have used a binary older than the tip, so it may be fixed already (#1822: #1788 was filed from a probe a fix under #1754 had already made pass). A probe that passes there names the commit that fixed it (git log -400 --grep by topic, since a fix often lands under another issue’s number), and the run builds only a tests/compiler/tests/ test that pins it (docs/issues.md I13).std defect with a probe (nikaia run scripts/probe.nika -- SNIPPET; a lowered file that differs, with an uncached lower-std of a git archive HEAD copy, NIKAIA_LOWER_CACHE_SALT fresh and --sysroot COPY/crates, its lowered/ diffed against the copy’s, never the shared working tree’s, #1793), a defect in docs/, guide/, website/ or scripts/ (a stale example, a wrong rule) with the command or check that shows it; a behaviour the code does on purpose (name the function or ADR) closes it as by design. The Found line may lack them (#1710): the commit message, or the report’s Body: when closed, gives the probe or check with its expected output, the ADR or Part I-III section that says so, and its actual output (docs/issues.md I5, I6), and the cause, file and function, traced or suspected (I7).std defect in the compiler, a stale page example or rule in its page or docs/ file, a script defect in the script. Add a test in tests/compiler/tests/ unless a check that already runs turns red on it (name it: pre-push’s page-examples for guide/ and website/, check-adr-refs.nika for a docs citation).The probe or check gives the expected output the first item names from its ADR or Part I-III section, and a tests/compiler/tests/ test (or the named check) that failed on the unfixed tree is green; or the probe already passes on develop and a test pins it, naming the commit that fixed it; or the issue is closed as by design, naming the function or ADR.
Generated by Claude Code
Brief queued: issue-2454
agent: builder model: opus max_turns: 200 budget_usd: 30 effort: medium —
Your work order is issue #2454, 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/2454/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.suspected, or does not mark (docs/issues.md I7), is a hypothesis: run the check that settles it (nikaia run scripts/where.nika -- NAME, the probe with a trace, callgrind for a cost) before you build on it (owner, 2026-11-16). Shown false: say so in Issue: as wrong I7: <what the check showed> (the driver comments it on the issue) and follow the real cause.Result: partial with what you ruled out, the probe, and the suspected file and function./home/user/Nikaia/docs/briefs/bugs/issue-2454.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. complete is the bare word: prose after it (complete; the earlier runs ...) is filed as an improvement issue (#1931); history or a note for your own issue goes into Body: or Comment: #N <text>.done <sha>, report <path> (or BLOCKED: ... / PUSH REJECTED ...).Generated by Claude Code
Run: issue-2454, Result: partial
Tokens: input 114, cache read 3342245, cache write 100571, output 23283 Cost: 2.11 USD, time 0 min 26 s, turns 57
Result: partial
Files: none
Commit: none
Body: Reproduced on develop f846e4420 with an uncached lower-std (NIKAIA_LOWER_CACHE_SALT fresh, –sysroot of a git archive copy): with the issue’s form of the Expr::Variable arm in check_core_places.nika (~1325), lowered check_core_index_of’s Ty::Named { name: item, args: inner, .. } arm loses ref (name: ref item becomes name: item); with HEAD’s form (let kept = state.facts.pos_texts[local.id] ?? return null; return kept.clone()) it keeps it. Narrowed: only the .get(local.id)?.clone() part triggers it (variant with just the : CheckLocal annotation keeps ref; let kept = ...get(local.id) ?? return null; return kept.clone() keeps ref; return state.facts.pos_texts.get(local.id)?.clone() drops it, each with the same 1-node shift). Ruled out: a node-id shift alone (HEAD’s file plus a 1-node dummy fn keeps ref; the issue’s form plus a 3, 4 or 5-node dummy fn stays bare); package-level id-keyed facts (PackageFacts/CheckPackage hold none); cross-file walks (instantiations_beside, unroll and field_copies walk only this file). Not fixed, nothing committed.
Fixes:
Pushed: none
Tests: uncached lower-std of copies only (HEAD form: ref; issue form: bare; K-node shift copies as above); no test added, since no fix was made
Gate: green
Deviation: no fix and no test: no cause found within the 40-turn time box
Found: lower-std drops ref in lowered check_core_index_of’s Ty::Named { name: item, args: inner, .. } arm (match subject args[0], lowered as *unsafe { nikaia_std::proven::read(&args, 0) }) when check_core_places.nika’s Expr::Variable arm (~1325) reads let local: CheckLocal = state.binding(world.words.resolve(name)) ?? return null; return state.facts.pos_texts.get(local.id)?.clone() instead of let kept = state.facts.pos_texts[local.id] ?? return null; return kept.clone(); it should keep name: ref item, as the HEAD form does, and rustc otherwise gives E0308; probe: replace the arm in a git archive copy, run NIKAIA_LOWER_CACHE_SALT=x target/fast/nikaia lower-std --sysroot COPY/crates, grep Named { name: in lowered/check_core_places.rs; suspected: check_core_flow.nika check_core_flow_lent_parts / check_compare.nika parts_lent (lent_bindings keyed by id_of(arm.body), so per-file ids collide) or a per-file fact the SafeMethod ?.clone() on a Vec::get result sets (std_gets/copied_walks keyed by id_of(expr)), since only that shape flips it (.get() ?? return null then .clone() keeps ref); cause unknown
Needs:
Changelog:
Issue: fits I1-I13; its probe reproduces
Owner:
Comment: #2454 Reproduced on f846e4420 with an uncached lower-std of an archive copy; a node-id shift of 1, 3, 4 or 5 nodes does not flip it, so it is not a plain id collision from the arm’s size; only return state.facts.pos_texts.get(local.id)?.clone() flips it (the annotation alone and .get() ?? return null then .clone() keep ref); suspects are lent_bindings via parts_lent and the facts the SafeMethod ?.clone() sets
Friction: each uncached lower-std of a copy takes several minutes, and a traced compiler build was not possible (8.6G free, a second target/ is forbidden), so bisecting the checker fact cost most of the turns
Disk freed: none; target/nikaia-project-tests 2.9G, / 8.6G free of 252G, no new cache entry over 100 MB, scratch dir 110M
Attribution:
Co-Authored-By: Claude Opus 5.5 noreply@anthropic.com
Claude-Session: https://claude.ai/code/session_01UVxJDutPTwP5Xj5HkGuidk
lower-std of an archive copy takes several minutes. Narrowing the trigger meant one copy per variant: the node-shift runs with K=1, 3, 4 and 5, then variants a, b and c. Reading the checker’s flow code to guess at a cause also took turns: check_core_flow_arm, parts_lent, lent_bindings.parser/mod.rs, ADR-340/383). That a match arm’s ref comes from facts.lent_bindings[id_of(arm.body)], written in emit_core_match.nika. The NIKAIA_LOWER_CACHE_SALT plus --sysroot recipe for an uncached reference run. Which per-file sets are keyed by id_of(expr).rules-gap: the issue gives the whole triggering arm, not the smallest shape. The single shape is return state.facts.pos_texts.get(local.id)?.clone().knowledge: Lowering | a match arm is lowered with ref only when lent_bindings holds that name under id_of(arm.body), and these ids are unique only within one file.rules-gap: the issue names no command for the uncached reproduction, so I had to work out the salt-and-sysroot recipe.Fact: Lowering | lower-std caches per file, so a reference run of an edited copy needs NIKAIA_LOWER_CACHE_SALT=<fresh> and --sysroot COPY/crates, else it reports the cached resultFact: Core | a traced second compiler build doesn't fit: target/fast is 7.6G with about 8.6G free (2026-11-22, f846e4420), so bisect with uncached lower-std copies insteadFact: Lowering | an uncached lower-std of one edited check_core_places.nika copy took several minutes per run (2026-11-22, f846e4420, binary target/fast/nikaia)Fact: Lowering | #2454 trigger, measured 2026-11-22 on f846e4420: \return state.facts.pos_texts.get(local.id)?.clone()` drops ref in check_core_index_of; `.get() ?? return null` then `.clone()` keeps it`Generated by Claude Code
From the report of the run of issue-2454 (#2454):
Reproduced on f846e4420 with an uncached lower-std of an archive copy; a node-id shift of 1, 3, 4 or 5 nodes does not flip it, so it is not a plain id collision from the arm’s size; only return state.facts.pos_texts.get(local.id)?.clone() flips it (the annotation alone and .get() ?? return null then .clone() keep ref); suspects are lent_bindings via parts_lent and the facts the SafeMethod ?.clone() sets
Generated by Claude Code