Skip to content

fix(cli): report production usage data only for released builds - #3065

Merged
kanoru3101 merged 3 commits into
mainfrom
fix/release-usage-improvments
Sep 2, 2026
Merged

fix(cli): report production usage data only for released builds#3065
kanoru3101 merged 3 commits into
mainfrom
fix/release-usage-improvments

Conversation

@kanoru3101

@kanoru3101 kanoru3101 commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

What/Why/How?

Our own builds and CI runs showed up in usage data as real users. Two fixes:

  • Only a real release reports env: production now. Snapshots and local builds report development.
  • Our CI runs no longer send telemetry at all — including the Docker smoke checks, which were sending it even with REDOCLY_TELEMETRY: off in the workflow, because containers don't see that variable.

Reference

Follow-up to #2976.

Testing

npm run compile                      → env:"development"
BUILD_ENV=production npm run compile → env:"production"

Verified in Docker: the build arg reaches RUN, and -e REDOCLY_TELEMETRY forwards the value into containers.

Check yourself

  • This PR follows the contributing guide
  • All new/updated code is covered by tests
  • Core code changed? - Tested with other Redocly products (internal contributions only)
  • New package installed? - Tested in different environments (browser/node)
  • Documentation update has been considered

Security

  • The security impact of the change has been considered
  • Code follows company security practices and guidelines

Note

Low Risk
Changes affect build-time constants and CI/Docker env wiring for telemetry labeling, not runtime auth or data handling for end users.

Overview
Stops internal CI and non-release builds from polluting usage telemetry as production traffic.

The CLI esbuild step no longer hardcodes REDOCLY_CLI_BUILD_ENV to production; it now bakes in BUILD_ENV at compile time, defaulting to development when unset. The release workflow sets BUILD_ENV=production for npm publish, and Docker Hub builds pass BUILD_ENV=production via a new Dockerfile ARG and build-args.

CI telemetry is tightened: release workflow sets workflow-wide REDOCLY_TELEMETRY: 'off', and Docker smoke steps in release and smoke workflows use a redocly_docker helper that forwards -e REDOCLY_TELEMETRY into containers (so workflow env vars actually apply inside Docker).

Reviewed by Cursor Bugbot for commit f2ed1c5. Bugbot is set up for automated code reviews on this repo. Configure here.

@kanoru3101
kanoru3101 requested review from a team as code owners August 31, 2026 15:30
@changeset-bot

changeset-bot Bot commented Aug 31, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: f2ed1c5

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@kanoru3101
kanoru3101 marked this pull request as draft August 31, 2026 15:32
@github-actions

github-actions Bot commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 78.57% (🎯 77%) 13966 / 17775
🔵 Statements 78.35% (🎯 77%) 15058 / 19218
🔵 Functions 82.31% (🎯 81%) 2877 / 3495
🔵 Branches 71.63% (🎯 71%) 10377 / 14486
File CoverageNo changed files found.
Generated in workflow #11601 for commit f2ed1c5 by the Vitest Coverage Report Action

@github-actions

github-actions Bot commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

Performance Benchmark (Lower is Faster)

CLI Version Bundle Lint Check Config
cli-latest ▓ 1.00x ± 0.01 ▓ 1.00x (Fastest) ▓ 1.00x (Fastest)
cli-next ▓ 1.00x (Fastest) ▓ 1.01x ± 0.01 ▓ 1.00x ± 0.01

@kanoru3101
kanoru3101 force-pushed the fix/release-usage-improvments branch 5 times, most recently from 54e1787 to 4bd44db Compare August 31, 2026 16:23
The esbuild define hardcoded `production`, so snapshot builds and any local bundle reported themselves as released usage. The value now comes from BUILD_ENV, which only the release job and the Docker image build set; everything else stays `development`.

The release workflow also had no REDOCLY_TELEMETRY, and its post-release smoke checks run the released CLI over three commands. `docker run` does not inherit the workflow environment, so those calls pass the variable explicitly.
@kanoru3101
kanoru3101 force-pushed the fix/release-usage-improvments branch from 4bd44db to 3573900 Compare August 31, 2026 16:29
@kanoru3101 kanoru3101 self-assigned this Aug 31, 2026
@kanoru3101 kanoru3101 added no changeset needed snapshot Create experimental release PR labels Aug 31, 2026
@github-actions

github-actions Bot commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

📦 A new experimental 🧪 version v0.0.0-snapshot.1788270600 of Redocly CLI has been published for testing.

Install with NPM:

npm install @redocly/cli@0.0.0-snapshot.1788270600

⚠️ Note: This is a development build and may contain unstable features.

@kanoru3101
kanoru3101 removed the request for review from a team September 1, 2026 14:17
@kanoru3101
kanoru3101 marked this pull request as ready for review September 1, 2026 14:17
@kanoru3101
kanoru3101 merged commit e200d9d into main Sep 2, 2026
53 checks passed
@kanoru3101
kanoru3101 deleted the fix/release-usage-improvments branch September 2, 2026 06:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

no changeset needed snapshot Create experimental release PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants