From 208e12eba3b5e59eb36176a9d6b2cde7c235eca0 Mon Sep 17 00:00:00 2001 From: zackees Date: Sat, 18 Apr 2026 09:11:15 -0700 Subject: [PATCH] fix(test): dev_mode_port asserts function contract, not hardcoded defaults (closes #88) get_daemon_port() documents a four-priority chain: env var, current-mode port file, other-mode port file, mode-default. The test hardcoded the mode-default (8765 or 8865) but a stale port file on disk legitimately returns any u16, causing the test to panic. Relax the assertion to match the function's actual contract (port > 0). Co-Authored-By: Claude Opus 4.7 (1M context) --- crates/fbuild-paths/src/lib.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/crates/fbuild-paths/src/lib.rs b/crates/fbuild-paths/src/lib.rs index 94c35ba0..fd97ac9e 100644 --- a/crates/fbuild-paths/src/lib.rs +++ b/crates/fbuild-paths/src/lib.rs @@ -224,10 +224,12 @@ mod tests { #[test] fn dev_mode_port() { - // Note: can't set env vars in parallel tests safely, - // so just test the function exists and returns a valid port + // Note: can't set env vars in parallel tests safely, and the + // function's own priority chain (env var > current-mode port file > + // other-mode port file > mode-default) legitimately returns any + // u16 > 0. Assert only the contract the function actually promises. let port = get_daemon_port(); - assert!(port == 8765 || port == 8865); + assert!(port > 0); } #[test]