Skip to content

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

Open
seekskyworld wants to merge 1 commit into
apache:mainfrom
seekskyworld:refactor/4928-runtime-host-node-error
Open

refactor(runtime-host): centralize Node errno error guard#4933
seekskyworld wants to merge 1 commit into
apache:mainfrom
seekskyworld:refactor/4928-runtime-host-node-error

Conversation

@seekskyworld

Copy link
Copy Markdown
Contributor

Fixes #4928

Summary

  • add a Runtime Host-local isNodeError type predicate
  • migrate control endpoint, managed deployment, and peer reachability publisher
  • preserve Error-only, exact errno matching for ENOENT, EPERM, and other codes
  • add focused narrowing and mismatch regression coverage

Motivation

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

  • npm --workspace @maka/core run build
  • npm --workspace @maka/storage run build
  • npm --workspace @maka/mcp run build
  • npm --workspace @maka/runtime run build
  • npm --workspace @maka/runtime-host run build
  • node --test packages/runtime-host/dist/tests/node-error.test.js packages/runtime-host/dist/tests/control-endpoint.test.js packages/runtime-host/dist/tests/managed-activation.test.js packages/runtime-host/dist/tests/peer-reachability.test.js (16 passed, 1 platform skip)
  • npx biome check on changed Runtime Host sources and tests

@github-actions github-actions Bot added the effort/S Under 100 readable lines label Sep 6, 2026
Signed-off-by: seekskyworld <djh1813553759@gmail.com>
@seekskyworld
seekskyworld force-pushed the refactor/4928-runtime-host-node-error branch from 48492ed to c6412ed Compare September 6, 2026 19:24

@Astro-Han Astro-Han left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

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

Labels

effort/S Under 100 readable lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

2 participants