Skip to content

refactor(config): migrate to js-core schema validation#161

Draft
thomas-lebeau wants to merge 2 commits into
mainfrom
thomas.lebeau/config-schema-migration
Draft

refactor(config): migrate to js-core schema validation#161
thomas-lebeau wants to merge 2 commits into
mainfrom
thomas.lebeau/config-schema-migration

Conversation

@thomas-lebeau

Copy link
Copy Markdown
Contributor

Motivation

Replace the hand-rolled configuration validators with the shared schema-based validation from @datadog/js-core, reducing duplicated logic and aligning with the rest of the Datadog SDK family. Along the way, dead batchSize/uploadFrequency options that were never actually wired up were removed.

Changes

  • Migrate buildConfiguration to use validateAndBuildConfiguration/ConfigurationSchema from @datadog/js-core/configuration; Configuration type is now inferred from the schema instead of hand-written.
  • Remove unused batchSize/uploadFrequency options from InitConfiguration and simplify Transport accordingly (these fields were never read, so Transport always fell back to BatchSizes.MEDIUM / BatchUploadFrequencies.NORMAL).
  • Update dependent modules (commonContext, CrashCollection, OperationCollection, display, DiskValueHistory, Transport) and their tests for the new Configuration shape.
  • Depends on unpublished js-core configuration work, referenced via a local portal in package.json/yarn.lock.

Test instructions

  • yarn test to confirm unit tests pass with the new schema-based configuration.
  • Exercise SDK initialization (e.g. via the playground) with valid and invalid InitConfiguration objects to confirm validation errors surface as expected.

Checklist

  • Tested locally (playground)
  • Added unit tests for this change.
  • Added e2e/integration tests for this change.
  • Updated related documentation.
  • Agentic code review findings addressed or explicitly dismissed.

buildConfiguration never read these fields from InitConfiguration, so they
were always undefined at runtime and Transport always fell back to
BatchSizes.MEDIUM / BatchUploadFrequencies.NORMAL regardless of what a
consumer configured. Remove the dead fields and simplify Transport
accordingly.
…tion

Replace hand-rolled field validators with the shared
validateAndBuildConfiguration/ConfigurationSchema API from
@datadog/js-core/configuration. Configuration type is now inferred
from the schema instead of hand-written.

Depends on unpublished js-core configuration work, linked via a
local portal: reference in package.json/yarn.lock.
@datadog-datadog-prod-us1-2

datadog-datadog-prod-us1-2 Bot commented Jul 3, 2026

Copy link
Copy Markdown

Pipelines

Fix all issues with BitsAI

⚠️ Warnings

🚦 10 Pipeline jobs failed

DataDog/electron-sdk | build   View in Datadog   GitLab

DataDog/electron-sdk | check-package-content   View in Datadog   GitLab

DataDog/electron-sdk | check-licenses   View in Datadog   GitLab

View all 10 failed jobs.

Useful? React with 👍 / 👎

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

Comment thread src/config.spec.ts
});

it('logs multiple errors when multiple fields are invalid', () => {
it('stops at the first invalid required field when multiple fields are invalid', () => {

@thomas-lebeau thomas-lebeau Jul 3, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

❓ question: ‏This is a tiny behaviour change, it makes it more aligned with how the browser SDK does. wdyt?

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