Skip to content

fix: fetch the profile for telemetry only when telemetry is enabled - #240

Closed
angeloashmore wants to merge 2 commits into
mainfrom
aa/telemetry-and-test-stability
Closed

fix: fetch the profile for telemetry only when telemetry is enabled#240
angeloashmore wants to merge 2 commits into
mainfrom
aa/telemetry-and-test-stability

Conversation

@angeloashmore

@angeloashmore angeloashmore commented Jul 28, 2026

Copy link
Copy Markdown
Member

Resolves:

Description

The CLI fetched the user profile on every command, even when telemetry and Sentry were both disabled. Under concurrent runs against the same user, these calls can 500. The profile is now fetched only when telemetry or Sentry is enabled, and the env var overrides feed the same flags.

Also marks the write-token tests as sequential because Wroom 500s under concurrent same-user write-token creates.

Checklist

  • A comprehensive Linear ticket, providing sufficient context and details to facilitate the review of the PR, is linked to the PR.
  • If my changes require tests, I added them.
  • If my changes affect backward compatibility, it has been discussed.
  • If my changes require an update to the CONTRIBUTING.md guide, I updated it.

Preview

How to QA 1

Run any command with telemetry disabled and confirm no request to /profile is made.

🤖 Generated with Claude Code


Note

Low Risk
Behavior change only skips profile API calls when observability is disabled; token refresh logic is unchanged.

Overview
Startup no longer calls /profile when both telemetry and Sentry are off, which avoids extra Wroom traffic and concurrent 500s when many CLI processes share the same user.

telemetryEnabled and sentryEnabled are resolved once (including PRISMIC_TELEMETRY_ENABLED / PRISMIC_SENTRY_ENABLED overrides) and reused for init and for gating getProfiletrackUser / sentrySetUser.

Write-token integration tests in token-create and token-delete are it.sequential with a note that Wroom errors on concurrent same-user write-token creates.

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

Footnotes

  1. Please use these labels when submitting a review:
    ❓ #ask: Ask a question.
    💡 #idea: Suggest an idea.
    ⚠️ #issue: Strongly suggest a change.
    🎉 #nice: Share a compliment.

angeloashmore and others added 2 commits July 28, 2026 18:45
Every CLI invocation fired a fire-and-forget /profile request even with
telemetry disabled, since the call sat outside the telemetry gates. In CI
this put every spawned CLI process on user-service concurrently, which
starts returning 500s at roughly eight concurrent same-user requests.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Wroom's settings/security/token endpoint intermittently returns 500 when
the same user fires concurrent write-token creates, which the concurrent
test mode did across CI matrix jobs.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Comment thread test/token-create.test.ts
@angeloashmore
angeloashmore force-pushed the aa/telemetry-and-test-stability branch from 141041d to fe45ddd Compare July 28, 2026 19:10

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit fe45ddd. Configure here.

Comment thread test/token-delete.test.ts

it("deletes a write token", async ({ expect, prismic, repo, token, host }) => {
// Wroom 500s under concurrent same-user write-token creates; keep this sequential.
it.sequential("deletes a write token", async ({ expect, prismic, repo, token, host }) => {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Write-token tests still race across files

Low Severity

it.sequential only serializes tests within a file. With default file parallelism, write-token creates in token-create.test.ts can still overlap createWriteToken in token-delete.test.ts for the same E2E user, so the Wroom 500 race the comments call out can persist.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit fe45ddd. Configure here.

@angeloashmore

Copy link
Copy Markdown
Member Author

Folding this into #229 instead.

@angeloashmore
angeloashmore deleted the aa/telemetry-and-test-stability branch July 28, 2026 19:20
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