Skip to content

fix: validate telemetry preference before initialization - #386

Open
sanjeebdas1979 wants to merge 1 commit into
base:masterfrom
sanjeebdas1979:fix/telemetry-preference-validation
Open

fix: validate telemetry preference before initialization#386
sanjeebdas1979 wants to merge 1 commit into
base:masterfrom
sanjeebdas1979:fix/telemetry-preference-validation

Conversation

@sanjeebdas1979

Copy link
Copy Markdown

Summary

Fixes telemetry preference validation so invalid values are rejected before SDK initialization and telemetry setup.

Changes

  • Validate preference.telemetry whenever it is explicitly provided.
  • Reject non-boolean telemetry values, including falsy values.
  • Run preference validation before global initialization and telemetry initialization.
  • Add tests covering valid, invalid, undefined, and falsy non-boolean telemetry values.

Why

Previously, telemetry validation relied on a truthiness check, which allowed falsy non-boolean values to bypass validation.

Additionally, SDK initialization could run before preferences were validated, allowing telemetry-related initialization to occur before an invalid preference was rejected.

Testing

  • validatePreferences.test.ts
  • createBaseAccountSDK.test.ts
  • 38 tests passed across the relevant test suites.
  • git diff --check and git diff --cached --check passed.

Fixes #383

@cb-heimdall

Copy link
Copy Markdown
Collaborator

🟡 Heimdall Review Status

Requirement Status More Info
Reviews 🟡 0/2
Denominator calculation
Show calculation
1 if user is bot 0
1 if user is external 0
2 if repo is sensitive 0
From .codeflow.yml 1
Additional review requirements
Show calculation
Max 0
0
From CODEOWNERS 0
Global minimum 0
Max 1
1
1 if commit is unverified 1
Sum 2

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.

telemetry preference validation skips falsy non-boolean values and runs after telemetry init

2 participants