Repository navigation
test: keep unit tests and Harbor runs from sending usage events - #1732
Merged
Merged
Conversation
Unit tests in core and blocks run the real CLI, its bins and core's tracked entry points. On a developer's machine there is no CI marker, so every run sent real usage events (about 57 per run of the two suites: secret, config, docs, dev, dev:stop, generate:client, generate:spec and deploy), counted as real usage. - Both test scripts load scripts/test-telemetry-off.env with node --env-file, which sets CDK_DISABLE_CLI_TELEMETRY=1 for every test process. Tests that check telemetry clear it themselves, as before. - Two --telemetry-file tests in telemetry.test.ts sent their event to the default endpoint; the suite now points them at a closed local port. - Harbor set BLOCKS_DISABLE_TELEMETRY, which nothing reads any more; it now sets CDK_DISABLE_CLI_TELEMETRY.
sarayev
disabled auto-merge
November 20, 2026 19:58
sarayev
enabled auto-merge (squash)
November 20, 2026 19:58
This branch had an error being deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Usage events from our own test runs show up in Prod as real usage. Unit tests in
coreandblocksrun the real CLI, its bins and core's tracked entry points (runSecretCli,runConfigCli,writeSpec, ...). CI runs reportci: trueand are filtered out, but a developer's or coding agent's local run has no CI marker. Each fixture is a new temp app, so one machine looks like one installation with a new project per test. Since the 1.0 RCs, four such installations account for mostgenerate:spec,secret,generate:client,dev:stop,docsandconfigevents.Harbor also sets
BLOCKS_DISABLE_TELEMETRY, which nothing reads since #1606, so Harbor runs aren't opted out either.Issue #, if available:
Changes
scripts/test-telemetry-off.envsetsCDK_DISABLE_CLI_TELEMETRY=1. Thecoreandblockstest scripts load it withnode --env-file, which works on Windows too and applies to every test process. A value already set in the environment wins. Tests that check telemetry clear the variable themselves, as before.telemetry.test.ts: two--telemetry-filetests ("handles path with spaces", "skips pre-existing file atomically") sent their event to the default endpoint. The suite now points them at a closed local port.harbor-agent-check.yml,Dockerfile,verify.py,calibrate.py):BLOCKS_DISABLE_TELEMETRY→CDK_DISABLE_CLI_TELEMETRY.The published packages don't change; the changeset exists because the guard requires one for any change under a package.
Validation
Each package's
npm testwas run with CI unset, a throwaway HOME, andBLOCKS_TELEMETRY_ENDPOINTpointed at a local collector, so every event a test would send to the default endpoint was counted:coregenerate:spec×7,deploy×2)blockssecret×12,dev×9,generate:client×8,dev:stop×8,docs×6,config×5)Test results are unchanged: core 3307 pass, blocks 680 + 52 pass.
scripts/ci/harbor-*.test.mjs: 37 pass. Changeset guards and the license-header check pass.Checklist
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.