Skip to content

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

Merged
bartekus merged 1 commit into
deps/069-surface-libcfrom
impl/069-nonblocking-open
Nov 8, 2026
Merged

bartekus merged 1 commit into
deps/069-surface-libcfrom
impl/069-nonblocking-open

Conversation

@bartekus

@bartekus bartekus commented Nov 8, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Implements spec 069 (#566; spec merged in #569). 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 (findings)

Reviewing the changes: open_input is extracted from rustev-cli/src/io.rs into rustev-surface/src/host.rs, re-exported from the CLI, consumed by the Node binding's filesystem host, and spec 069's lifecycle advances from pending to complete.

Code correctness

The implementation is sound. open_input is moved byte-for-byte; rustev-cli drops its direct libc dependency and re-exports from rustev-surface; callers of rustev_cli::io::open_input are unaffected. open_regular and open_item correctly layer the non-blocking open with the post-open metadata check. The FIFO and symlink tests in both crates cover the cases the spec requires.

Spec coverage gap

The spec 069 extends section covers integrations/rustev-node/ (via spec 067), crates/rustev-cli/ (via spec 006), and the shared Cargo.lock and Makefile (via spec 001). It does not declare any claim over crates/rustev-surface/, yet this PR adds a new public function (open_input), a platform-conditional libc dependency in Cargo.toml, and a new Unix test module to that crate. The comment in the frontmatter ("rustev-surface gains a Unix-only libc dependency (3.1.2)") is paired only with the Cargo.lock file unit — it does not cover the source or manifest of the crate itself. AGENTS.md states one owning spec per crate and that a behavior change begins with a spec change that owns the changed path; spec 069's extends omits the crates/rustev-surface/ directory unit entirely.

{"head": "088f2cec8911a6a06e291ba38ad46912f85bd245", "verdict": "findings", "findings": [{"path": "specs/069-node-host-nonblocking-open/spec.md", "line": 27, "severity": "medium", "category": "correctness", "summary": "spec 069 extends does not declare any unit over crates/rustev-surface/ even though Cargo.toml, src/host.rs (new open_input function and test module) in that crate are all changed by this PR, leaving the coupling gate unsatisfied for those paths."}]}

Subject: 20533f0...088f2ce, diff digest 6460e2b63899824813bcbf190acd52b511b813599a21d43139c03b45b4c92e55, 1 call(s). An AI comment is not an approval.

@bartekus
bartekus temporarily deployed to statecraft-review-exception November 8, 2026 19:08 — with GitHub Actions Inactive
@bartekus
bartekus force-pushed the impl/069-nonblocking-open branch from 088f2ce to bd283dc Compare November 8, 2026 19:09
@github-actions

github-actions Bot commented Nov 8, 2026

Copy link
Copy Markdown

AI review (no-findings)

Reviewing the diff. The PR moves open_input from rustev-cli/src/io.rs to rustev-surface/src/host.rs, re-exports it from io.rs, wires up the Node binding's filesystem host to use it, and marks spec 069 implementation: complete.

Code correctness

open_input logic is byte-for-byte identical to what was in io.rs; rustev-cli re-exports via pub use, so callers (trace.rs, replay.rs, etc.) see no change. open_regular and open_item in live_fs.rs correctly call open_input and then check metadata().is_file() on the handle, matching the CLI pattern. open_item using no_follow=true is the new property (spec 069, 3.2.2); the original store resolver used File::open, which follows symlinks — the change is intentional and tested.

Tests

Both new test functions (open_tests in rustev-surface and a_fifo_reached_by_the_open_is_refused_without_blocking in live_fs) spawn a thread and use a 10 s recv_timeout to detect blocking. On POSIX, O_RDONLY | O_NONBLOCK on a FIFO with no writer returns immediately, so the FIFO opens, is_file() returns false, and the check rejects it — this matches what both tests assert.

The use super::* placed after the first test function in live_fs::tests is valid Rust (items are in scope for the whole module body), just unconventional.

Mutation seeds

The first seed ("a FIFO passes the check before opening and the open blocks") now lists [S+"io.rs", U+"host.rs"] with parallel hunks. The metadata-check hunk stays in io.rs (unchanged there) and the O_NONBLOCK hunk moves to host.rs. The other two seeds simply redirect to U+"host.rs", consistent with the moved function.

Spec / lifecycle

implementation: pending → complete on an approved spec is a standard lifecycle transition. The two new extends entries for Makefile and scripts/acceptance/ correctly declare the additions under spec 001's authority. Spec 069 is added to VERIFIED_SPECS and the node-live acceptance group, consistent with the verify:cli block.

Cargo / dependency graph

libc moves from rustev-cli to rustev-surface (unix-only target dep). Cargo.lock reflects this. rustev-cli no longer imports libc directly, which is correct since the only user was open_input.

No concrete defects found.

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

Subject: 20533f0...bd283dc, diff digest a4b51afc21651338296795892959a48bc36c359025b39c2e6e160b13d81eda8a, 1 call(s). An AI comment is not an approval.

Base automatically changed from spec/069-node-nonblocking-open to main November 8, 2026 19:56
@bartekus
bartekus force-pushed the impl/069-nonblocking-open branch from bd283dc to 3108550 Compare November 8, 2026 19:58
@bartekus
bartekus enabled auto-merge November 8, 2026 19:58
@github-actions

github-actions Bot commented Nov 8, 2026

Copy link
Copy Markdown

AI review (no-findings)

Reviewing the PR against the governance context. The change moves open_input from crates/rustev-cli/src/io.rs to crates/rustev-surface/src/host.rs, wires up the Node binding to use it, and marks spec 069 implementation: complete.

Code correctness

The moved function in host.rs is byte-identical to the removed one in io.rs (only qualified path names differ). The re-export via pub use rustev_surface::host::open_input in io.rs preserves the existing public API for callers in trace.rs and replay.rs.

The libc dependency moves from rustev-cli to rustev-surface (Unix-only target gate), correctly eliminating the now-unused direct dependency from the CLI.

open_regular in live_fs.rs follows the same pattern as the original CLI code: metadata check first, then open_input, then a check on the handle. The error type (IoFail) and the detail string "not a regular file" are consistent with the existing fail() helper.

open_item uses .ok()? which collapses all error cases (including NotFound) to None, matching the caller's pre-existing Resolution::Inaccessible path for any failure after the metadata guard.

Tests

The FIFO tests in both rustev-surface (open_tests) and rustev-node (a_fifo_reached_by_the_open_is_refused_without_blocking) correctly spawn a thread and use a 10-second recv_timeout to detect blocking. Both are gated on #[cfg(unix)]. The use super::* in the live_fs test module appears after the new test function; item ordering does not matter in Rust modules, so open_regular and open_item are in scope.

Boundaries

libc is not Aicortex, Rahi, statecraft-cli or an HTTP stack, so adding it to rustev-surface is within the boundaries rule. The change does not touch rustev-contract or rustev-core.

Spec lifecycle

Spec 069 was already status: approved at the base commit. Changing implementation: pending to complete records implementation completion. The spec's extends additions for Makefile and scripts/acceptance/ match the actual hunks in those files.

Mutation seeds

The first seed now lists [S + "io.rs", U + "host.rs"] (two hunks across two files), correctly reflecting that the metadata check hunk lives in CLI and the O_NONBLOCK flag hunk lives in rustev-surface. The other two seeds are updated from S + "io.rs" to U + "host.rs" where the flag manipulation now resides.

No defects found.

{"head": "31085506f67991508f5262632c34c8333485c5be", "verdict": "no-findings", "findings": []}

Subject: c40b37e...3108550, diff digest a4b51afc21651338296795892959a48bc36c359025b39c2e6e160b13d81eda8a, 1 call(s). An AI comment is not an approval.

@bartekus
bartekus force-pushed the impl/069-nonblocking-open branch from 3108550 to 5032fd3 Compare November 8, 2026 20:07
@bartekus
bartekus changed the base branch from main to deps/069-surface-libc November 8, 2026 20:08
@bartekus
bartekus merged commit 4ce6355 into deps/069-surface-libc Nov 8, 2026
@bartekus
bartekus deleted the impl/069-nonblocking-open branch November 8, 2026 20:08
@bartekus

bartekus commented Nov 8, 2026

Copy link
Copy Markdown
Contributor Author

This pull request was merged into its temporary stacked base deps/069-surface-libc by an auto-merge armed before its base was changed; nothing reached main. The base branch was reset to the dependency-only commit (#575) and the change continues in #576.

@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 spec.

Lifecycle change (specs/069-node-host-nonblocking-open/spec.md): implementation: pending → complete. Per the contract table, approved + complete = settled (no error). The transition is valid and the work described in the implementation record matches the diff.

Code move correctness (crates/rustev-surface/src/host.rs): open_input is moved from crates/rustev-cli/src/io.rs to rustev-surface unchanged. The re-export pub use rustev_surface::host::open_input in io.rs preserves the public API for callers in io.rs, trace.rs, and replay.rs.

open_regular / open_item (integrations/rustev-node/src/live_fs.rs): open_regular calls open_input(..., false) then checks m.is_file() on the handle, correctly returning the IoFail for a non-file. open_item calls open_input(..., true) (O_NOFOLLOW) and returns None for non-files and symlinks. The O_NONBLOCK behavior on a FIFO is correct on Linux: O_RDONLY|O_NONBLOCK opens immediately, and the subsequent is_file() check catches it.

Error propagation in read_classified: The changed path wraps IoFail as ReadFail::File(e), matching what file_fail did previously. No behavior change for callers.

Test placement (live_fs.rs): The new #[cfg(unix)] test appears before use super::*;. In Rust, use statements are order-independent within a module, and child modules have access to private items of their parent, so open_regular and open_item are reachable. No issue.

Mutation seeds: Correctly redirected to rustev-surface/src/host.rs where the implementation now lives. The first seed legitimately names two files because the metadata-check hunk stays in io.rs while the flags hunk moved to host.rs.

extends additions: The two new additive entries for Makefile and scripts/acceptance/ correctly reflect the changed paths. The Cargo.lock entry was already present for the libc dependency.

Verification block: Declared commands match the actual test structure (--lib open_tests, --lib live_fs, -p rustev-cli --locked).

No concrete bugs, security problems, or governance contradictions found.

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

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

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