Skip to content

♻️ move hook and merge utilities from browser-core to @datadog/js-core#4797

Merged
BenoitZugmeyer merged 8 commits into
mainfrom
benoit/move-hooks-to-js-core
Jun 18, 2026
Merged

♻️ move hook and merge utilities from browser-core to @datadog/js-core#4797
BenoitZugmeyer merged 8 commits into
mainfrom
benoit/move-hooks-to-js-core

Conversation

@BenoitZugmeyer

Copy link
Copy Markdown
Member

Motivation

The @datadog/js-core package is intended to host platform-agnostic primitives that can be shared across SDKs (browser, mobile, etc.) without pulling in browser-specific code. mergeInto/combine/deepClone, typeUtils, and the hook assembly primitives (Hook, createHook, DISCARDED, SKIPPED) have no browser dependencies and are good candidates to live there.

Changes

  • Move mergeInto, deepClone, combine, getType, isIndexableObject from browser-core to @datadog/js-core/util
  • Move Hook, createHook, DISCARDED, SKIPPED, RecursivePartial from browser-core to @datadog/js-core/assembly
  • Update all import sites across browser-core, browser-rum-core, browser-logs, and browser-rum
  • Move unit tests for the relocated utilities to js-core alongside their implementations

Test instructions

This is a pure refactor with no behavioral changes. Start yarn dev and open the sandbox at http://localhost:8080 — verify that RUM and Logs initialize normally and events appear in the network tab.

Checklist

  • Tested locally
  • Tested on staging
  • Added unit tests for this change.
  • Added e2e/integration tests for this change.
  • Updated documentation and/or relevant AGENTS.md file

@BenoitZugmeyer BenoitZugmeyer marked this pull request as ready for review June 17, 2026 08:45
@BenoitZugmeyer BenoitZugmeyer requested a review from a team as a code owner June 17, 2026 08:45
@datadog-official

datadog-official Bot commented Jun 17, 2026

Copy link
Copy Markdown

Pipelines  Tests

Fix all issues with BitsAI

⚠️ Warnings

🚦 1 Pipeline job failed

DataDog/browser-sdk | check-squash-into-staging   View in Datadog   GitLab

ℹ️ Info

No other issues found (see more)

🧪 All tests passed
❄️ No new flaky tests detected

🎯 Code Coverage (details)
Patch Coverage: 89.47%
Overall Coverage: 76.87% (+0.00%)

Useful? React with 👍 / 👎

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: 2bc2c3a | Docs | Datadog PR Page | Give us feedback!

@cit-pr-commenter-54b7da

cit-pr-commenter-54b7da Bot commented Jun 17, 2026

Copy link
Copy Markdown

Bundles Sizes Evolution

📦 Bundle Name Base Size Local Size 𝚫 𝚫% Status
Rum 172.44 KiB 172.46 KiB +30 B +0.02%
Rum Profiler 8.22 KiB 8.22 KiB 0 B 0.00%
Rum Recorder 21.09 KiB 21.09 KiB 0 B 0.00%
Logs 54.43 KiB 54.47 KiB +38 B +0.07%
Rum Slim 129.94 KiB 129.97 KiB +36 B +0.03%
Worker 22.96 KiB 22.96 KiB 0 B 0.00%

@BenoitZugmeyer BenoitZugmeyer force-pushed the benoit/move-hooks-to-js-core branch from 55158e9 to 33a2b14 Compare June 17, 2026 08:59

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 55158e9d4b

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread packages/js-core/package.json Outdated
Comment thread packages/js-core/assembly/package.json Outdated
Comment thread packages/js-core/src/assembly/hook.ts
Comment thread packages/js-core/src/entries/util.ts
@BenoitZugmeyer BenoitZugmeyer changed the title 🚚 move hook and merge utilities from browser-core to @datadog/js-core ♻️ move hook and merge utilities from browser-core to @datadog/js-core Jun 17, 2026
@BenoitZugmeyer BenoitZugmeyer force-pushed the benoit/move-hooks-to-js-core branch from 56709b2 to f9065a4 Compare June 17, 2026 09:21

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 09ca9ef0cf

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

"license": "Apache-2.0",
"sideEffects": false,
"exports": {
"./assembly": {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Bump js-core before adding the assembly subpath

When the Browser SDK packages are installed from npm instead of the workspace, their package.json files still pin @datadog/js-core to exact version 0.0.2, but this commit starts importing/re-exporting new @datadog/js-core/assembly APIs (and new util exports) that were not present in the existing 0.0.2 package. Since @datadog/js-core is independently versioned and npm versions are immutable, released consumers will either get the old 0.0.2 without this subpath or the js-core publish will be rejected; bump js-core and update the dependent pins with these new exports.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

js-core version is automatically bumped when doing a SDK release

`combine`, `deepClone`, `mergeInto`, `getType`, and `isIndexableObject`
are not browser-specific, so they belong in the shared `js-core` package
rather than `browser-core`. This makes them reusable by future non-browser
targets without pulling in the full `browser-core` dependency.
…js-core/assembly`

These hook primitives are not browser-specific and belong in the shared
`js-core` package alongside the recently moved utility functions.
Document all symbols newly exported from `@datadog/js-core/assembly`
(`Hook`, `createHook`, `RecursivePartial`, `DISCARDED`, `SKIPPED`) and
from `@datadog/js-core/util` (`mergeInto`, `combine`, `deepClone`) with
proper JSDoc. Also update the README to cover the two new sub-paths with
API tables and a usage example.
@BenoitZugmeyer BenoitZugmeyer force-pushed the benoit/move-hooks-to-js-core branch from 09ca9ef to b1bb716 Compare June 17, 2026 09:54

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b1bb7163dc

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread packages/browser-core/src/index.ts
…dog/js-core/util`

`RecursivePartial` is a generic utility type with no dependency on the
hook assembly pattern, so `util` is a more appropriate home. The
`assembly` sub-path re-exports it for backward compatibility.
@BenoitZugmeyer BenoitZugmeyer force-pushed the benoit/move-hooks-to-js-core branch from b1bb716 to f76638e Compare June 17, 2026 10:10

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

circularReferenceChecker = createCircularReferenceChecker()

P2 Badge Hide the internal merge recursion parameter

When this ships as part of the stable @datadog/js-core/util API, the generated declarations expose circularReferenceChecker?: CircularReferenceChecker as a third mergeInto argument even though it is only used for recursive calls and is not documented as public. Because packages/js-core/AGENTS.md says js-core exports have a semver stability guarantee, external TypeScript consumers can start depending on this internal protocol and removing or changing it later becomes a breaking change; keep the exported signature to the documented destination, source parameters and move the checker to a private helper or non-exported overload.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread packages/js-core/README.md Outdated
Comment thread packages/js-core/src/assembly/hook.ts
Comment thread packages/js-core/README.md Outdated
- Fix the README assembly example: `RecursivePartial` is exported from
  `@datadog/js-core/util`, not `@datadog/js-core/assembly`
- Hide the internal `circularReferenceChecker` recursion parameter from
  the public `mergeInto` signature by splitting into a public wrapper
  and a private `mergeIntoInternal` helper

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 176842173f

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread packages/js-core/README.md Outdated
Comment thread packages/js-core/README.md Outdated
Comment thread packages/js-core/src/entries/util.ts
@BenoitZugmeyer

Copy link
Copy Markdown
Member Author

/staging

@BenoitZugmeyer

Copy link
Copy Markdown
Member Author

/to-staging

@gh-worker-devflow-routing-ef8351

gh-worker-devflow-routing-ef8351 Bot commented Jun 18, 2026

Copy link
Copy Markdown

View all feedbacks in Devflow UI.

2026-06-18 12:37:35 UTC ℹ️ Start processing command /to-staging


2026-06-18 12:37:41 UTC ℹ️ Branch Integration: starting soon, merge expected in approximately 19m (p90)

Commit 2bc2c3a7e0 will soon be integrated into staging-25.


2026-06-18 12:37:56 UTC 🚨 Branch Integration: this merge request has conflicts which couldn't be solved automatically

We couldn't automatically merge the commit 2bc2c3a7e0 into staging-25!

To solve the conflicts directly in Github, click here to create a fix pull request.

Alternatively, you can also click here reset the integration branch or use the following Slack command: @devflow reset-branch -r browser-sdk -b staging-25

⚠️ Warning: This action will DELETE ALL COMMITS on the integration branch. This action cannot be undone.

@gh-worker-dd-devflow-36fce6

Copy link
Copy Markdown
Contributor

🚂 Branch Integration: starting soon, merge expected in approximately 19m (p90)

Commit 2bc2c3a7e0 will soon be integrated into staging-25.

@gh-worker-dd-devflow-36fce6

Copy link
Copy Markdown
Contributor

🚂 Branch Integration

Commit 2bc2c3a7e0 has been merged into staging-25 in merge commit 64b1be6d34.

If you need to revert this integration, you can use the following command: /code revert-integration -b staging-25

@BenoitZugmeyer BenoitZugmeyer merged commit 0b66715 into main Jun 18, 2026
31 checks passed
@BenoitZugmeyer BenoitZugmeyer deleted the benoit/move-hooks-to-js-core branch June 18, 2026 14:01
@github-actions github-actions Bot locked and limited conversation to collaborators Jun 18, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants