10000 ENG-532 Don't include req headers on CW errors by leite08 · Pull Request #4092 · metriport/metriport · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

ENG-532 Don't include req headers on CW errors #4092

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: develop
Choose a base branch
from

Conversation

leite08
Copy link
Member
@leite08 leite08 commented Jun 25, 2025

Dependencies

none

Description

Don't include req headers on CW errors.

Testing

  • Local
    • none
  • Staging
    • CW DQ works
  • Sandbox
    • none
  • Production
    • none

Release Plan

  • Release NPM packages
  • Merge this

Summary by CodeRabbit

  • New Features

    • Released new alpha versions for multiple packages, including updates to dependencies across the platform.
  • Refactor

    • Improved error reporting details for document queries by simplifying error context.
    • Enhanced error logging consistency in document processing.
  • Chores

    • Updated and reorganized package metadata and dependency orderings for improved maintainability.
    • Made minor formatting adjustments to package files.

Copy link
linear bot commented Jun 25, 2025

Copy link
coderabbitai bot commented Jun 25, 2025

Walkthrough

This update primarily consists of version bumps to alpha releases across multiple package.json files in the repository, along with minor dependency version updates and reordering of devDependencies. Additionally, there are small internal refactors and error reporting adjustments in the CommonWell document query logic, but no changes to public APIs or exported entities.

Changes

File(s) Change Summary
packages/api-sdk/package.json
packages/api/package.json
packages/carequality-cert-runner/package.json
packages/carequality-sdk/package.json
packages/commonwell-cert-runner/package.json
packages/commonwell-jwt-maker/package.json
packages/commonwell-sdk/package.json
packages/core/package.json
packages/ihe-gateway-sdk/package.json
packages/infra/package.json
packages/mllp-server/package.json
packages/shared/package.json
packages/utils/package.json
packages/eslint-rules/package.json
Bumped package versions to new alpha releases; updated some dependency versions to corresponding alpha versions; reordered some devDependencies for consistency.
package.json Moved packages/eslint-rules in the workspaces array from end to start.
packages/api/src/external/commonwell/document/document-query.ts Refactored inline arrow functions to named functions; replaced capture.message with capture.error and ensured error details are stringified; reordered imports. No logic or API changes.
packages/commonwell-sdk/src/client/document.ts Modified error context: replaced HTTP headers with constructed URL in additionalInfo for error reporting.

Sequence Diagram(s)

sequenceDiagram
    participant Client
    participant DocumentQuery
    participant ErrorCapture

    Client->>DocumentQuery: Initiate document query
    alt Error occurs during query
        DocumentQuery->>ErrorCapture: capture.error(errorToString(error), { patientId, url })
    end
    DocumentQuery-->>Client: Return result or error
Loading

Possibly related PRs

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

npm error code ERR_SSL_WRONG_VERSION_NUMBER
npm error errno ERR_SSL_WRONG_VERSION_NUMBER
npm error request to https://10.0.0.28:4873/punycode/-/punycode-2.3.1.tgz failed, reason: C0DCA9850C7F0000:error:0A00010B:SSL routines:ssl3_get_record:wrong version number:../deps/openssl/openssl/ssl/record/ssl3_record.c:354:
npm error
npm error A complete log of this run can be found in: /.npm/_logs/2025-06-25T21_39_13_828Z-debug-0.log


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3d464db and 609cc38.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (17)
  • package.json (2 hunks)
  • packages/api-sdk/package.json (2 hunks)
  • packages/api/package.json (1 hunks)
  • packages/api/src/external/commonwell/document/document-query.ts (9 hunks)
  • packages/carequality-cert-runner/package.json (2 hunk 8000 s)
  • packages/carequality-sdk/package.json (1 hunks)
  • packages/commonwell-cert-runner/package.json (2 hunks)
  • packages/commonwell-jwt-maker/package.json (2 hunks)
  • packages/commonwell-sdk/package.json (2 hunks)
  • packages/commonwell-sdk/src/client/document.ts (5 hunks)
  • packages/core/package.json (2 hunks)
  • packages/eslint-rules/package.json (1 hunks)
  • packages/ihe-gateway-sdk/package.json (2 hunks)
  • packages/infra/package.json (1 hunks)
  • packages/mllp-server/package.json (2 hunks)
  • packages/shared/package.json (3 hunks)
  • packages/utils/package.json (1 hunks)
✅ Files skipped from review due to trivial changes (2)
  • packages/carequality-sdk/package.json
  • packages/ihe-gateway-sdk/package.json
🚧 Files skipped from review as they are similar to previous changes (15)
  • packages/mllp-server/package.json
  • packages/infra/package.json
  • packages/api/package.json
  • packages/utils/package.json
  • packages/shared/package.json
  • packages/commonwell-sdk/package.json
  • package.json
  • packages/core/package.json
  • packages/commonwell-cert-runner/package.json
  • packages/commonwell-jwt-maker/package.json
  • packages/carequality-cert-runner/package.json
  • packages/eslint-rules/package.json
  • packages/api/src/external/commonwell/document/document-query.ts
  • packages/commonwell-sdk/src/client/document.ts
  • packages/api-sdk/package.json
⏰ Context from checks skipped due to timeout of 90000ms (14)
  • GitHub Check: check-pr / lint-build-test
  • GitHub Check: check-pr / lint-build-test
  • GitHub Check: check-pr / lint-build-test
  • GitHub Check: check-pr / lint-build-test
  • GitHub Check: check-pr / lint-build-test
  • GitHub Check: check-pr / lint-build-test
  • GitHub Check: check-pr / lint-build-test
  • GitHub Check: check-pr / lint-build-test
  • GitHub Check: check-pr / lint-build-test
  • GitHub Check: check-pr / lint-build-test
  • GitHub Check: check-pr / lint-build-test
  • GitHub Check: check-pr / lint-build-test
  • GitHub Check: check-pr / lint-build-test
  • GitHub Check: Analyze (javascript)
✨ Finishing Touches
  • 📝 Generate Docstrings

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@leite08 leite08 force-pushed the eng-532-dont-send-cw-headers-to-sentry branch from 972fc59 to be0b530 Compare June 25, 2025 18:25
@@ -22,7 +22,7 @@ async function initQuery(
throw new Error(`Could not determine subject ID for document query`);
}
const url = `${CommonWell.DOCUMENT_QUERY_ENDPOINT}?subject.id=${subjectId}`;
const additionalInfo = { headers, patientId };
const additionalInfo = { patientId, url };
Copy link
Member Author

Choose a reason for hiding this comment

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

The main change to prevent the headers on Errors/Sentry

Copy link
Member Author

Choose a reason for hiding this comment

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

auto-formatted by lerna, it was not formatted properly before

@leite08 leite08 marked this pull request as ready for review June 25, 2025 18:31
Copy link
@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🔭 Outside diff range comments (1)
packages/commonwell-sdk/src/client/document.ts (1)

43-47: Consider removing headers from all error contexts for consistency.

While the initQuery function no longer includes headers in error context, the query, queryFull, and retrieve functions still include headers in their error handling. For consistency with the PR objective of not including request headers on CW errors, consider removing headers from all error contexts in this file.

Apply this pattern to maintain consistency:

    throw new CommonwellError(`Error parsing document query response`, err, {
-     headers,
      patientId,
      response,
    });
    throw new CommonwellError(`Error retrieve document`, err, {
-     headers,
      inputUrl,
      outputStream: outputStream ? "[object]" : outputStream,
    });

Also applies to: 60-64, 82-86

♻️ Duplicate comments (1)
packages/commonwell-sdk/src/client/document.ts (1)

25-25: Headers removed from error context improves security.

This change prevents potentially sensitive request headers from being logged to CloudWatch/Sentry while maintaining debugging context through the URL and patient ID.

🧹 Nitpick comments (6)
packages/api/package.json (1)

3-3: API package pre-release bump looks fine

Just the version field updated. Because this package is consumed by external clients, be sure to:

  • Publish with the next tag, not latest.
  • Update release notes to call out the CloudWatch header-stripping change, as that is the semantic change users will notice.
packages/commonwell-cert-runner/package.json (1)

45-45: Caret range with pre-release can unintentionally resolve to the final GA

"@metriport/commonwell-sdk": "^5.9.10-alpha.0" allows npm to pick up any 5.x including stable 5.9.10 once published.
If you want to stay on alpha only until it is validated, lock it exactly:

-    "@metriport/commonwell-sdk": "^5.9.10-alpha.0",
+    "@metriport/commonwell-sdk": "5.9.10-alpha.0",
packages/commonwell-sdk/package.json (1)

63-63: Propagate shared alpha dependency precisely

Same note as above – a caret on a prerelease may float to an unwanted stable version. Consider pinning:

-    "@metriport/shared": "^0.23.10-alpha.0",
+    "@metriport/shared": "0.23.10-alpha.0",
packages/ihe-gateway-sdk/package.json (1)

56-56: Lock shared prerelease to avoid accidental GA upgrade

Same caret-range caution applies here.

-    "@metriport/shared": "^0.23.10-alpha.0",
+    "@metriport/shared": "0.23.10-alpha.0",
packages/shared/package.json (2)

106-106: devDependencies reorder is harmless but breaks alphabetical intent

Moving @metriport/eslint-rules upward is stylistic. Consider adding sort-package-json or a lint-rule to enforce ordering automatically to avoid noisy diffs.


117-117: Unify TypeScript compiler version across packages

Still pinned to 4.9.5 while some packages now use 5.6.3. Decide on one compiler level repo-wide to prevent subtle type-level incompatibilities.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 44c74e9 and 3d464db.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (17)
  • package.json (2 hunks)
  • packages/api-sdk/package.json (2 hunks)
  • packages/api/package.json (1 hunks)
  • packages/api/src/external/commonwell/document/document-query.ts (9 hunks)
  • packages/carequality-cert-runner/package.json (2 hunks)
  • packages/carequality-sdk/package.json (1 hunks)
  • packages/commonwell-cert-runner/package.json (2 hunks)
  • packages/commonwell-jwt-maker/package.json (2 hunks)
  • packages/commonwell-sdk/package.json (2 hunks)
  • packages/commonwell-sdk/src/client/document.ts (1 hunks)
  • packages/core/package.json (2 hunks)
  • packages/eslint-rules/package.json (1 hunks)
  • packages/ihe-gateway-sdk/package.json (2 hunks)
  • packages/infra/package.json (1 hunks)
  • packages/mllp-server/package.json (2 hunks)
  • packages/shared/package.json (3 hunks)
  • packages/utils/package.json (1 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
`**/*`: Use eslint to enforce code style Use prettier to format code Max column ...

**/*: Use eslint to enforce code style
Use prettier to format code
Max column length is 100 chars
Multi-line comments use /** */
Top-level comments go after the import (save pre-import to basic file header, like license)
Move literals to constants declared after imports when possible
File names: kebab-case

📄 Source: CodeRabbit Inference Engine (.cursorrules)

List of files the instruction was applied to:

  • packages/carequality-sdk/package.json
  • packages/infra/package.json
  • packages/api/package.json
  • package.json
  • packages/utils/package.json
  • packages/mllp-server/package.json
  • packages/commonwell-sdk/package.json
  • packages/commonwell-jwt-maker/package.json
  • packages/commonwell-cert-runner/package.json
  • packages/commonwell-sdk/src/client/document.ts
  • packages/ihe-gateway-sdk/package.json
  • packages/carequality-cert-runner/package.json
  • packages/eslint-rules/package.json
  • packages/core/package.json
  • packages/api-sdk/package.json
  • packages/shared/package.json
  • packages/api/src/external/commonwell/document/document-query.ts
`**/*.ts`: - Use the Onion Pattern to organize a package's code in layers - Try ...

**/*.ts: - Use the Onion Pattern to organize a package's code in layers

  • Try to use immutable code and avoid sharing state across different functions, objects, and systems
  • Try to build code that's idempotent whenever possible
  • Prefer functional programming style functions: small, deterministic, 1 input, 1 output
  • Minimize coupling / dependencies
  • Avoid modifying objects received as parameter
  • Only add comments to code to explain why something was done, not how it works
  • Naming
    • classes, enums: PascalCase
    • constants, variables, functions: camelCase
    • file names: kebab-case
    • table and column names: snake_case
    • Use meaningful names, so whoever is reading the code understands what it means
    • Don’t use negative names, like notEnabled, prefer isDisabled
    • For numeric values, if the type doesn’t convey the unit, add the unit to the name
  • Typescript
    • Use types
    • Prefer const instead of let
    • Avoid any and casting from any to other types
    • Type predicates: only applicable to narrow down the type, not to force a complete type conversion
    • Prefer deconstructing parameters for functions instead of multiple parameters that might be of
      the same type
    • Don’t use null inside the app, only on code interacting with external interfaces/services,
      like DB and HTTP; convert to undefined before sending inwards into the code
    • Use async/await instead of .then()
    • Use the strict equality operator ===, don’t use abstract equality operator ==
    • When calling a Promise-returning function asynchronously (i.e., not awaiting), use .catch() to
      handle errors (see processAsyncError and emptyFunction depending on the case)
    • Date and Time
      • Always use buildDayjs() to create dayjs instances
      • Prefer dayjs.duration(...) to create duration consts and keep them as duration
  • Prefer Nullish Coalesce (??) than the OR operator (||) to provide a default value
  • Avoid creating arrow functions
  • Use truthy syntax instead of in - i.e., if (data.link) not if ('link' in data)
  • Error handling
    • Pass the original error as the new one’s cause so the stack trace is persisted
    • Error messages should have a static message - add dynamic data to MetriportError's additionalInfo prop
    • Avoid sending multiple events to Sentry for a single error
  • Global constants and variables
    • Move literals to constants declared after imports when possible (avoid magic numbers)
    • Avoid shared, global objects
  • Avoid using console.log and console.error in packages other than utils, infra and shared,
    and try to use out().log instead
  • Avoid multi-line logs
    • don't send objects as a second parameter to console.log() or out().log()
    • don't create multi-line strings when using JSON.stringify()
  • Use eslint to enforce code style
  • Use prettier to format code
  • max column length is 100 chars
  • multi-line comments use /** */
  • scripts: top-level comments go after the import

⚙️ Source: CodeRabbit Configuration File

List of files the instruction was applied to:

  • packages/commonwell-sdk/src/client/document.ts
  • packages/api/src/external/commonwell/document/document-query.ts
🧠 Learnings (5)
packages/commonwell-sdk/package.json (1)
Learnt from: leite08
PR: metriport/metriport#3463
File: packages/api-sdk/src/medical/models/patient.ts:1-1
Timestamp: 2025-03-19T13:58:17.253Z
Learning: When changes are made to SDK packages (`api-sdk`, `commonwell-sdk`, `carequality-sdk`) or `packages/shared` in the Metriport codebase, alpha versions need to be published to NPM before merging the PR.
packages/commonwell-jwt-maker/package.json (1)
Learnt from: leite08
PR: metriport/metriport#3463
File: packages/api-sdk/src/medical/models/patient.ts:1-1
Timestamp: 2025-03-19T13:58:17.253Z
Learning: When changes are made to SDK packages (`api-sdk`, `commonwell-sdk`, `carequality-sdk`) or `packages/shared` in the Metriport codebase, alpha versions need to be published to NPM before merging the PR.
packages/ihe-gateway-sdk/package.json (1)
Learnt from: leite08
PR: metriport/metriport#3463
File: packages/api-sdk/src/medical/models/patient.ts:1-1
Timestamp: 2025-03-19T13:58:17.253Z
Learning: When changes are made to SDK packages (`api-sdk`, `commonwell-sdk`, `carequality-sdk`) or `packages/shared` in the Metriport codebase, alpha versions need to be published to NPM before merging the PR.
packages/carequality-cert-runner/package.json (1)
Learnt from: leite08
PR: metriport/metriport#3463
File: packages/api-sdk/src/medical/models/patient.ts:1-1
Timestamp: 2025-03-19T13:58:17.253Z
Learning: When changes are made to SDK packages (`api-sdk`, `commonwell-sdk`, `carequality-sdk`) or `packages/shared` in the Metriport codebase, alpha versions need to be published to NPM before merging the PR.
packages/api-sdk/package.json (1)
Learnt from: leite08
PR: metriport/metriport#3463
File: packages/api-sdk/src/medical/models/patient.ts:1-1
Timestamp: 2025-03-19T13:58:17.253Z
Learning: When changes are made to SDK packages (`api-sdk`, `commonwell-sdk`, `carequality-sdk`) or `packages/shared` in the Metriport codebase, alpha versions need to be published to NPM before merging the PR.
⏰ Context from checks skipped due to timeout of 90000ms (14)
  • GitHub Check: check-pr / lint-build-test
  • GitHub Check: check-pr / lint-build-test
  • GitHub Check: check-pr / lint-build-test
  • GitHub Check: check-pr / lint-build-test
  • GitHub Check: check-pr / lint-build-test
  • GitHub Check: check-pr / lint-build-test
  • GitHub Check: check-pr / lint-build-test
  • GitHub Check: check-pr / lint-build-test
  • GitHub Check: check-pr / lint-build-test
  • GitHub Check: check-pr / lint-build-test
  • GitHub Check: check-pr / lint-build-test
  • GitHub Check: check-pr / lint-build-test
  • GitHub Check: check-pr / lint-build-test
  • GitHub Check: Analyze (javascript)
🔇 Additional comments (26)
packages/infra/package.json (1)

3-3: Version bump looks correct, but double-check changelog & publish tag

1.22.10-alpha.0 fits the repo-wide alpha cadence.
Make sure:

  1. CHANGELOG.md (or equivalent) reflects the bump.
  2. lerna publish / npm publish uses the next tag, or the intended pre-release tag, so consumers don’t accidentally pull an alpha.
packages/carequality-sdk/package.json (1)

3-3: SDK version increment acknowledged

No functional changes in this file—only 1.6.10-alpha.0.
Ensure generated artifacts (dist/) are rebuilt before publishing so that the registry contains the correct versioned code.

packages/utils/package.json (1)

3-3: Utils package bumped to alpha – OK

Nothing else changed. Confirm that any downstream packages depending on utils via semver range or workspace reference remain satisfied.

package.json (1)

41-55: Workspace re-ordering is harmless but confirm CI scripts

Moving packages/eslint-rules to the top and adding packages/utils lower in the list shouldn’t affect npm, but some custom scripts iterate over workspaces in order. Quickly sanity-run your lerna publish / build pipeline to ensure the new ordering doesn’t break any assumptions.

packages/mllp-server/package.json (1)

3-3: Ensure the alpha tag matches your release intent

0.3.10-alpha.0 is a pre-release. Because "private": true, it will not publish to NPM, but CI/CD pipelines may still push the tag to your internal registry. Double-check that this bump was intended for an internal alpha cut and that any downstream packages expecting 0.3.x have their ranges updated.

packages/commonwell-cert-runner/package.json (1)

3-3: Alpha bump looks fine – remember to publish before merge

1.26.12-alpha.0 complies with the internal rule that certification-runner bumps follow CommonWell SDK bumps. Just make sure the alpha tarball actually lands in the registry so CI on dependent repos can resolve it.

packages/commonwell-sdk/package.json (1)

3-3: Version bump acknowledged

5.9.10-alpha.0 keeps semantic ordering and matches dependent packages. No functional concerns here.

packages/ihe-gateway-sdk/package.json (1)

3-3: Alpha tag bump confirmed

0.19.10-alpha.0 aligns with the shared package bump; LGTM.

packages/shared/package.json (1)

3-3: Shared package alpha bump noted

0.23.10-alpha.0 is consistent with downstream updates; no issues.

packages/commonwell-jwt-maker/package.json (2)

3-3: Alpha version bump follows established SDK release process.

The version bump to alpha aligns with the requirement to publish alpha versions before merging SDK changes.


44-44: Dependency version update is consistent with coordinated release.

The update to the alpha version of @metriport/commonwell-sdk maintains consistency across the monorepo packages.

packages/carequality-cert-runner/package.json (2)

3-3: Alpha version bump is appropriate for coordinated release.

The version increment to alpha follows the established pattern for SDK package releases.


44-45: Dependency updates maintain version consistency.

Both @metriport/ihe-gateway-sdk and @metriport/shared are updated to their respective alpha versions, ensuring coordinated release across packages.

packages/core/package.json (2)

3-3: Alpha version update follows coordinated release pattern.

The version bump maintains consistency with other packages in this coordinated alpha release.


156-156: DevDependency reordering is cosmetic but acceptable.

The reordering of @metriport/eslint-rules in devDependencies doesn't affect functionality and appears to be for consistency across packages.

packages/api-sdk/package.json (2)

3-3: SDK alpha version follows required release process.

The alpha version bump is necessary for SDK packages as per established development workflow.


61-62: Alpha dependency updates maintain package coherence.

The updates to @metriport/commonwell-sdk and @metriport/shared alpha versions ensure all related packages are released together.

packages/eslint-rules/package.json (1)

2-30: LGTM: Version bump and formatting improvements.

The alpha version bump is appropriate for pre-release, and the expanded JSON formatting improves readability. No functional changes detected.

packages/api/src/external/commonwell/document/document-query.ts (8)

10-10: LGTM: Import reordering.

The import reordering doesn't affect functionality and may improve organization.


270-270: Excellent: Improved error reporting consistency.

The change from capture.message to capture.error and the use of errorToString provides better error handling and consistent formatting across the codebase.

Also applies to: 279-279


304-312: Great refactoring: Named function declaration.

Converting the inline arrow function to a named function declaration improves readability and follows the coding guidelines preference to avoid creating arrow functions.


391-391: Consistent error handling improvement.

The change from capture.message to capture.error maintains consistency with the error reporting pattern used throughout the file.


527-531: Good refactoring: Named async function.

Converting the inline conditional to a named async function improves readability and makes the code more maintainable.


555-557: Improved readability with named function.

The conversion from inline arrow function to named function declaration enhances code clarity and follows the coding guidelines.


643-643: Consistent error formatting improvements.

The addition of errorToString(error) calls and the change from capture.message to capture.error ensures consistent error handling and formatting throughout the file.

Also applies to: 749-749, 755-755


837-839: Good refactoring: Named function declaration.

Converting the inline arrow function to a named function declaration improves code readability and follows the coding guidelines preference for named functions.

Comment on lines +39 to 45
"@metriport/eslint-rules": "file:packages/eslint-rules",
"@sentry/node": "^9.1.0",
"@tsconfig/node18": "^18.2.4",
"@types/node": "^22.13.5",
"ts-node": "^10.9.2",
"typescript": "^5.6.3",
"@metriport/eslint-rules": "file:packages/eslint-rules"
"typescript": "^5.6.3"
}
Copy link
@coderabbitai coderabbitai bot Jun 25, 2025

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

TypeScript version drifts from the rest of the monorepo

Most SDK packages still pin typescript to ^4.9.5, whereas this package is now on ^5.6.3. Mixing TS majors inside the same repo can lead to mismatched lib .d.ts files and build artefacts.

If you don’t actually rely on TS 5 features here, keep the repo consistent:

-    "typescript": "^5.6.3"
+    "typescript": "^4.9.5"

(or upgrade all packages together).

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
"@metriport/eslint-rules": "file:packages/eslint-rules",
"@sentry/node": "^9.1.0",
"@tsconfig/node18": "^18.2.4",
"@types/node": "^22.13.5",
"ts-node": "^10.9.2",
"typescript": "^5.6.3",
"@metriport/eslint-rules": "file:packages/eslint-rules"
"typescript": "^5.6.3"
}
"@metriport/eslint-rules": "file:packages/eslint-rules",
"@sentry/node": "^9.1.0",
"@tsconfig/node18": "^18.2.4",
"@types/node": "^22.13.5",
"ts-node": "^10.9.2",
"typescript": "^4.9.5"
}
🤖 Prompt for AI Agents
In packages/mllp-server/package.json around lines 39 to 45, the TypeScript
version is set to ^5.6.3, which differs from the rest of the monorepo that uses
^4.9.5. To maintain consistency and avoid build issues, change the TypeScript
version here to ^4.9.5 unless you specifically need features from TypeScript 5.
Alternatively, coordinate an upgrade of TypeScript across all packages
simultaneously.

Copy link
Member Author
@leite08 leite08 Jun 25, 2025

Choose a reason for hiding this comment

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

out of scope for this PR

Copy link

Choose a reason for hiding this comment

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

@leite08 Understood! You're absolutely right that TypeScript version consistency is outside the scope of this PR focused on CloudWatch error handling.

Would you like me to create a follow-up issue to track the TypeScript version drift across the monorepo? This would help ensure it gets addressed in a future PR dedicated to dependency management.

@leite08 leite08 marked this pull request as draft June 25, 2025 20:52
@leite08 leite08 marked this pull request as draft June 25, 2025 20:52
leite08 added 4 commits June 25, 2025 18:30
Ref eng-532

Signed-off-by: Rafael Leite <2132564+leite08@users.noreply.github.com>
Ref eng-532

Signed-off-by: Rafael Leite <2132564+leite08@users.noreply.github.com>
Ref: #000

 - api@1.27.10-alpha.0
 - @metriport/api-sdk@15.0.7-alpha.0
 - @metriport/carequality-cert-runner@1.18.10-alpha.0
 - @metriport/carequality-sdk@1.6.10-alpha.0
 - @metriport/commonwell-cert-runner@1.26.12-alpha.0
 - @metriport/commonwell-jwt-maker@1.24.12-alpha.0
 - @metriport/commonwell-sdk@5.9.10-alpha.0
 - @metriport/core@1.24.10-alpha.0
 - @metriport/eslint-plugin-eslint-rules@1.0.2-alpha.0
 - @metriport/ihe-gateway-sdk@0.19.10-alpha.0
 - infrastructure@1.22.10-alpha.0
 - mllp-server@0.3.10-alpha.0
 - @metriport/shared@0.23.10-alpha.0
 - utils@1.25.10-alpha.0

Signed-off-by: Rafael Leite <2132564+leite08@users.noreply.github.com>
Ref eng-532

Signed-off-by: Rafael Leite <2132564+leite08@users.noreply.github.com>
@leite08 leite08 force-pushed the eng-532-dont-send-cw-headers-to-sentry branch from 3d464db to d1c5c5a Compare June 25, 2025 21:31
Ref eng-532

Signed-off-by: Rafael Leite <2132564+leite08@users.noreply.github.com>
@leite08 leite08 marked this pull request as ready for review June 25, 2025 21:37
@leite08 leite08 mentioned this pull request Jun 25, 2025
24 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0