fix: separate token-refresh outcomes from login events [Better data collection] - #2300
Open
PetrDlouhy wants to merge 2 commits into
Open
fix: separate token-refresh outcomes from login events [Better data collection]#2300PetrDlouhy wants to merge 2 commits into
PetrDlouhy wants to merge 2 commits into
Conversation
Blendkit-Client delivers token *refresh* outcomes as "login" tasks, one per connected add-on, so login_completed counted every silent refresh and login_failed was 100% refresh failures on production (84 of 84 rows). handle_login_task now names the event by preferences.login_attempt, which is set only by LoginOnline and cleared by write_tokens, cancel and register(): login_completed/login_failed for add-on-started logins, token_refreshed/token_refresh_failed otherwise. The refresh failures stay visible under an honest name - 16 machines were being force-logged-out by 400s on refresh. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
The helper built token_refresh_completed; the tests and the server-side relabel (Blendkit-server#3871) use token_refreshed. Pass both names explicitly instead of composing them. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2300 +/- ##
==========================================
- Coverage 33.22% 33.22% -0.01%
==========================================
Files 86 86
Lines 27246 27254 +8
==========================================
+ Hits 9053 9054 +1
- Misses 18193 18200 +7
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Blendkit-Client emits token-refresh outcomes as
"login"tasks (RefreshToken→NewTask(…, "login"), one per connected add-on).handle_login_tasktherefore reported refreshes as logins. Measured on production (2026-09-11):login_completed: ~405 of 1,816 rows (22%) have nologin_startedfrom the same machine within 30 min — refreshes and per-instance duplicates.login_failed: 0 of 84 follow alogin_started; 79 areFailed to refresh token: … 400on 16 machines. The event measured forced logouts, not failed logins.Fix
The event name follows
preferences.login_attempt, which isTrueonly betweenLoginOnline.executeandwrite_tokens/cancel/clean_login_data, and is reset atregister()(crash-safe):login_attemptlogin_completedtoken_refreshedlogin_failedtoken_refresh_failed(+ message)The refresh failures keep flowing under an honest name — they're a real signal (users silently logged out).
Tests
Four cases via the real add-on preference; the earlier
write_tokenstest is removed — it guarded the wrong seam (refreshes never reachwrite_tokensdirectly).Server side
A refresh emits one task per open Blender instance → dedup by
(system_id, minute)server-side. Existing production rows get relabelled by BlenderKit-server PR (D in the plan) using the OAuth grant type, so this fix is a precision improvement for new versions, not a prerequisite.🤖 Generated with Claude Code