Spoofing-on debug instrumentation (counters + startup log) - #235
Open
ryanbr wants to merge 1 commit into
Open
Conversation
Three small additions to make the opt-in spoofing path easier to diagnose and A/B against the now-default-off state. Pure observability — no behavioral change. No version bump per the no-per-PR convention; bullet added under ## Unreleased. 1. Startup log when DisableAdSpoofing is false: surfaces the opt-in state clearly + names the source (localStorage opt-in vs modified default). 2. Worker session counter (notifyAdComplete.sessionAdsSpoofed, function-property pattern matching existing loggedNoMatch / loggedBadStatus) appended to the existing 'Spoofed ad completion' line as '[session: N ads spoofed]'. 3. Main-thread session counter (sessionCsaiRequests) appended to the 'CSAI ad request detected' line as '[session: K CSAI requests so far]'. Counter increments on every edge.ads.twitch.tv request (not gated by the once-per-type dedup), so the value shown is the true running total at first-of-each-type emission. Lets two sessions on the same channel (one spoof-on opt-in, one spoof-off default) be directly compared on total ads spoofed and total CSAI requests delivered. That's the data any future spoofing default decision should be based on. Testing pair shipped direct to master at 73ee921 — same first two changes (testing pair has no edge.ads.twitch.tv fetch-hook, so no CSAI counter there). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.
Three small additions to make the opt-in spoofing path easier to diagnose and A/B against the now-default-off state. Pure observability — no behavioral change to spoofing, ad-blocking, or the GQL beacon flow. No version bump per the no-per-PR convention;
## Unreleasedbullet under### Diagnostics.What this PR does
(1) Startup log when spoofing is enabled. After the
twitchAdSolutions_disableAdSpoofinglocalStorage handler, an additionalif (!DisableAdSpoofing)block fires a clear startup line:Source is named distinctly:
localStorage opt-invsmodified default(in case someone patched the default in their own copy). Replaces the previous shorter "enabled via localStorage opt-in" log.(2) Worker session counter on
Spoofed ad completion:Counter held on
notifyAdComplete.sessionAdsSpoofed(function-property pattern matching the existingloggedNoMatch/loggedBadStatusstyle — survives across calls within one worker instance).(3) Main-thread session counter on
CSAI ad request detected:Counter (
sessionCsaiRequests) declared at module scope, incremented on everyedge.ads.twitch.tvrequest (placed before the existing once-per-type dedup gate, so the value shown is the true running total at the point of first-of-each-type emission). Counts every CSAI request, not just unique types.What this enables
Two sessions on the same channel — one with
twitchAdSolutions_disableAdSpoofing='false'(spoof-on opt-in), one with default-off — become directly comparable on:Whichever is bigger (or smaller) under spoof-on vs spoof-off is the actual empirical answer to "does spoofing affect ad delivery" — which the disable hypothesis (PR #232 / v68.3.0) has been unable to test without this kind of counter. The localStorage opt-in was already there; this just makes the A/B's output legible at a glance.
Scope notes
Spoofed ad completionline — same transform on each. (1) and (2) shipped to the testing pair already at master commit73ee921. The release pair adds (1) + (2) + (3); the testing pair doesn't have theedge.ads.twitch.tvfetch-hook detection, so the CSAI counter is release-only.video-swap-new: spoofing is vaft-only; no port needed.🤖 Generated with Claude Code