Skip to content

fix: cloud sdk#451

Draft
sjvans wants to merge 1 commit into
mainfrom
fix-cloud-sdk
Draft

fix: cloud sdk#451
sjvans wants to merge 1 commit into
mainfrom
fix-cloud-sdk

Conversation

@sjvans

@sjvans sjvans commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Fix Cloud SDK HTTP Request Tracing via Object.defineProperty

Bug Fix

🐛 Fixes an issue with how the Cloud SDK HTTP client functions are patched for tracing. Previously, the wrapped executeHttpRequest and executeHttpRequestWithOrigin functions were assigned directly to the cloudSDK object (e.g., cloudSDK.executeHttpRequest = wrap(...)). This approach fails when the property is non-writable or non-configurable on the module exports. The fix uses Object.defineProperty to properly override these functions, ensuring the tracing wrappers are applied correctly.

Changes

  • lib/tracing/cloud_sdk.js: Replaced direct property assignment (cloudSDK.executeHttpRequest = ...) with Object.defineProperty(cloudSDK, 'executeHttpRequest', { value: ... }) for both executeHttpRequest and executeHttpRequestWithOrigin. Also includes minor code style cleanup (reformatted multi-line trace(...) calls for consistency).
  • 🔄 Regenerate and Update Summary
PR Bot Information

Version: 1.26.14

  • LLM: anthropic--claude-4.6-sonnet
  • Output Template: Default Template
  • Correlation ID: 6bf1b950-76e8-11f1-877b-299e7adc465b
  • File Content Strategy: Full file content
  • Summary Prompt: Default Prompt
  • Event Trigger: pull_request.opened

@hyperspace-insights hyperspace-insights Bot 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.

The switch from direct assignment to Object.defineProperty is likely the intended fix (e.g., to patch a read-only exported property), but both calls are missing writable: true and configurable: true, which silently freezes those properties and can break re-patching or tests.

PR Bot Information

Version: 1.26.14

  • Correlation ID: 6bf1b950-76e8-11f1-877b-299e7adc465b
  • LLM: anthropic--claude-4.6-sonnet
  • Event Trigger: pull_request.opened
  • File Content Strategy: Full file content

Comment thread lib/tracing/cloud_sdk.js
}
})
cloudSDK.executeHttpRequestWithOrigin = wrap(_executeWithOrigin, {
Object.defineProperty(cloudSDK, 'executeHttpRequest', { value: _executeHttpRequest })

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.

Bug: Object.defineProperty without writable: true or configurable: true defaults both to false, making the property non-writable and non-configurable. This is a stricter result than the original simple assignment, and will silently fail (or throw in strict mode) if any downstream code tries to reassign or redefine the property (e.g. in tests or repeated patching).

Suggested change
Object.defineProperty(cloudSDK, 'executeHttpRequest', { value: _executeHttpRequest })
Object.defineProperty(cloudSDK, 'executeHttpRequest', { value: _executeHttpRequest, writable: true, configurable: true })

Double-check suggestion before committing. Edit this comment for amendments.


Please provide feedback on the review comment by checking the appropriate box:

  • 🌟 Awesome comment, a human might have missed that.
  • ✅ Helpful comment
  • 🤷 Neutral
  • ❌ This comment is not helpful

Comment thread lib/tracing/cloud_sdk.js
})
}
})
Object.defineProperty(cloudSDK, 'executeHttpRequestWithOrigin', { value: _executeHttpRequestWithOrigin })

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.

Bug: Same issue — writable and configurable default to false, making executeHttpRequestWithOrigin frozen on the module export.

Suggested change
Object.defineProperty(cloudSDK, 'executeHttpRequestWithOrigin', { value: _executeHttpRequestWithOrigin })
Object.defineProperty(cloudSDK, 'executeHttpRequestWithOrigin', { value: _executeHttpRequestWithOrigin, writable: true, configurable: true })

Double-check suggestion before committing. Edit this comment for amendments.


Please provide feedback on the review comment by checking the appropriate box:

  • 🌟 Awesome comment, a human might have missed that.
  • ✅ Helpful comment
  • 🤷 Neutral
  • ❌ This comment is not helpful

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.

1 participant