refactor(runtime-host): centralize Node errno error guard - #4933
refactor(runtime-host): centralize Node errno error guard#4933seekskyworld wants to merge 1 commit into
Conversation
Signed-off-by: seekskyworld <djh1813553759@gmail.com>
48492ed to
c6412ed
Compare
Astro-Han
left a comment
There was a problem hiding this comment.
I reviewed this PR at head c6412ed6 (5 files, +61/−14) against base 2310035a.
What the change does: adds one Runtime Host-local isNodeError type predicate (node-error.ts, error is NodeJS.ErrnoException) preserving the conservative Error-only, exact-errno semantics, and migrates the three modules that previously defined the same guard locally: control/endpoint.ts, operator/managed-deployment.ts, and peer-reachability/publisher.ts. I grepped the package to confirm all three local definitions are removed and the imports are unified.
Behavior note: endpoint.ts previously returned a plain boolean and cast internally; the shared version is a type predicate, so call sites now narrow instead of casting — strictly tighter typing with no behavior change (CI typecheck passes on this exact head). managed-deployment.ts and publisher.ts had the type-predicate form already, so those are byte-equivalent moves.
Scope: #4928 explicitly keeps the control registration/startup and peer-mesh modules out of this PR (they are covered by an active Windows durability change), so the partial consolidation is by design. One recorded P3: four same-named local isNodeError functions remain in the same package (two of them the boolean variant the issue's motivation calls out); they should be folded into the shared guard in a follow-up once the Windows change lands.
Gates: CI on this exact head is green (test and windows_recovery); the earlier red on the superseded head was eliminated by the rewrite and is not attributable; no protocol or epoch files are touched; no review is bound to the current head.
Not verified: I did not run the suites locally (CI on the exact head covers the Runtime Host suite; the author reports 16 passed, 1 platform skip).
No P0–P2 findings. This is a refactor; I am not approving — the merge decision belongs to humans.
Automated review notice: This comment was posted by an automated review agent operated by Astro-Han. It is not an independent human review and does not replace one.
Fixes #4928
Summary
isNodeErrortype predicateMotivation
The same Node errno guard was duplicated across Runtime Host modules, with inconsistent return typing. A shared predicate keeps filesystem error handling auditable while preserving each module's conservative behavior.
Validation