Convert bootstrap socket helper to TypeScript#28377
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (4)
💤 Files with no reviewable changes (1)
🚧 Files skipped from review as they are similar to previous changes (3)
WalkthroughThis PR converts the 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@ghost/core/core/server/lib/bootstrap-socket.ts`:
- Line 27: The guard in bootstrap-socket.ts currently treats falsy JsonValue
messages as invalid by using "!message"; update the condition to only reject an
absent message by replacing the "!message" check with an explicit undefined
check (e.g., "message === undefined") so that valid falsy JsonValue values like
0, false, and '' are accepted; keep the other checks
(hasSocketAddress(socketAddress), logging, logging.info, logging.warn) unchanged
and only alter the message portion of the if condition.
- Around line 20-23: hasSocketAddress currently treats any truthy numeric port
as valid so negative or >65535 values slip through; update the predicate
(hasSocketAddress) to validate that socketAddress.port is an integer within the
TCP port range 1..65535 (e.g., Number.isInteger(socketAddress.port) &&
socketAddress.port >= 1 && socketAddress.port <= 65535) while keeping the
existing checks for host string; this ensures callers like client.connect only
receive valid ports.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: bfa4a6d3-2b20-4e85-8e5d-a7e91b8c240c
📒 Files selected for processing (4)
ghost/core/core/server/lib/bootstrap-socket.tsghost/core/test/unit/server/lib/bootstrap-socket.test.jsghost/core/test/unit/server/lib/bootstrap-socket.test.tsghost/core/test/unit/server/notify.test.js
💤 Files with no reviewable changes (1)
- ghost/core/test/unit/server/lib/bootstrap-socket.test.js
no ref This change should have no user impact.
527f7e4 to
1206096
Compare
no ref
This change should have no user impact.