Skip to content

Fix telemetry for commands that don't require login - #607

Merged
tarcisiozf merged 3 commits into
mainfrom
fix-binding-tracking
Sep 29, 2026
Merged

tarcisiozf merged 3 commits into
mainfrom
fix-binding-tracking

Conversation

@ejacquier

Copy link
Copy Markdown
Contributor

Summary

Telemetry events for cre generate-bindings (and all other login-exempt commands) were built but silently dropped before being sent. These commands are in the isLoadCredentials exclusion list, so runtimeContext.Credentials is nil at emit time, and SendEvent bails out early with "skipping telemetry: no credentials" — the GraphQL API only accepts authenticated events.

Last recorded generate-bindings event: 2026-03-25. The break shipped in v1.18.0 (2026-06-04) via #455, which added cre generate-bindings evm / solana to the credential exclusion list. Before that, only the non-runnable parent path was excluded, so credentials loaded and events flowed.

Fix

Best-effort silent credential attach in PersistentPreRunE for commands excluded from isLoadCredentials:

  • New runtime.Context.TryAttachCredentials() — loads credentials from CRE_API_KEY or ~/.cre/cre.yaml if present. No network, no validation, no prompt, never fails. Commands remain fully usable while logged out.
  • This is systemic, not generate-bindings-specific: cre workflow build, cre workflow hash, cre update, cre workflow limits, cre templates *, etc. were all silently dropping events too.

@ejacquier
ejacquier requested a review from a team as a code owner September 28, 2026 16:08
@github-actions

Copy link
Copy Markdown

👋 ejacquier, thanks for creating this pull request!

To help reviewers, please consider creating future PRs as drafts first. This allows you to self-review and make any final changes before notifying the team.

Once you're ready, you can mark it as "Ready for review" to request feedback. Thanks!

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot review overview

🟡 Changes recommended

Credential attachment must not retain or recreate credentials across login and logout.

Review effort: Lite
Findings: 1 High severity

Open (1)
What changed in this PR

Fixes telemetry for login-exempt commands by silently attaching available credentials without affecting unauthenticated usage.

Changes:

  • Adds best-effort credential attachment.
  • Integrates credential loading into command initialization.
  • Adds credential-loading tests and a patch changeset.
File Summary
internal/​runtime/​runtime_context.go Adds silent credential loading.
internal/​runtime/​runtime_context_test.go Tests credential attachment scenarios.
cmd/​root.go Attaches credentials for excluded commands; critical handling issue remains for login and logout.
.changeset/​fix-offline-command-telemetry.md Documents the telemetry fix.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread cmd/root.go

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@tarcisiozf
tarcisiozf added this pull request to the merge queue Sep 29, 2026
Merged via the queue into main with commit 29b8ebb Sep 29, 2026
22 checks passed
@tarcisiozf
tarcisiozf deleted the fix-binding-tracking branch September 29, 2026 11:49
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.

4 participants