Skip to content

fix(auto-instrumentation): Upgrade @apm-js-collab/code-transformer to v0.12.0#1708

Merged
Stephen Belanger (Qard) merged 1 commit intomainfrom
upgrade-orchestrion-0.11
Apr 10, 2026
Merged

fix(auto-instrumentation): Upgrade @apm-js-collab/code-transformer to v0.12.0#1708
Stephen Belanger (Qard) merged 1 commit intomainfrom
upgrade-orchestrion-0.11

Conversation

@Qard
Copy link
Copy Markdown
Contributor

Summary

  • Upgrades @apm-js-collab/code-transformer from ^0.9.0 to ^0.11.0, picking up the v0.11.0 JS rewrite (replaces the previous WASM-based transformer)
  • Fixes the ESM loader hook to pass the correct module type (esm/cjs/unknown) based on Node.js loader format, instead of always passing "unknown" — this was causing CJS require() to be injected into ESM (.mjs) files
  • Removes tracePromise assertions from transformation tests (implementation detail of the old WASM output; the new JS transformer uses runStores instead)
  • Bumps dc-browser to v1.0.4, which adds a default export to match Node.js CJS-ESM interop behaviour required by the diagnostics_channel-based wrappers

Test plan

  • All unit tests pass (pnpm test in js/)
  • Transformation tests pass (esbuild, vite, webpack, rollup bundlers)
  • Loader hook integration tests pass (ESM + CJS)
  • End-to-end tests pass (Anthropic, OpenAI with mock fetch)

🤖 Generated with Claude Code

@socket-security
Copy link
Copy Markdown

socket-security bot commented Mar 31, 2026

All alerts resolved. Learn more about Socket for GitHub.

This PR previously contained dependency changes with security issues that have been resolved, removed, or ignored.

View full report

@Qard Stephen Belanger (Qard) force-pushed the upgrade-orchestrion-0.11 branch 6 times, most recently from 2c7c725 to 9dbb7ab Compare April 4, 2026 20:18
Stephen Belanger (Qard) added a commit that referenced this pull request Apr 7, 2026
…v3/v4+/v5 (#1739)

## Summary

- **streamText / streamObject (ESM)**: Split the instrumentation config
by version range. In v3 both functions are declared `async`, so they
need `kind: "Async"` (asyncEnd fires with the resolved stream result).
In v4+ they are sync functions returning the stream directly, so they
use `kind: "Sync"` with the existing sync-stream channels.
- **Agent.stream (v5)**: The `stream()` method in v5 is sync (not
async), so `wrapPromise`'s `asyncEnd` never fires under auto-hook
instrumentation. Added a new `agentStreamSync` channel (`kind:
"sync-stream"`) for the auto-hook path. The existing `agentStream`
channel is kept for the `wrapAISDK` wrapper path which uses
`tracePromise`.

These gaps were exposed by the `@apm-js-collab/code-transformer` v0.11.0
upgrade (PR #1708), which tightened `wrapPromise` to only fire
`asyncEnd` when the return value is actually thenable.

## Test plan

- All 84 AI SDK instrumentation e2e tests pass (wrapped + auto-hook for
v3, v4, v5, v6)
- `pnpm run build` succeeds with no type errors

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-authored-by: Luca Forstner <luca.forstner@gmail.com>
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

need this to merge to unblock #1765

@Qard Stephen Belanger (Qard) force-pushed the upgrade-orchestrion-0.11 branch 2 times, most recently from 8c8016a to 2a9ea34 Compare April 9, 2026 19:19
@Qard Stephen Belanger (Qard) changed the title fix(auto-instrumentation): Upgrade @apm-js-collab/code-transformer to v0.11.0 fix(auto-instrumentation): Upgrade @apm-js-collab/code-transformer to v0.12.0 Apr 9, 2026
… v0.12.0

- Bump version range to ^0.12.0. v0.12.0 is a JS rewrite (replacing the
  WASM transformer) that fixes Promise subclass preservation, restoring
  APIPromise.withResponse() support under auto-instrumentation.
- Fix ESM loader hook to pass the actual module type (esm/cjs/unknown)
  from the Node.js loader format instead of always passing "unknown",
  which caused CJS require() to be injected into ESM files.
- Remove tracePromise assertions from transformation tests (implementation
  detail of the old WASM output; new JS version uses runStores instead).
- Add @apm-js-collab/* to minimumReleaseAgeExclude so pnpm can install
  v0.12.0 during the 3-day release age window.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@Qard Stephen Belanger (Qard) merged commit 50902fd into main Apr 10, 2026
54 of 55 checks passed
@Qard Stephen Belanger (Qard) deleted the upgrade-orchestrion-0.11 branch April 10, 2026 09:36
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.

3 participants