fix(cli): honor port 0 in checkPortAvailable#1304
fix(cli): honor port 0 in checkPortAvailable#1304ChunkyMonkey11 wants to merge 4 commits intoNVIDIA:mainfrom
Conversation
📝 WalkthroughWalkthroughThe Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~2 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
|
@cv I fixed the PR issue and this should be good now. Updated the PR body sign-off format, and checks are now passing on my side (npx prek run --all-files, npm test, make docs). Please take another look when you have a moment. |
Summary
This PR fixes a bug in CLI preflight port handling by preserving
port = 0instead of incorrectly defaulting it to18789.In Node.js networking,
0is a valid value that asks the OS to assign a temporary available port.The fix changes null/default logic to keep valid explicit inputs while still applying the default when no port is provided.
Changes
checkPortAvailableinsrc/lib/preflight.ts:const p = port || 18789;const p = port ?? 18789;undefined/null-> default187890-> stays0(valid OS-assigned temporary available port request)Type of Change
Testing
npx prek run --all-filespasses (or equivalentlymake check).npm testpasses.make docsbuilds without warnings. (for doc-only changes)Checklist
General
Code Changes
npx prek run --all-filesauto-fixes formatting (ormake formatfor targeted runs).Doc Changes
update-docsagent skill to draft changes while complying with the style guide. For example, prompt your agent with "/update-docscatch up the docs for the new changes I made in this PR."Signed-off-by: Revant Patel revant.h.patel@gmail.com
Summary by CodeRabbit