Skip to content

fix(cli): read the telemetry token per call so tests don't depend on the publish job's env - #7822

Merged
waleedlatif1 merged 1 commit into
stagingfrom
fix/cli-telemetry-hermetic-tests
Sep 14, 2026
Merged

waleedlatif1 merged 1 commit into
stagingfrom
fix/cli-telemetry-hermetic-tests

Conversation

@waleedlatif1

Copy link
Copy Markdown
Collaborator

Summary

  • The CLI publish failed in its test step: sim telemetry status has a test asserting that a build without a reporting token reports nothing, and it read the token from the ambient environment. The publish job now sets the token for the whole job, so the test saw one and failed, and nothing was published
  • The token is now read when builtInIngestTarget() is called instead of at module load. The reads stay literal process.env.SIM_CLI_TELEMETRY_* expressions, so the bundler still inlines them into the published build
  • The telemetry command tests pin the token and opt-out variables, so they give the same result in any shell or CI job, and a new test covers the build-with-a-destination case
  • This touches packages/sim-cli, so merging it runs the publish again

Type of Change

  • Bug fix

Testing

  • Reproduced the CI failure locally by running the suite with the publish job's env; it passes with and without that env after the change
  • Confirmed the new pinning fails against the old module-level read
  • Ran the publish job's sequence locally (tests, type-check, build, pack smoke, publish dry-run with its prepublishOnly rebuild): the shipped bundle has the token inlined, no raw env reads left, and sim telemetry status reports on
  • bun run lint, check:audits, and docs-manifest:check pass

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

@vercel

vercel Bot commented Sep 14, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated
docs Skipped Skipped Sep 14, 2026 9:37pm UTC

Request Review

@greptile-apps

greptile-apps Bot commented Sep 14, 2026

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 5/5

The PR appears safe to merge with no actionable correctness, security, or repository-rule issues identified.

Summary

This PR moves telemetry destination lookup from module initialization to call time so unbundled tests honor their explicitly configured environment.

  • Pins telemetry key and opt-out variables to make command tests independent of ambient CI settings.
  • Adds coverage for builds configured with a telemetry destination.
  • Preserves literal environment reads so published bundles can continue inlining telemetry configuration.

Reviews (1) · Last reviewed commit: "fix(cli): read the telemetry token per c..."

@waleedlatif1
waleedlatif1 merged commit b26365c into staging Sep 14, 2026
33 checks passed
@waleedlatif1
waleedlatif1 deleted the fix/cli-telemetry-hermetic-tests branch September 14, 2026 21:40
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