Skip to content

feat: report attempts to use locked assets (locked_asset_clicked) [Better data collection] - #2301

Open
PetrDlouhy wants to merge 2 commits into
claude/save-presencefrom
claude/locked-asset-clicked
Open

feat: report attempts to use locked assets (locked_asset_clicked) [Better data collection]#2301
PetrDlouhy wants to merge 2 commits into
claude/save-presencefrom
claude/locked-asset-clicked

Conversation

@PetrDlouhy

Copy link
Copy Markdown
Contributor

Why

The unlock links' UTM tags (#2243) only see users who reach the browser. A user who drags a locked asset, sees "Unlock all assets" and closes the dialog was invisible — and the server never sees the encounter, because the add-on gates on canDownload before making any request. Conversion rates need the denominator; the per-asset demand signal ("which locked assets do people try?") did not exist at all.

What

locked_asset_clicked with {asset_base_id, asset_id, asset_type, placement, variant} at the three seams where a locked asset is acted on:

seam placement
drag-and-drop, unpurchased add-on addon_purchase_drag
drag-and-drop, Full-plan asset asset_unlock_drag (+ popup copy variant)
detail panel unlock button asset_unlock_panel (+ variant)

Same vocabulary as the UTM tags, so encounters and click-throughs join — and the unlock-copy A/B test (support/now/join) finally has a per-variant denominator instead of click-through counts only.

Asset ids are sent deliberately (decision with Petr): they make locked assets comparable by demand even for anonymous machines, which become attributable once the machine signs in (stable system_id), and they let the server-side interest mail show the actual assets. Consumed by Blendkit-server's locked_assets_interest flow.

Design

  • One helper, unlock_options.report_locked_asset_click, three callers.
  • The panel button gets a dedicated wm.blenderkit_unlock_asset operator (reports, then opens the tagged URL) rather than an if inside the generic wm.blenderkit_url — the same SRP point agajdosi raised on this PR's base.
  • client_lib.report_event returns early when "Send usage data" is off — the add-on side of the rule that everything on /report_event is optional; the Client drops it as well (bk_client#53). download.usage_reports_enabled now delegates to the same read.
  • The preference text now says what the switch covers: assets in saved/rendered files, sign-in prompts, locked-asset attempts (asset id); never downloads, search or sign-in.

Tests

test_unlock_options.py (payload, missing keys), TestReportEvent.test_opted_out_sends_nothing (+ the preference pinned in the existing tests), TestUnlockAssetOperator (reports then opens the tagged URL; empty variant omitted). The drag-op branches are exercised only through the shared helper — the drag operator itself has no unit harness.

Stack

Stacked on #2296 (claude/save-presence): needs its preference and releases with it. Client side: bk_client#52 → bk_client#53.

🤖 Generated with Claude Code

The unlock links' UTM tags only see users who reach the browser; who
tried a locked asset and walked away was invisible, and the server never
sees the encounter because the add-on gates on canDownload before any
request. This event fires at the three places a locked asset is acted on
- both drag-and-drop upsell dialogs and the detail panel's unlock button
- with the asset ids, the surface and the popup copy variant, so the
encounters share one vocabulary with the UTM click-throughs and the
unlock-copy A/B test finally has a denominator.

Asset ids are sent on purpose: they make locked assets comparable by
demand (anonymous machines included, joinable to an account once it
signs in through the stable system_id) and let the web side follow up on
real interest.

The detail panel gets its own operator instead of a branch in the
generic wm.blenderkit_url. report_event now honours the "Send usage
data" preference (the Client drops it too, bk_client#53); the preference
text says exactly what the switch covers.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@PetrDlouhy PetrDlouhy self-assigned this Sep 11, 2026
The panel referenced the module without importing it, which the new
operator test exposed (the draw path itself has no test).

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@codecov

codecov Bot commented Sep 11, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 88.73239% with 8 lines in your changes missing coverage. Please review.
✅ Project coverage is 34.26%. Comparing base (f191d57) to head (1f1af73).
⚠️ Report is 2 commits behind head on claude/save-presence.

Files with missing lines Patch % Lines
ui_panels.py 75.00% 5 Missing ⚠️
asset_bar/asset_drag_op.py 0.00% 2 Missing ⚠️
download.py 0.00% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@                   Coverage Diff                    @@
##           claude/save-presence    #2301      +/-   ##
========================================================
+ Coverage                 34.10%   34.26%   +0.15%     
========================================================
  Files                        87       88       +1     
  Lines                     27527    27583      +56     
========================================================
+ Hits                       9388     9450      +62     
+ Misses                    18139    18133       -6     
Flag Coverage Δ
python 34.26% <88.73%> (+0.15%) ⬆️

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

Files with missing lines Coverage Δ
__init__.py 0.00% <ø> (ø)
client_lib.py 60.04% <100.00%> (+0.35%) ⬆️
tests/test_client_lib.py 96.92% <100.00%> (+0.05%) ⬆️
tests/test_ui_panels.py 97.98% <100.00%> (+0.12%) ⬆️
tests/test_unlock_options.py 100.00% <100.00%> (ø)
unlock_options.py 75.86% <100.00%> (+3.86%) ⬆️
download.py 20.79% <0.00%> (+0.03%) ⬆️
asset_bar/asset_drag_op.py 7.39% <0.00%> (-0.02%) ⬇️
ui_panels.py 23.76% <75.00%> (+0.43%) ⬆️

... and 2 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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