Skip to main content

project_socket_path

Function project_socket_path 

Source
pub fn project_socket_path(shared: &Path, project: Option<&Path>) -> PathBuf
Expand description

The socket a daemon serving project binds when the shared socket is held by a daemon serving a different project (#4600).

Why: one shared socket per user meant a second project could not run at all — its TUI refused the first project’s daemon (correctly, #4512) and had nowhere else to start its own. A per-project sibling gives each project a home while the first daemon keeps the shared path trusty-code-gui dials. What: <shared dir>/<shared stem>-<key>.sock, where key is the first 12 hex digits of SHA-256 over the canonical project root, or projectless. Deterministic, so every client and the daemon itself derive the same path with nothing recorded on disk. A collision is not trusted: clients still check the binding the daemon reports before attaching. 12 digits keep the path inside macOS’ 104-byte sun_path under a temp data directory. Test: uds_tests::project_socket_path_is_per_project_and_stable.