chore: review-round hygiene (unsafe SAFETY notes, Python resource/exit)#3
Merged
Conversation
Whole-repo review fixes independent of any feature: - boot/init sys.rs: add SAFETY invariant comments on the 7 libc unsafe blocks. - python sandbox.py __exit__: surface a real release failure on a clean block instead of always suppressing it (matches close()/Pty/PortConn/the Go SDK). - python conn.py dial_agent: close the makefile reader on the error path so the socket fd is released.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Review-round hygiene
Small whole-repo fixes surfaced by the batch-end review round, independent of any feature.
boot/init
sys.rsAdd
// SAFETY:invariant comments to the 7 libcunsafeblocks (mount, sethostname, chroot, execve, claim_console, execv, sync/reboot), matching the crate's own convention (silkd/src/sysutil.rs). Comment-only; no behaviour change.python
sandbox.py__exit__Sandbox.__exit__unconditionally suppressed every exception fromclose(), sowith client.new() as sb:could never learn that a genuine release failed (auth expired, node down, quota). Now it surfaces a real release failure on a clean block and only suppresses while already unwinding another exception — matchingclose()'s own contract (it propagates non-404),Pty.__exit__/PortConn.__exit__, and the Go SDK.python
conn.pydial_agentOn the error path,
sock.makefile("rb")incremented the socket's internal ref, sosock.close()alone left the fd lingering. Close the reader too when it was created.Gates
cargo fmt --check+clippy -D warningsclean (mac + a rust:1 Linux container);ruff checkclean and 101 pytest pass.