[wrangler] Send login user metric when --scopes is provided#14299
Conversation
`wrangler login` was already reporting the `login user` event when called
without `--scopes`, but the scoped login path returned early before the
event could be sent. Both paths now share a single `login(...)` and
metrics call site, so successful scoped logins are counted alongside
unscoped ones.
Adds a regression test that spies on the metrics module and asserts that
`sendMetricsEvent("login user", ...)` is invoked after a successful
`wrangler login --scopes account:read`.
🦋 Changeset detectedLatest commit: 14eae06 The changes in this PR will be included in the next version bump. This PR includes changesets to release 3 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
Codeowners approval required for this PR:
Show detailed file reviewers |
|
This confirms the refactor is behaviorally equivalent. When Let me verify the Let me also check whether Now let me double-check the test assertion The change is correct, minimal, behaviorally equivalent for the unscoped path, fixes the gap for the scoped path, includes a regression test and a changeset. No logic bugs, security issues, or backward-compat violations. LGTM |
|
✅ All changesets look good |
create-cloudflare
@cloudflare/deploy-helpers
@cloudflare/kv-asset-handler
miniflare
@cloudflare/pages-shared
@cloudflare/unenv-preset
@cloudflare/vite-plugin
@cloudflare/vitest-pool-workers
@cloudflare/workers-auth
@cloudflare/workers-editor-shared
@cloudflare/workers-utils
wrangler
commit: |
workers-devprod
left a comment
There was a problem hiding this comment.
Codeowners reviews satisfied
Wrangler's
logincommand was already reporting thelogin usertelemetry event when run without--scopes, but the scoped login path returned early before the event could be sent. Both paths now share a singlelogin(...)call site and a singlesendMetricsEvent(...)call, so successful scoped logins are counted alongside unscoped ones.This was spotted by an automated review on #14064 as a pre-existing gap, and split out into its own PR.