Issue #2460: The compiler’s build writes and outer record proved below their roots, its manifest beside the sources (ADR-raw-sinks-1 D17.6-8)

Open and answer this issue on GitHub.

blocked, safety · opened 2026-11-21 · updated 2026-11-21 · 4 comments

Part of #2442. The rest of “Where the compiler states its own untrusted-paths allowance” (#2442), after 7af31096 (the store’s reads, D17.1). Decided by the supervisor as ADR-raw-sinks-1 D17 items 6-8 (an obvious extension of the owner’s decision on #2442); this issue also holds the Founds filed as #2461 and #2462.

Decision (ADR-raw-sinks-1 D17)

Found

On today’s develop, NK1308 untrusted-paths-read/write remains at project_drive.nika 685, 694, 698, 727, 728 (outer record) and at the store’s two fs::copy (~1676, ~1694). The wrapper sees no CARGO_TARGET_DIR under cargo build --target-dir X (probe in the #2442 report: env-printing RUSTC_WRAPPER, verified). The locker test’s dep-info names 26 files in crates/nikaia-std/src (verified). Cause of the manifest point: Layout::resolve (crates/orchestrator/src/cache.rs:680) takes the nearest nikaia.toml among the ancestors (read, verified).

To build

Done when

nikaia check of project_drive.nika gives no NK1308; the compiler’s manifest exists with zero allowances; no trusted:, no fs::Root::Anywhere at the sites above; the new tests failed on the unfixed tree and are green; the #1750 and store cache tests stay green.


Generated by Claude Code

Comments

keywan-ghadami, 2026-11-21

Brief queued: issue-2460


agent: builder model: opus max_turns: 200 budget_usd: 30 effort: medium —

Issue #2460

Your work order is issue #2460, 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/2460/comments -F body=@file, ending with the Claude Code footer), rule I13.

Rules (CLAUDE.md; shared checkout)

Report (at most 15 lines, to exactly /home/user/Nikaia/docs/briefs/safety/issue-2460.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.


Generated by Claude Code

keywan-ghadami, 2026-11-21

Run: issue-2460, Result: blocked

Tokens: input 70, cache read 1865639, cache write 65957, output 15143 Cost: 1.25 USD, time 5 min 1 s, turns 35

Report

Result: blocked Pushed: none Tests: issue probe target/fast/nikaia check crates/nikaia-std/src/compiler/project_drive.nika on HEAD’s binary: NK1308 at 685, 694, 698 (x2), 727, 728 (x2); the store’s fs::copy at 1676 and 1694 draw no NK1308 today but still name fs::Root::Anywhere Gate: green Deviation: none Found: item 6 needs a copy from the store (user cache, ~/.cache/nikaia, orchestrator::cache::user_cache_dir) into the target directory, and std has no form for it: fs::copy takes one root for both names (ADR-108 D2, “both names must lie under it”), use std::fs; fn main() throws { let from: fs::Path = "/abs/cache/f"; fs::copy(from, "g", fs::Root::Dir("/abs/target/out")) catch { println(f"copy: {error}"); return }; println("copied") } prints copy: the name leaves the root it was given: /abs/cache/f, and the ADR-108 route of fs::read under one root then fs::write under the other drops the executable bit of a stored bin output, since std has no permission setter (fs::set_permissions("g", fs::Root::Dir("."), 0o755) gives NK1171 fs has no function called set_permissions); either a copy over two roots or a mode option is wanted, no decision yet Found: item 6 also needs the target directory before Cargo starts, and Nikaia cannot learn it: project_drive_cargo_env (project_drive.nika 759) builds the env before host.make_cargo, and the --target-dir is chosen in Rust (make_cargo, crates/nikaia/src/project.rs 4457: Sysroot::rlib_cache(...) when shared, else none, which is Cargo’s default <manifest dir>/target); ProjectDriveHost (Rust-implemented) has no target_dir accessor, so the item needs a new Rust host method (traced), no decision yet Found: item 7 needs the outer build’s roots (project root, the sysroot’s std sources, the target directory) in project_drive_fresh / project_drive_record, which the Rust host cargo_fresh / record_cargo (crates/nikaia/src/project.rs 4307-4315) calls with only record, handed[, messages, generated]; ProjectDriveHost (project_drive.nika 40-160) has gen_dir, own_dir, switches_path but no accessor for any of the three roots, so each must be a new method of a host implemented in Rust, which the issue itself says to report, not write around (traced), no decision yet Found: item 8 asks project_check.nika to read crates/nikaia-std/trust/nikaia.toml by path, but Nikaia has no TOML reader: manifests are parsed only in Rust (Manifest::read, crates/nikaia/src/manifest.rs 110, toml crate) and manifest_parse (manifest.nika 429) takes already parsed ManifestItems; project_check_raw_sinks_in_std (project_check.nika 333) is called from Rust (allow_std_helpers_in_std, crates/nikaia/src/check/mod.rs 808) with no path, so the item needs either a Nikaia TOML reader or a change to that Rust caller to read the manifest and pass its [allow] (traced), no decision yet Needs: supervisor decision: (1) a std copy over two roots, or a permission/mode option on fs::write, for the store’s outputs (item 6); (2) whether new Rust host methods target_dir (item 6) and the outer build’s roots (item 7) may be added to ProjectDriveHost; (3) how project_check.nika gets the manifest’s [allow] without a Nikaia TOML reader (item 8) Changelog: none Issue: wrong I7: the decision (and 7af31096’s probe, “fs::write/fs::copy under Root::Dir(target) gives Checked”) assumed the store can copy into a root on the target directory, but the store’s source lies in the user cache outside it and fs::copy resolves both names under one root (ADR-108 D2), so the copy fails at run time with “leaves the root”; broke I4: items 7 and 8 name host accessors and a manifest read whose implementation is Rust (project.rs hosts, Manifest::read) without saying whether new Rust is allowed Friction: none Disk freed: none; target/nikaia-project-tests 1.3G, / 8.4G free (79 %), no new cache entry over 100 MB Attribution: Co-Authored-By: Claude Opus 5.5 noreply@anthropic.com Claude-Session: https://claude.ai/code/session_01UVxJDvbkNUUMs8HdjJ8ixV

Debrief

  1. Most time: the issue’s own probe, nikaia check project_drive.nika. It passed the 120 s tool timeout and had to finish in the background. Second was tracing where each root comes from, across project_drive.nika, project.rs, cache.rs and fs.rs, to show that all three items need Rust or a missing form.
  2. What I looked up that the brief could have handed me:
    • ADR-108 D2: fs::copy takes one root for both names.
    • The store’s entry sits under user_cache_dir, outside the target directory.
    • make_cargo in Rust picks --target-dir.
    • ProjectDriveHost and its Rust implementation in project.rs.
    • Manifests are parsed only in Rust (Manifest::read, the toml crate).
  3. Checks: the NK1308 check was needed. So were the two-root fs::copy probe and the fs::set_permissions probe. My first run of both probes was wasted, because I left out use std::fs (NK1117). I did no builds and no tests, since nothing was committed.
  4. One change: a decision that says “through a root on X” should come with a probe that runs at run time (nikaia run), not only check. The issue’s claim rested on a probe from 7af31096 that only checked, and Checked hid the “leaves the root” failure.
  5. What the issue lacked:
    • wrong I7: the plan to copy through a root on the target directory assumes the copy’s source lies under that root. It lies in the user cache.
    • rules-gap: items 7 and 8 lean on Rust-implemented hosts and on Rust TOML parsing, and the issue does not say whether new Rust is allowed. I wrote broke I4 in the report without checking that I4 is the rule for this, so the label may be wrong.
    • knowledge: Core | std has no permission setter and no copy across two roots, so a file can only move between roots by read and write, and an executable loses its mode.
  6. Traps:
    • Fact: Core | nikaia check crates/nikaia-std/src/compiler/project_drive.nika runs past 120 s; run it with run_in_background.
    • Fact: Probes | A probe file needs use std::fs (NK1117), and check passing a fs::Root::Dir call proves nothing about run time; run it with real paths.
    • Fact: Core | Nikaia has no TOML reader: a nikaia.toml reaches Nikaia only as ManifestItems parsed by Rust (crates/nikaia/src/manifest.rs).

Generated by Claude Code

keywan-ghadami, 2026-11-21

Driver: not queued, this issue waits for #2481, #2482, #2483, #2484, which is still open (#1819). Set ready again when it is closed.


Generated by Claude Code

keywan-ghadami, 2026-11-21

Supervisor, 2026-11-21: the builder’s run (192f6637 base) stopped at Result: blocked, correctly. ADR-raw-sinks-1 D17.6-8 each need Rust, which the rule “new features: no new Rust” forbids outside the exception of #1214:

These are a decision for the owner, not bugs: relabelled decision, safety. The options go to the owner in the session:

  1. Allow thin Rust for D17 under the exception of #1214. That means a two-root fs::copy that keeps the mode, three host accessors, and the Rust caller passing the manifest’s [allow]. The logic stays in Nikaia, and the report lists the Rust for #557 / #125.
  2. Convert first: move the target-dir choice of make_cargo and Manifest::read (a TOML reader) into Nikaia. This is larger, and it is the self-hosting direction.
  3. Narrow D17: no store and no outer record until 2 is done; item 2 is a rustc run without a cache.

#2460 waits for the decision.


Generated by Claude Code

Back to Open Issues