Skip to content

refactor: Split BedrockResponse and BedrockCommand into Converse and InvokeModel variants - #4235

Merged
amychisholm03 merged 5 commits into
newrelic:mainfrom
amychisholm03:bedrock-refactor
Aug 24, 2026
Merged

refactor: Split BedrockResponse and BedrockCommand into Converse and InvokeModel variants#4235
amychisholm03 merged 5 commits into
newrelic:mainfrom
amychisholm03:bedrock-refactor

Conversation

@amychisholm03

@amychisholm03 amychisholm03 commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

Description

While I was triaging a customer's reported bug with AWS Bedrock, I noticed that the BedrockResponse and BedrockCommand classes have gotten a bit complex and hard to reason about. So I split BedrockResponse into InvokeModelResponse and ConverseResponse and likewise with BedrockCommand. We can deduce which API it is (InvokeModel vs. Converse) when we wrap the Bedrock middleware because we have access to the initial command name there.

How to Test

node --test test/unit/llm-events/aws-bedrock/*.test.js test/unit/subscribers/aws-sdk/*.test.js
npm run versioned aws-sdk-v3

Related Issues

Discovered while researching #4230

@codecov

codecov Bot commented Aug 19, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.45%. Comparing base (c2a01d2) to head (5f961ec).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4235      +/-   ##
==========================================
- Coverage   97.52%   97.45%   -0.07%     
==========================================
  Files         521      525       +4     
  Lines       62972    63174     +202     
  Branches        1        1              
==========================================
+ Hits        61416    61569     +153     
- Misses       1556     1605      +49     
Flag Coverage Δ
integration-tests-cjs-22.x 73.68% <32.43%> (+0.01%) ⬆️
integration-tests-cjs-24.x 74.35% <63.42%> (+0.10%) ⬆️
integration-tests-cjs-26.x 74.35% <63.42%> (+0.10%) ⬆️
integration-tests-esm-22.x 54.50% <25.82%> (+0.02%) ⬆️
integration-tests-esm-24.x 56.12% <63.42%> (+0.17%) ⬆️
integration-tests-esm-26.x 56.12% <63.42%> (+0.17%) ⬆️
unit-tests-22.x 89.23% <98.55%> (+0.07%) ⬆️
unit-tests-24.x 89.18% <98.55%> (+0.07%) ⬆️
unit-tests-26.x 89.18% <98.55%> (+0.07%) ⬆️
versioned-tests-22.x 97.45% <100.00%> (-0.07%) ⬇️
versioned-tests-24.x 97.45% <100.00%> (-0.07%) ⬇️
versioned-tests-26.x 97.45% <100.00%> (-0.07%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@amychisholm03
amychisholm03 marked this pull request as ready for review August 19, 2026 15:23
Comment thread lib/llm-events/aws-bedrock/invoke-model-command.js Outdated
Comment thread lib/llm-events/aws-bedrock/invoke-model-command.js Outdated
Comment thread lib/llm-events/aws-bedrock/invoke-model-command.js Outdated
Comment thread lib/llm-events/aws-bedrock/invoke-model-command.js Outdated
Comment thread lib/subscribers/aws-sdk/middleware/bedrock/utils.js Outdated

@jsumners-nr jsumners-nr 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.

Looks good to me.

@amychisholm03
amychisholm03 merged commit 8235cf5 into newrelic:main Aug 24, 2026
55 of 56 checks passed
@github-project-automation github-project-automation Bot moved this from Needs PR Review to Done: Issues recently completed in Node.js Engineering Board Aug 24, 2026
@amychisholm03
amychisholm03 deleted the bedrock-refactor branch August 24, 2026 16:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done: Issues recently completed

Development

Successfully merging this pull request may close these issues.

3 participants