Skip to content

refactor(runtime-host): centralize Node errno error guard #4928

Description

@seekskyworld

Problem

Runtime Host currently defines the same isNodeError(error, code) guard in several independent modules. The copies are byte-level duplicates today, but some use a type predicate while others return boolean; the drift makes error handling harder to audit and encourages ad-hoc casts at filesystem boundaries.

Scope

  • Add one Runtime Host-local Node errno guard with the existing conservative Error and exact-code semantics.
  • Migrate control/endpoint.ts, operator/managed-deployment.ts, and peer-reachability/publisher.ts.
  • Keep the control registration/startup and peer-mesh modules out of this PR because they are covered by an active Windows durability change.

Acceptance criteria

  • The migrated modules have no local duplicate guard and preserve their current type narrowing and behavior for ENOENT, EPERM, and other codes.
  • Non-Error values and mismatched codes continue to return false.
  • A focused unit test pins the shared guard's type-predicate behavior.

This follows the parallel-helper finding in the repository audit and is intentionally limited to files without an active PR conflict.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions