Skip to content

feat: report login funnel events (login_started, login_cancelled) - #2238

Merged
Tweekazoid merged 3 commits into
mainfrom
feature/login-funnel-telemetry
Aug 4, 2026
Merged

feat: report login funnel events (login_started, login_cancelled)#2238
Tweekazoid merged 3 commits into
mainfrom
feature/login-funnel-telemetry

Conversation

@PetrDlouhy

@PetrDlouhy PetrDlouhy commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

What

Login-funnel telemetry, split out of #2228 so it can proceed independently of the machine-ID question. Now covers the full funnel:

  • login_started — which add-on surface prompted it (placement) and whether it was signup
  • login_cancelled — user closed the login dialog
  • login_completed — OAuth finished, tokens received
  • login_failed — OAuth errored, with the user-facing message (truncated) so failure reasons are countable server-side

Together with the UTM tags (#2227) that makes the −25% sign-in decline attributable per surface and per failure mode: prompted → clicked → landed → completed/failed/abandoned.

How

client_lib.report_event() posts fire-and-forget through Blendkit-Client's /report_event route, which forwards to the server in the background. It creates no Task and surfaces nothing to the UI — telemetry can never break or annoy login. Server contract: POST /api/v1/telemetry/events/ (BlenderKit-server#3263, live in production).

The completed/failed events live in handle_login_task, not write_tokenswrite_tokens is shared with token refresh, which must not count as a login (guarded by a dedicated test).

Tests

TestLoginTelemetry: started-with-placement, cancelled via the real operator, completed, failed-with-message, and refresh-does-not-fire-completed. TestReportEvent: correct Client URL/payload, never raises. Also registers the previously-dormant tests/test_bkit_oauth.py module in tests/test.py — it had never run in CI.

Stack

#2227 (merged) → this#2228 (stable machine ID, on hold)

🤖 Generated with Claude Code

@codecov

codecov Bot commented Jul 28, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 30.32%. Comparing base (9db8810) to head (2f5e935).

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #2238      +/-   ##
==========================================
+ Coverage   29.84%   30.32%   +0.47%     
==========================================
  Files          79       79              
  Lines       25751    25816      +65     
==========================================
+ Hits         7685     7828     +143     
+ Misses      18066    17988      -78     
Flag Coverage Δ
python 30.32% <100.00%> (+0.47%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
bkit_oauth.py 59.49% <100.00%> (+20.53%) ⬆️
client_lib.py 59.05% <100.00%> (+0.68%) ⬆️
tests/test.py 0.00% <ø> (ø)
tests/test_bkit_oauth.py 100.00% <100.00%> (+100.00%) ⬆️
tests/test_client_lib.py 96.86% <100.00%> (+0.20%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

PetrDlouhy and others added 2 commits July 29, 2026 10:17
The UTM tags added in the previous PR only see clicks that reach the
browser. These events cover the rest of the funnel: which add-on surface
prompted a login (placement + signup), and users who click and then
abandon before the browser flow completes - the gap that made the -25%
sign-in decline impossible to attribute per surface.

client_lib.report_event() posts fire-and-forget through Blendkit-Client's
/report_event route (bk_client), which forwards to the server in the
background and surfaces nothing to the UI - so nothing breaks or warns
while the server endpoint does not exist yet. CLIENT_VERSION follows the
submodule bump to v1.12.0.

Server contract: POST /api/v1/telemetry/events/ with {"event", "data"};
implemented in BlenderKit-server#3263.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Codecov reported the new telemetry lines as uncovered. The cause was not
a missing test: tests/test_bkit_oauth.py was never listed in test.py's
_test_modules, so the whole module - including the OAuth tests that
predate this branch - has never executed in CI. Registering it makes the
existing login/signup tests and the new telemetry test actually run.

Also adds a test for the cancel path, the one telemetry line no existing
test reached.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@PetrDlouhy
PetrDlouhy changed the base branch from feature/utm-link-attribution to main July 29, 2026 08:18
@PetrDlouhy
PetrDlouhy force-pushed the feature/login-funnel-telemetry branch from b56843b to 8e40958 Compare July 29, 2026 08:18
Closes the funnel: started/cancelled alone cannot tell an abandoned
browser flow from a failed OAuth exchange. The events live in
handle_login_task, not write_tokens - write_tokens is shared with token
refresh, which must not count as a login. login_failed carries the
user-facing error message (truncated) so failure reasons are countable
server-side.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@Tweekazoid
Tweekazoid merged commit c65c5a7 into main Aug 4, 2026
30 checks passed
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.

2 participants