fix: keep the root barrel edge-safe (1.2.1) - #60
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
1.1.0 added
serveHealthto the root barrel with a staticimport ... from 'node:http'. Next bundlesinstrumentation.tsfor the edge runtime whenever a middleware exists, and both admin and dashboard importlogfrom the root barrel there. On the edge runtimenode:httpdoes not exist, so the middleware chunk throws at module evaluation and every non-/healthrequest 500s. Friday's dependabot bump (^1.0.0->^1.1.0) took admin.agentage.io and dashboard.agentage.io down.What
serve-health.ts: type-only import;createServercomes fromprocess.getBuiltinModule('node:http')insideserveHealth, so the barrel loads anywhere and the builtin is only touched when a worker actually calls it. Node >=22.13 is already the engine floor.test/unit/edge-safe-barrel.test.ts: walks the static import graph fromsrc/index.tsand fails on anynode:builtin the edge runtime lacks (async_hooks and events allow-listed). Guards against the next barrel addition doing this again.Verified
npm run verifygreen: 441 tests, dist/bootstrap/stdio smokes. Follow-up PRs bump admin + dashboard to 1.2.1.