Skip to content

Remove telemetry-service/ now that the collector deploys from its own repo - #234

Merged
anth-volk merged 14 commits into
mainfrom
remove-telemetry-service
Nov 30, 2026
Merged

anth-volk merged 14 commits into
mainfrom
remove-telemetry-service

Conversation

@anth-volk

@anth-volk anth-volk commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #232

Summary

PolicyEngine/microcosm-collector holds the collector's source, tests and deployment, and has deployed it since 2026-10-21. This PR removes the copy that stayed here:

  • Removes telemetry-service/ (35 files), .github/workflows/telemetry-service.yml (its pull-request checks and the manual redeploy that calibration-diagnostics#233 kept as a rollback path), and frontend/tests/test_telemetry_service_workflow.py, which tested that workflow.
  • Replaces the dashboard deploy's read-secret check. .github/workflows/deploy.yml ran telemetry-service/scripts/check-secrets-exist.sh "$READ_SECRET_NAME". It now runs bash .github/scripts/deploy-dashboard.sh check-read-secret-exists, a new command in the script that already holds the deploy's shell logic. It makes the same metadata-only call, gcloud secrets describe "$READ_SECRET_NAME" --project "$PROJECT_ID" --format=none, after the same Google Cloud authentication, and never reads the secret's value. An unset or empty PROJECT_ID or READ_SECRET_NAME, or a secret that can't be described, stops the job before anything is deployed.
  • Documentation. frontend/HOSTED_RUNTIME.md ("Reading the telemetry collector", on main since this PR was written) is the one description of the dashboard's settings for reading the collector; its list of deploy steps now names check-read-secret-exists. docs/build-monitor.md says the collector's source, tests and deployment are in microcosm-collector.
  • Tests (frontend/tests/test_collector_lives_in_its_own_repo.py, new tests in test_deploy_script.py, one changed test in test_deploy_workflow.py): no tracked file is in or refers to the removed directory or workflow (asked through git ls-files, because switching a clone to this branch leaves ignored files such as .venv/ on disk); no tracked file other than Markdown documents and test modules runs a Cloud Run command that changes a service or job (gcloud … run deploy, run services update|update-traffic|replace, run jobs deploy|create|update|replace|execute, in any case, within 200 characters after gcloud, so across global flags, folded YAML, continued commands and argument lists), uses the Cloud Run deploy action, or names the collector's Cloud Run deployment settings, and committed examples test that search both ways; the new command makes exactly one gcloud call, the metadata call, and stops without calling gcloud when either setting is unset or empty.

After this PR, no tracked file refers to telemetry-service/, telemetry-service.yml, check-secrets-exist or require-collector-push-runs-finished.

Merge requirements

  1. The collector deploys from PolicyEngine/microcosm-collector: met. Its Push workflow on main first deployed on 2026-10-21, for the release of microcosm-collector#11. From then to 2026-11-27 it ran for 39 release commits; 38 succeeded, each deploying staging and then production. (Its two earlier release runs, on 2026-10-19 and 2026-10-20, skipped both deploy jobs.) telemetry-service.yml here last ran on 2026-10-21, a pull-request run that deploys nothing; its last run on main was on 2026-10-20. So no collector deploy has come from this repository since the move.
  2. Normal releases have deployed from microcosm-collector since then: met (37 more successful runs from 2026-10-22, starting with microcosm-collector#23). Deleting the manual redeploy leaves no rollback path here, and none is needed. Anthony counted 1 and 2 as met on 2026-12-01.
  3. Fresh review: replaced by this PR's review rounds (at most three), listed below.

Merging

  • Merging deploys the dashboard to production through deploy.yml, as every merge does, and that deploy runs check-read-secret-exists. Merge only when no other main CI or "Deploy production" run is unfinished: a merge cancels an unfinished main CI run and skips its deploy.
  • In the tracker, this is task 6b · 1 of "1. Collector/Emitter". Its merge also waits for substage 5b to finish there. 6b · 2 and 6b · 3 (the cleanup below) wait for it.
  • main came in with merge commit fbf00d3 (one conflict, docs/build-monitor.md's "Hosted collector" paragraph: kept main's text, which covers reading the collector with the Vercel OIDC token, and this branch's sentence about microcosm-collector). Earlier updates of this branch were rebases; from now on main comes in only by merge commits.

Deployment configuration

No variable or secret is added, removed or renamed. Values aren't listed here; each lives where the Provider column says.

Name Provider Wiring Verified
PROJECT_ID ← vars.TELEMETRY_GCP_PROJECT_ID calibration-diagnostics Production environment variable deploy job (environment: Production) → step "Check collector read secret exists" env: → deploy-dashboard.sh check-read-secret-exists → gcloud --project Name present (listed 2026-11-30). Updated on 2026-11-05; the four latest "Deploy production" runs on main (2026-11-25 to 2026-11-30) passed this step, which on main still runs the old script with the same variables and the same gcloud call
READ_SECRET_NAME ← vars.TELEMETRY_READ_SECRET_NAME Production environment variable naming a Google Secret Manager secret same step env: → gcloud secrets describe Name present; the same four runs found the secret
TELEMETRY_GCP_WIF_PROVIDER, TELEMETRY_GCP_DEPLOY_SERVICE_ACCOUNT Production environment secrets with: of google-github-actions/auth@v2, the step before; setup-gcloud then gives gcloud that login Names present; unchanged. The service account is the collector's deploy service account, which may do much more than read this secret's metadata (6b · 3)
MICROCOSM_TELEMETRY_COLLECTOR_URL, MICROCOSM_TELEMETRY_READ_SECRET_VERSION, MICROCOSM_TELEMETRY_GOOGLE_IDENTITY_PROVIDER, MICROCOSM_TELEMETRY_VERCEL_OIDC Unchanged; described in frontend/HOSTED_RUNTIME.md Unchanged Not changed by this PR

The removed telemetry-service.yml read the staging environment and most TELEMETRY_* variables of Production. After this merges, nothing reads them; see "Cleanup after merging".

Tests

Red, then green, for each change (from before main was merged in):

Commit Red (before the change) Green (after)
80a2d1c Check the collector read secret from the dashboard deploy script 5 failed: test_deploy_script.py::test_read_secret_check_reads_only_the_secret_metadata, test_missing_read_secret_stops_deployment, test_read_secret_check_requires_its_configuration[PROJECT_ID] and [READ_SECRET_NAME], and test_deploy_workflow.py::test_dashboard_checks_read_secret_metadata_before_deployment passed
3386b7c Remove telemetry-service/ 3 failed: the three tests in test_collector_lives_in_its_own_repo.py passed
5cceb49 Check the removed collector directory with git ls-files 1 failed in a clone that kept ignored telemetry-service/.venv/ and __pycache__/ folders passed
9587f51 Record every gcloud call in the read-secret check tests 2 failed against a temporary script change that also read the secret's value passed against the committed script
d4cb573 Test the read-secret check with empty settings 2 failed against a temporary script change that treated an empty value as present passed
45294f6 Find collector deploys in any spelling, outside .github too (review round 1) The previous test passed with two uncommitted planted files: a workflow using google-github-actions/deploy-cloudrun with vars['TELEMETRY_SERVICE'], and a script running gcloud beta run deploy. The new test failed, listing exactly those two passed in CI
72a6925 Match more Cloud Run deploy forms; skip only test modules (review round 2) The previous test passed with two planted files: tests/planted_collector_deploy.sh (gcloud run deploy) and .github/scripts/planted-collector-update.sh (gcloud --project "$PROJECT_ID" run services update … --image). The new test failed, listing exactly those two passed in CI
3f79f03 Test the collector-deploy search with committed examples (review round 3) Committed failing: test_collector_deploy_search_finds_deploys_and_only_deploys failed, because the single-line pattern missed the folded YAML, continued-command and one-argument-per-line examples —
0cb6223 Find gcloud deploys split over lines; ignore prose and read-only calls — CI runs it. Of the tracked files that are neither Markdown nor test modules, only deploy-dashboard.sh and deploy.yml mention gcloud, and neither runs a Cloud Run command

The merge and the documentation commit change no code or test. The last four commits change only test_collector_lives_in_its_own_repo.py. Planted files were never committed. CI runs the tests; locally only the tests above were run, selected individually, to see them fail.

Review

Adversarial review of this update, at most three rounds:

Round Head Bugs Fixes
1 8f11fb6 None. Code quality: the collector-deploy test matched exact strings under .github/ only 45294f6
2 45294f6 Low: this description's tests section described the round-1 test and its table stopped at d4cb573. Code quality: the test missed global flags before run, services update|replace and argument lists, and skipped whole tests directories This description; 72a6925
3 72a6925 Low: this description said the collector first deployed from microcosm-collector on 2026-10-22 (it was 2026-10-21) and counted 38 runs instead of 39. Code quality: the deploy search had no committed examples; its single-line gcloud pattern missed commands split over lines (folded YAML, which round 1's pattern caught) and matched prose (run deploy-frontend) and read-only run jobs describe This description; 3f79f03 (failing examples), 0cb6223

Not changed: commits 80a2d1c and 3386b7c (October) add their tests together with the change, and the table above records their failing runs. Splitting them would need a force-push. The round-3 fixes were not reviewed again: three rounds is the limit.

Cleanup after merging (manual; not done by this PR)

Each is its own tracker task and needs Anthony's go-ahead.

  • 6b · 2: delete calibration-diagnostics' staging GitHub environment, which only telemetry-service.yml used. It still holds the secrets MICROCOSM_TELEMETRY_COLLECTOR_READ_TOKEN and TELEMETRY_HF_QUALIFICATION_TOKEN.
  • 6b · 3: in Production, delete the TELEMETRY_* variables other than TELEMETRY_GCP_PROJECT_ID and TELEMETRY_READ_SECRET_NAME (keep both TELEMETRY_GCP_* secrets and MICROCOSM_TELEMETRY_COLLECTOR_URL). Then give the read-secret check its own service account: one that may only read the read secret's metadata (roles/secretmanager.viewer on that secret, not the project), which this repository's GitHub Actions jobs may act as through the existing Workload Identity provider. Point TELEMETRY_GCP_DEPLOY_SERVICE_ACCOUNT at it, check that the next deploy's read-secret step passes, then remove this repository's permission to act as the collector's deploy service account.

🤖 Generated with Claude Code

@vercel

vercel Bot commented Oct 19, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated
calibration-diagnostics Ready Ready Preview Nov 30, 2026 8:52pm UTC

Request Review

anth-volk and others added 8 commits October 22, 2026 17:12
The production dashboard deploy confirmed that the collector read secret
exists by running telemetry-service/scripts/check-secrets-exist.sh. It now runs
`deploy-dashboard.sh check-read-secret-exists`, which makes the same metadata-
only `gcloud secrets describe` call with the same PROJECT_ID and
READ_SECRET_NAME from the Production environment, so the deploy no longer
depends on telemetry-service/.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… repo

PolicyEngine/microcosm-collector holds the collector's history, source, tests
and deployment. Remove telemetry-service/, its telemetry-service.yml workflow
(including the manual redeploy kept for rolling the deploy-source switch
back), and the test of that workflow. Point the build monitor's
documentation at the collector's repo.

New tests require that the directory and workflow stay removed, that no
tracked file refers to either, and that no workflow or workflow script here
deploys the collector's Cloud Run service or migration job.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The test asserted that telemetry-service/ did not exist on disk. Switching an
existing clone to this branch removes the tracked files but leaves ignored
ones, such as .venv/ and __pycache__/, so the test failed there. It now
requires that git tracks no file under the directory or at the removed
workflow's path.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Removing telemetry-service/README.md removed the only description of the
dashboard's own settings for reading the collector. Move it into the Build
progress documentation: MICROCOSM_TELEMETRY_COLLECTOR_URL,
MICROCOSM_TELEMETRY_READ_SECRET_VERSION and
MICROCOSM_TELEMETRY_GOOGLE_IDENTITY_PROVIDER, the Vercel OIDC trust, the
per-environment secret access, local development with Application Default
Credentials, and what the production deploy's read-secret check does and
doesn't show.

Also correct the claim that the read credential comes from the deployment
environment: the server fetches a Secret Manager version itself.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Production deployments don't take MICROCOSM_TELEMETRY_COLLECTOR_URL from the
Vercel project's settings: deploy.yml passes the GitHub Production
environment variable of the same name to vercel deploy --env. The read secret
version and the identity provider do come from the Vercel project.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The gcloud stub replaced its arguments file on each call, so the tests saw
only the last call. A check that first read the secret's value with
`gcloud secrets versions access` and then ran the describe call passed
test_read_secret_check_reads_only_the_secret_metadata. The stub now
appends one record per call, and the tests compare the full list: exactly
one `gcloud secrets describe` call when the secret exists or is missing,
and no call when a setting is missing. The old script's test on main
compared the full list of calls too.

Test-only; the script already makes just the describe call. Against a
temporary, uncommitted change to the script that adds the value-reading
call, this file gave 2 failed (the two tests above); against the committed
script, 7 passed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
GitHub Actions expands `${{ vars.NAME }}` to an empty string when the
variable doesn't exist, so a missing TELEMETRY_GCP_PROJECT_ID or
TELEMETRY_READ_SECRET_NAME reaches check-read-secret-exists as an empty
PROJECT_ID or READ_SECRET_NAME. The tests only removed the variable. Run
each case both ways: the check must fail, name the setting, and not call
gcloud.

Test-only; the script already treats an empty value as missing. Against a
temporary, uncommitted change that treats an empty value as present
(`${!name+x}` in place of `${!name-}`), this file gave 2 failed (the two
empty cases: the check exited 0 after calling gcloud); against the
committed script, 9 passed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
telemetry-collector-client.ts accepts plain HTTP for both localhost and
127.0.0.1, but the settings table named only localhost.

Documentation only, so no red step.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
anth-volk and others added 2 commits November 30, 2026 22:56
Brings in 425 commits from main (1e5e147). One conflict, in
docs/build-monitor.md's "Hosted collector" paragraph: keep main's text,
which covers the Vercel OIDC way of reading the collector and points to
frontend/HOSTED_RUNTIME.md, and keep this branch's sentence saying the
collector's source, tests and deployment are in
PolicyEngine/microcosm-collector.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… collector

main's frontend/HOSTED_RUNTIME.md now has "Reading the telemetry
collector", which covers the same settings as this branch's "Reading the
collector" section in docs/build-monitor.md, plus
MICROCOSM_TELEMETRY_VERCEL_OIDC and MICROCOSM_BUILD_MONITOR_COLLECTOR_ONLY,
which that section omitted. Remove the section, so the settings are
described once, and name deploy-dashboard.sh check-read-secret-exists in
HOSTED_RUNTIME.md's description of the production deploy.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Review round 1 found that the test for "nothing here deploys the
collector" matched exact strings under .github/ only, so it missed
`gcloud beta run deploy`, google-github-actions/deploy-cloudrun,
`vars['TELEMETRY_SERVICE']`, lowercase names, and scripts outside
.github/ that a workflow runs.

The test now matches regular expressions in any case, in every tracked
file except Markdown documents and test directories (main's workflow
tests use `vars.TELEMETRY_SERVICE` as a fixture), and lists files through
git like the module's other tests.

Red: with two uncommitted files added with `git add -N`, a workflow using
deploy-cloudrun with `vars['TELEMETRY_SERVICE']` and a script running
`gcloud beta run deploy`, the old test passed and the new one failed,
listing exactly those two files. Test-only: no workflow or script here
deploys the collector.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Review round 2 found that the collector-deploy test missed global flags
before `run` (`gcloud --project "$PROJECT_ID" run deploy`),
`gcloud run services update` and `replace`, and argument lists, and that
skipping every directory named `tests` was wider than needed and skipped
Python test directories but not TypeScript fixtures.

The `gcloud` pattern now allows anything on the same line between
`gcloud` and `run`, quotes and commas as separators, and
`services update|update-traffic|replace`. Instead of directories, the
test skips test modules by file name (`test_*.py`, `*_test.py`,
`*.test.*` and `*.spec.*` JavaScript and TypeScript files), whose
patterns and fixtures name these settings.

Red: with two uncommitted files added with `git add -N`,
tests/planted_collector_deploy.sh running `gcloud run deploy` and
.github/scripts/planted-collector-update.sh running
`gcloud --project "$PROJECT_ID" run services update … --image`, the
previous test passed and this one failed, listing exactly those two
files. Test-only.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
anth-volk and others added 2 commits December 1, 2026 00:50
Review round 3 found that the collector-deploy test only asserted an
empty result, so a broken pattern would still pass, and that the
single-line `gcloud` pattern missed commands split over several lines
of text: a folded YAML block (which the round-1 pattern caught), a
command continued with a backslash, and an argument list with one item
per line. It also matched prose such as "run deploy-frontend" and the
read-only `gcloud run jobs describe`.

Move the search into collector_deploying_files and test it with files
that deploy the collector and files that deploy nothing or are skipped
(Markdown documents and test modules). This commit fails: with the
current patterns, the search misses the folded, continued and
one-argument-per-line examples.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The `gcloud` pattern now looks up to 200 characters past `gcloud`,
across line breaks, for `run` followed by a command that changes a
service or job: `deploy`; `services update`, `update-traffic` or
`replace`; `jobs deploy`, `create`, `update`, `replace` or `execute`.
Words may be separated by whitespace, line breaks, quotes, commas or
backslashes, and the command must be followed by one of those or the
end of the file, so `run deploy-frontend` in a comment and the
read-only `gcloud run jobs describe` no longer match. The Cloud Run
action must end at a word boundary.

Makes test_collector_deploy_search_finds_deploys_and_only_deploys pass
(CI runs it). Among tracked files that are neither Markdown nor test modules, only
.github/scripts/deploy-dashboard.sh and .github/workflows/deploy.yml
mention gcloud, and neither runs a Cloud Run command (git grep).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@anth-volk
anth-volk marked this pull request as ready for review November 30, 2026 21:55
@anth-volk
anth-volk merged commit 919a62b into main Nov 30, 2026
5 checks passed
@anth-volk
anth-volk deleted the remove-telemetry-service branch November 30, 2026 21:55

This branch was successfully deployed

1 active deployment
Preview — 0cb6223d Deployed Nov 30, 2026 by vercel[bot]
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.

Remove telemetry-service/ after the collector deploys from microcosm-collector

1 participant