Skip to content

Reduce redundant filesystem syscalls#31514

Open
charliemarsh-oai wants to merge 1 commit into
mainfrom
charlie/reduce-filesystem-syscalls
Open

Reduce redundant filesystem syscalls#31514
charliemarsh-oai wants to merge 1 commit into
mainfrom
charlie/reduce-filesystem-syscalls

Conversation

@charliemarsh-oai

Copy link
Copy Markdown
Contributor

Summary

  • write atomic file contents through the already-open temporary file instead of reopening its pathname
  • retain directory classification from file-search walking instead of restatting every returned match
  • use symlink metadata first and follow metadata only for symlinks
  • replace existence checks before daemon connections and environment config reads with single operations and error handling
  • cover followed directory symlinks and broken symlinks

Why

Several paths performed redundant filesystem syscalls or split a check from the operation it guarded. Besides extra I/O, reopening the temporary pathname creates a substitution race, and preflight existence checks can go stale before the subsequent operation. Performing the operation directly preserves behavior while avoiding those windows.

The affected crate tests pass, along with scoped Clippy and formatting. The full TUI suite continues to have the two known Guardian feature-flag persistence failures present on main; the focused daemon socket tests pass.

@charliemarsh-oai charliemarsh-oai marked this pull request as ready for review July 8, 2026 02:05
@charliemarsh-oai charliemarsh-oai requested a review from anp-oai July 8, 2026 02:25
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