Skip to content

fix: validate telemetry preference before initialization - #384

Closed
omerbek wants to merge 1 commit into
base:masterfrom
omerbek:fix/validate-telemetry-preference-type
Closed

fix: validate telemetry preference before initialization#384
omerbek wants to merge 1 commit into
base:masterfrom
omerbek:fix/validate-telemetry-preference-type

Conversation

@omerbek

@omerbek omerbek commented Aug 14, 2026

Copy link
Copy Markdown

Fixes #383.

Summary

  • validates any defined preference.telemetry value by type instead of using a truthiness check
  • moves preference validation before store writes and telemetry initialization
  • adds regression coverage for falsy non-boolean telemetry values and initialization ordering

Why

telemetry: 0 previously skipped validatePreferences() because 0 is falsy. The telemetry initialization check uses strict comparison (telemetry !== false), so the same value was treated as enabled. Validation also ran after telemetry initialization, which meant invalid preference values could be used before they were rejected.

This keeps the documented values (true, false, or omitted) working as before while rejecting invalid types before side effects.

Note

I saw #303 also touches configuration validation order. This PR keeps the scope narrow to the telemetry preference type check and the side-effect ordering needed for that validation to be effective.

Testing

  • corepack yarn workspace @base-org/account node compile-assets.cjs
  • corepack yarn workspace @base-org/account test src/util/validatePreferences.test.ts src/interface/builder/core/createBaseAccountSDK.test.ts --run
  • corepack yarn workspace @base-org/account typecheck
  • corepack yarn biome check packages/account-sdk/src/util/validatePreferences.ts packages/account-sdk/src/util/validatePreferences.test.ts packages/account-sdk/src/interface/builder/core/createBaseAccountSDK.ts packages/account-sdk/src/interface/builder/core/createBaseAccountSDK.test.ts

@cb-heimdall

Copy link
Copy Markdown
Collaborator

🟡 Heimdall Review Status

Requirement Status More Info
Reviews 🟡 0/1
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 0
Sum 1

@omerbek

omerbek commented Aug 14, 2026

Copy link
Copy Markdown
Author

Closing this duplicate in favor of #385, which carries the same fix with the current branch and testing notes.

@omerbek omerbek closed this Aug 14, 2026
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