refactor(lambda): collapse runtime/ritm.js into index.js#8397
Merged
Conversation
\`registerLambdaHook\` lived in \`runtime/ritm.js\` while the single bootstrap caller — \`src/lambda/index.js\` — was a one-line forwarder. Three underscore-prefixed helpers (\`_extractModuleRootAndHandler\`, \`_extractModuleNameAndHandlerPath\`, \`_getLambdaFilePaths\`) were exported only so the spec could reach them; both \`runtime/ritm.js\` and \`runtime/patch.js\` carried the same logic in two places. The helpers move to a shared \`src/lambda/handler-paths.js\` so \`index.js\` and \`runtime/patch.js\` stop duplicating them. The underscore prefixes drop along with their export. \`DD_TRACE_DISABLED_INSTRUMENTATIONS\` gates \`registerLambdaHook\` at the bootstrap entry rather than from inside the hook callback; the env is read once at module load, the same shape every other integration uses. The spec rewrites to a black-box test of \`registerLambdaHook\` through a Hook spy injected by \`proxyquire\`, covering the four env permutations the production code branches on plus the inner Hook-callback paths.
Contributor
Overall package sizeSelf size: 5.82 MB Dependency sizes| name | version | self size | total size | |------|---------|-----------|------------| | import-in-the-middle | 3.0.1 | 82.56 kB | 817.39 kB | | dc-polyfill | 0.1.11 | 25.74 kB | 25.74 kB |🤖 This report was automatically generated by heaviest-objects-in-the-universe |
|
✨ Fix all issues with BitsAI or with Cursor
|
BenchmarksBenchmark execution time: 2026-05-11 20:06:03 Comparing candidate commit eb47c57 in PR branch Found 0 performance improvements and 0 performance regressions! Performance is the same for 1736 metrics, 108 unstable metrics. |
tlhunter
previously approved these changes
May 11, 2026
tlhunter
approved these changes
May 11, 2026
Merged
rochdev
pushed a commit
that referenced
this pull request
May 13, 2026
* refactor(lambda): collapse runtime/ritm.js into index.js \`registerLambdaHook\` lived in \`runtime/ritm.js\` while the single bootstrap caller — \`src/lambda/index.js\` — was a one-line forwarder. Three underscore-prefixed helpers (\`_extractModuleRootAndHandler\`, \`_extractModuleNameAndHandlerPath\`, \`_getLambdaFilePaths\`) were exported only so the spec could reach them; both \`runtime/ritm.js\` and \`runtime/patch.js\` carried the same logic in two places. The helpers move to a shared \`src/lambda/handler-paths.js\` so \`index.js\` and \`runtime/patch.js\` stop duplicating them. The underscore prefixes drop along with their export. \`DD_TRACE_DISABLED_INSTRUMENTATIONS\` gates \`registerLambdaHook\` at the bootstrap entry rather than from inside the hook callback; the env is read once at module load, the same shape every other integration uses. The spec rewrites to a black-box test of \`registerLambdaHook\` through a Hook spy injected by \`proxyquire\`, covering the four env permutations the production code branches on plus the inner Hook-callback paths.
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.
Summary
`registerLambdaHook` lived in `src/lambda/runtime/ritm.js` while the single bootstrap caller (`src/lambda/index.js`) was a one-line forwarder. Three underscore-prefixed helpers (`_extractModuleRootAndHandler`, `_extractModuleNameAndHandlerPath`, `_getLambdaFilePaths`) were exported only so the spec could reach them; both `runtime/ritm.js` and `runtime/patch.js` carried the same logic in two places.
The helpers move to a shared `src/lambda/handler-paths.js` so `index.js` and `runtime/patch.js` stop duplicating them. The underscore prefixes drop along with their export. `DD_TRACE_DISABLED_INSTRUMENTATIONS` gates `registerLambdaHook` at the bootstrap entry rather than from inside the hook callback; the env is read once at module load, the same shape every other integration uses. The spec rewrites to a black-box test of `registerLambdaHook` through a Hook spy injected by `proxyquire`, covering the four env permutations the production code branches on plus the inner Hook-callback paths (handler key wrap, datadog-lambda-js wrap, hook-error logging on both branches).
Test plan