Skip to content

impl(069): the Node binding's filesystem host opens inputs without blocking; spec 069 complete - #576

Merged
bartekus merged 1 commit into
mainfrom
impl/069-nonblocking-open-2
Nov 8, 2026
Merged

bartekus merged 1 commit into
mainfrom
impl/069-nonblocking-open-2

Conversation

@bartekus

@bartekus bartekus commented Nov 8, 2026

Copy link
Copy Markdown
Contributor

Summary

Implements spec 069 (#566; spec merged in #569). Replaces #570 (which an armed auto-merge merged into its stacked base by mistake). Stacked on #575, the dependency-only change (rustev-surface takes libc on Unix), which the policy-isolation guard requires to be its own pull request. Spec 069 becomes implementation: complete.

  • Shared open: rustev_surface::host::open_input is the CLI's former open_input, moved unchanged (read-only; Unix O_NONBLOCK, plus O_NOFOLLOW with no_follow; plain open elsewhere). The libc dependency arrives in deps(069): rustev-surface takes libc on Unix for the shared non-blocking open #575; rustev-cli keeps its now-unused libc entry until a later dependency-only change, and re-exports the function, so its callers and tests are unchanged.
  • Node host: integrations/rustev-node/src/live_fs.rs opens document inputs through open_regular (non-blocking, check on the handle) and store items through open_item (non-blocking, no-follow), closing the FIFO swap race 067's record left to rustev-node liveRun filesystem host: a FIFO swapped in between the metadata check and the open can block (CLI uses a non-blocking open) #566.
  • Tests: rustev-surface open_tests (FIFO opens at once; a link is refused with no_follow) and rustev-node a_fifo_reached_by_the_open_is_refused_without_blocking (input and store item refused within 10 s; linked store item refused), Unix only.
  • Mutation seeds: the three CLI seeds whose hunks sat in the moved function now name crates/rustev-surface/src/host.rs.
  • Verification: 069 joins VERIFIED_SPECS and the node-live acceptance group.

Verification

  • make gate and spec-spine couple pass.
  • cargo test for rustev-surface, rustev-node and rustev-cli, clippy and fmt: run locally in parallel with CI; results follow in a comment.

@github-actions

github-actions Bot commented Nov 8, 2026

Copy link
Copy Markdown

AI review (no-findings)

Reviewing the diff carefully against the governance documents and changed code.

Code correctness review

crates/rustev-surface/src/host.rs — open_input moves here unchanged from rustev-cli/src/io.rs. On Linux/macOS, open() with O_RDONLY | O_NONBLOCK on a FIFO with no writer succeeds immediately and returns a non-regular-file handle; callers correctly check metadata().is_file(). The function is semantically identical to what it replaced.

crates/rustev-cli/src/io.rs — the public re-export pub use rustev_surface::host::open_input preserves the public API; callers in trace.rs, replay.rs etc. are unaffected.

integrations/rustev-node/src/live_fs.rs — open_regular and open_item correctly layer open_input over the metadata check that existed before. open_regular propagates the FIFO-after-swap case as Err(IoFail { detail: "not a regular file" }), which the caller wraps in ReadFail::File — matching the original error shape. open_item uses no_follow: true (O_NOFOLLOW), correctly refusing symlinks in the store (spec 069, 3.2.2); a symlink causes ELOOP → .ok()? → None → Inaccessible, intentionally changing the previous follow-through behavior.

Tests

open_tests in host.rs: on Linux/macOS O_RDONLY | O_NONBLOCK on a FIFO opens immediately; metadata().is_file() is false → opened.ok() is Some(false) → assertion passes. The metadata().unwrap() inside the spawned thread is safe on a just-opened fd. The 10-second recv_timeout correctly detects blocking.

a_fifo_reached_by_the_open_is_refused_without_blocking in live_fs.rs: open_regular on a FIFO opens (O_NONBLOCK), then fails the is_file() check → Err(IoFail). input.unwrap_err().detail.contains("not a regular file") is correct. use super::* placed after the new test is fine — Rust resolves module-level use before any item ordering, and child modules have visibility into parent private items.

Spec lifecycle

specs/069-node-host-nonblocking-open/spec.md: the transition implementation: pending → complete on an approved spec is the correct terminal state once code ships. No governance rule requires a separate owner act to record this transition; the owner ratification (A-89) was already recorded in the approval prose. The two new extends entries (Makefile, scripts/acceptance/) correctly claim the changed coordination files against 001-boundaries-and-authority.

Mutation seeds

Seeds that previously named crates/rustev-cli/src/io.rs now correctly name crates/rustev-surface/src/host.rs (or both, for the pre-open check that stays in io.rs). The seed for "FIFO passes the check before opening and the open blocks" lists both files because the pre-open metadata check remains in io.rs while the blocking open is now in host.rs — consistent with spec 069 3.3.1 (I-2).

Verification commands

Declared verify:cli block matches the changed packages and test names. 069 is correctly added to VERIFIED_SPECS and to the node-live acceptance group.

No concrete defects found.

{"head": "5032fd3d23e3ca80307f7b3af8a66736badcfe3c", "verdict": "no-findings", "findings": []}

Subject: f9de5a4...5032fd3, diff digest 62d7daf03050fd452faea39fb45a5e0fbd36b99ee0c1fffcc77af9e2a4415e3a, 1 call(s). An AI comment is not an approval.

Base automatically changed from deps/069-surface-libc to main November 8, 2026 21:24
@bartekus
bartekus force-pushed the impl/069-nonblocking-open-2 branch from 5032fd3 to 2194a10 Compare November 8, 2026 21:25
@bartekus
bartekus enabled auto-merge November 8, 2026 21:25
@github-actions

github-actions Bot commented Nov 8, 2026

Copy link
Copy Markdown

AI review (no-findings)

Reviewing the diff against the governance context and the changed paths.

Spec lifecycle change (specs/069-node-host-nonblocking-open/spec.md): implementation moves from pending to complete. Per the contract table, approved + complete = settled (not schedulable, unresolved unit is error). The implementation record confirms the work is done in the same cycle. The two new extends entries for Makefile and scripts/acceptance/ correctly declare authorship over the files the PR edits.

Code move (crates/rustev-surface/src/host.rs, crates/rustev-cli/src/io.rs): open_input is moved verbatim from io.rs to host.rs; io.rs re-exports it with pub use. Semantics are identical.

Node host (integrations/rustev-node/src/live_fs.rs): open_regular calls open_input with no_follow=false; open_item with no_follow=true. After a non-blocking open of a FIFO (which succeeds immediately on Linux/macOS with O_RDONLY | O_NONBLOCK), metadata().is_file() returns false, causing refusal without blocking. The store resolver now also refuses symlinks (no_follow=true) where the old code followed them — a behavior change that matches spec 069 §3.2.2.

Tests: Both open_tests in rustev-surface and a_fifo_reached_by_the_open_is_refused_without_blocking in rustev-node spawn a thread and wait up to 10 s for the FIFO open to return; the assertions check the correct error message and is_file() result. FIFO creation uses mkfifo, universal on Unix where the #[cfg(unix)] gate restricts the tests.

Mutation seeds (crates/rustev-cli/mutation/seeds.py): The first seed widens its target from S+"io.rs" to [S+"io.rs", U+"host.rs"], mapping two hunks to two files — the metadata check that stayed in io.rs and the O_NONBLOCK flag that moved to host.rs. Seeds 2 and 3 simply redirect their single hunk to U+"host.rs". This is consistent with the implementation record's description.

Makefile / verify.py: 069 is added to VERIFIED_SPECS and to the node-live acceptance group. The spec records these ownership claims in the new extends entries.

No concrete defects found.

{"head": "2194a103ca700211ebc79752d5dbd9dab6500596", "verdict": "no-findings", "findings": []}

Subject: 6cc5eb3...2194a10, diff digest 62d7daf03050fd452faea39fb45a5e0fbd36b99ee0c1fffcc77af9e2a4415e3a, 1 call(s). An AI comment is not an approval.

@bartekus
bartekus disabled auto-merge November 8, 2026 22:30
@bartekus
bartekus enabled auto-merge November 8, 2026 22:30
@github-actions

github-actions Bot commented Nov 8, 2026

Copy link
Copy Markdown

AI review (no-findings)

Reviewing the diff. The change moves open_input from rustev-cli/src/io.rs into rustev-surface/src/host.rs so the Node binding can share the non-blocking open, then wires it into integrations/rustev-node/src/live_fs.rs via two new helpers (open_regular, open_item), and transitions spec 069 to implementation: complete.

Makefile / verify.py / spec frontmatter: Adding 069 to VERIFIED_SPECS and the node-live acceptance group is consistent with the spec declaring acceptance under those targets. The implementation: complete transition matches the lifecycle table in the contract (approved + complete = settled / no longer schedulable). No issue.

crates/rustev-surface/src/host.rs: The moved open_input is byte-identical to the original in io.rs. The Unix-only test spawns a thread and waits up to 10 s, correctly asserting Some(false) for a FIFO (non-blocking O_RDONLY on a FIFO without a writer succeeds immediately; is_file() returns false). The symlink arm (O_NOFOLLOW) is verified by asserting an error for the link and success for the target. No issue.

integrations/rustev-node/src/live_fs.rs: open_regular calls open_input(..., false) then checks metadata().is_file(); open_item calls open_input(..., true) with no_follow and likewise checks the handle. The store resolver previously used plain File::open without O_NOFOLLOW; open_item now refuses a final symlink, which is the new behaviour spec 069 §3.2.2 requires. The test for a_fifo_reached_by_the_open_is_refused_without_blocking verifies both helpers. open_regular and open_item are private (fn, not pub fn), but they are accessible from mod tests (a child module in the same crate), so the bare-name calls via the existing use super::*; (which, as a child-module glob, imports private-but-accessible items) are valid Rust. The placement of use super::*; after the new test function is unusual but semantically correct since use applies to the whole module scope. No issue.

crates/rustev-cli/src/io.rs: The local open_input is replaced by pub use rustev_surface::host::open_input, keeping the public API identical for trace.rs and replay.rs. The unused File import is removed. No issue.

crates/rustev-cli/mutation/seeds.py: The first seed now names [S+"io.rs", U+"host.rs"] (two files, two hunks — the metadata check stays in io.rs, the O_NONBLOCK flag moved to host.rs). Seeds 2 and 3 now point to U+"host.rs" only. These accurately describe where the mutated code now lives.

Spec 069 extends additions: The two new additive claims on 001-boundaries-and-authority cover Makefile and scripts/acceptance/—both changed by this PR. scripts/acceptance/ is not in the list of paths that require the statecraft-review-exception Environment approval (that list covers .github/workflows/, scripts/statecraft/, and scripts/check-authored-content.sh). No governance conflict.

No concrete defects found.

{"head": "2194a103ca700211ebc79752d5dbd9dab6500596", "verdict": "no-findings", "findings": []}

Subject: 6cc5eb3...2194a10, diff digest 62d7daf03050fd452faea39fb45a5e0fbd36b99ee0c1fffcc77af9e2a4415e3a, 1 call(s). An AI comment is not an approval.

@bartekus
bartekus added this pull request to the merge queue Nov 8, 2026
Merged via the queue into main with commit 9830626 Nov 8, 2026
57 of 65 checks passed
@bartekus
bartekus deleted the impl/069-nonblocking-open-2 branch November 8, 2026 23:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant