T7.10 - D5: one analytics implementation, and its report on the admin console
Usage analytics existed as five of the nine colliding globals creator-frame.md counted (ANALYTICS_KEY, analyticsLoad, analyticsSave, downloadAnalytics, showAnalytics), twice - and the wizard's copy had no caller, because the button lived on the creator. The admin console had a THIRD private reader (usageLoad/downloadUsage) that only saw the wizard's key. Now: ONE core, html/wp-usage.js (window.WPUsage: load/save/track/download + the two pre-move storage keys, verbatim). The creator and wizard keep only a thin track() wrapper - page state like the creator's dev-mode pause belongs to the page - and record exactly what they recorded before, under the same keys, so everything captured before this task still reads (probe plants a legacy-format event and finds it in the report). The "Usage data" button left the creator toolbar; the report lives in admin.html's usage card, covering BOTH tools with a download each, behind the same admin gate as the rest of the console (a non-admin sees the denied card and nothing else), usable at 390px. Two probes re-pointed, both with the reason in the code: - cards_check pinned admin.js byte-identical to HEAD - right for T6.5, but as a standing probe it would fail every legitimate later edit; D5 targets admin.js by name. A7's localization is protected by the feature checks and the end-to-end drive, plus a wiring assertion on the block itself. - frame_check listed "Usage data" among the toolbar buttons that must be visible; it now asserts the button is GONE, so the duplicate cannot quietly return. Verification (each probe run alone): NEW tests/usage_check.py 15/15 (grep half: WPUsage defined once, no page touches the keys directly, none of the five globals survives anywhere). Regressions: cards_check ALL PASS, frame_check 39/39. Items: D5 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -244,8 +244,13 @@ def page_checks(page, base, tok):
|
||||
});
|
||||
return JSON.stringify(out);
|
||||
})()"""))
|
||||
for label in ("Sample SOP", "Load example", "View SOP", "Import SOP", "Usage data"):
|
||||
# "Usage data" left this list at T7.10: D5 moved the report to the admin
|
||||
# console. Its absence HERE is asserted, so the button cannot quietly return
|
||||
# and recreate the duplicate D5 existed to remove.
|
||||
for label in ("Sample SOP", "Load example", "View SOP", "Import SOP"):
|
||||
chk("%-13s is visible on the unframed page" % label, vis.get(label) is True, vis)
|
||||
chk("Usage data is GONE from the creator toolbar (D5)",
|
||||
"Usage data" not in vis, vis)
|
||||
chk("...and every one of them has a handler that exists", page.eval("""(() => {
|
||||
return [...document.querySelectorAll('#wp-toolbar button')].every(b => {
|
||||
const m = (b.getAttribute('onclick') || '').match(/^([A-Za-z_$][\\w$]*)\\(/);
|
||||
|
||||
Reference in New Issue
Block a user