Preserve PortScanner probe defects#3282
Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
ApprovabilityVerdict: Approved Straightforward bug fix that replaces overly broad error catching with specific error types, allowing defects and interruptions to properly propagate instead of being silently swallowed. Well-tested and self-contained to PortScanner error handling. You can customize Macroscope's approvability policy. Learn more. |
Co-authored-by: codex <codex@users.noreply.github.com>
0f7a5a8 to
ac9be89
Compare
Dismissing prior approval to re-evaluate ac9be89
Summary
Validation
vp test apps/server/src/preview/PortScanner.test.tsvp checkvp run typecheckNote
Low Risk
Localized preview port-scan error handling with clearer failure semantics; no auth, data, or security surface changes.
Overview
Port discovery no longer treats every process-probe failure the same:
lsof/ Windows listener probes used a broadcatchCausethat turned any failure (including defects and cancellation) into a silent fallback to common-port scanning.They now
catchTagsonly the expectedProcessRunnerfailures (ProcessSpawnError, stdin/output/read/timeout errors). Those paths log debug context (probe name, platform, error) viarecoverProcessProbeFailureand still fall back to common-port probes. Defects and interruptions propagate instead of being swallowed.Tests add
makeProbeFailureLayerand assertscan()fails with dies/interrupts-only causes when the injected probe does.Reviewed by Cursor Bugbot for commit ac9be89. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Preserve PortScanner probe defects and interruptions instead of swallowing them
catchCausehandlers inPortScanner.tswith targetedcatchTagscovering only specific process failures (ProcessSpawnError,ProcessStdinError,ProcessOutputLimitError,ProcessReadError,ProcessTimeoutError).recoverProcessProbeFailurehelper that logs a debug message (with probe type, platform, and error) before returningnullto trigger fallback to common-port probing.PortScanner.test.tsverifying that defects and interruptions from process probes are preserved in the failure cause.PortDiscovery.scansucceeding despite probe defects or interruptions will now see those failures propagate.Macroscope summarized ac9be89.