Repository navigation
Description
Timing: Follow-up after trial/3 merges into main; defer implementation until then.
Review baseline: Local trial/3 at a094418baf6388e3eeca23821df481a7f0a8751c. This branch is not yet on the remote. Source locations below refer to that snapshot and should be rechecked after merge.
Problem
The public read_source convenience helper bypasses file-type validation performed by ProjectLoader. The same source path therefore has materially different behavior depending on the API used: one rejects a special file while the other can block opening it.
Evidence and reproduction
crates/idea/idea-transformer/src/lib.rs:94-103:read_sourceopens the supplied path directly.crates/idea/idea-transformer/src/source/native.rs:108-113:ProjectLoader::loadrejects special files before opening.- A controlled Unix probe passed the same FIFO to both APIs.
ProjectLoaderreturnedschema source is not a regular file;read_sourceblocked until a 2-second watchdog terminated its process.
Acceptance criteria
- Establish consistent supported-file and bounded-acquisition policy for source-reading entry points.
- Reject unsupported special files before potentially blocking open/read operations, and retain post-open validation where needed.
- Preserve intended path/symlink semantics, finite byte ceilings, UTF-8 validation, and retained IO causes.
- Verify FIFO/device and regular-file cases using bounded, platform-appropriate checks.
- Review the bootstrap reader as a related entry point while keeping this issue focused on source API consistency.
Code examples and suggested direction
A basic cooperative-filesystem guard would look like this:
fn open_regular(path: &std::path::Path) -> std::io::Result<std::fs::File> {
if !std::fs::metadata(path)?.is_file() {
return Err(std::io::Error::other("source is not a regular file"));
}
let file = std::fs::File::open(path)?;
if !file.metadata()?.is_file() {
return Err(std::io::Error::other("opened source is not a regular file"));
}
Ok(file)
}This is only a baseline sketch. A path can be replaced between metadata and open, so these checks do not establish race-free acquisition. Investigate supported platform-specific nonblocking/open-handle options if concurrent replacement is in scope. Preserve each caller's intended symlink policy.
Activity
cblanquera commentedon Oct 26, 2026
Suggested investigation and fix notes
Deferred until
trial/3is merged intomain. Recheck the merged source and tests first. The snippets are examples/proposals, not an approved patch or a change to frozen contracts.read_source,ProjectLoader::load/read, the CLI bootstrap reader, and the output writer'sread_regular. Identify shared acquisition rules without mixing source-resolution policy with output ownership policy.unsafe_code = forbid; assess safe platform APIs rather than inserting unchecked native calls.cfggates and platform equivalents where available; do not run an unbounded open in the main test process.Useful regular-file boundary example, using current APIs:
Extend
tests/source_loaders.rsand coordinate bootstrap cases with #8. Start withcargo test -p stackpress-idea-transformer --test source_loaders --locked. Document any remaining filesystem-race or stalled-storage limitations honestly.Implementation workflow: After the merge, follow
.agents/workflows/rust-programming.md: prove the affected behavior, complete the three test-verified review rounds, and record relevant formatting/lints/docs, feature/platform scope, and applicable development coverage. Preserve unrelated changes.cblanquera commentedon Oct 26, 2026
Fixed on
trial/3in 407b4d6 + df443b7 (merged as ff7a251, task 00010 lane 2; not yet onmain, so leaving open).read_sourcenow applies the same special-file policy asProjectLoader; FIFOs and devices are rejected before a potentially blocking open, with post-open validation retained.Coordinator-verified on the combined code: fmt, Clippy -D warnings, Rustdoc -D warnings,
cargo +1.96.0 check, 466 workspace tests and 857 doctests pass (467 tests on mergedtrial/3). Coverage: server 91.61%, CLI 93.15%, transformer 93.62%.Fix owner review issues #10, #3, #8, #9, #13, #12 and host parts of #4,