Skip to content

Spoofing-on debug instrumentation (counters + startup log) - #235

Open
ryanbr wants to merge 1 commit into
masterfrom
fix/spoofing-debug-instrumentation
Open

Spoofing-on debug instrumentation (counters + startup log)#235
ryanbr wants to merge 1 commit into
masterfrom
fix/spoofing-debug-instrumentation

Conversation

@ryanbr

@ryanbr ryanbr commented May 21, 2026

Copy link
Copy Markdown
Owner

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; ## Unreleased bullet under ### Diagnostics.

What this PR does

(1) Startup log when spoofing is enabled. After the twitchAdSolutions_disableAdSpoofing localStorage handler, an additional if (!DisableAdSpoofing) block fires a clear startup line:

[AD DEBUG] AdSpoofing ENABLED (localStorage opt-in) — firing GQL ad-tracking beacons on every ad-laden poll. Default is OFF as of v68.3.0; opt-in mode for A/B testing. Watch session counters appended to "Spoofed ad completion" / "CSAI ad request detected" lines to compare with a spoof-off session on the same channel.

Source is named distinctly: localStorage opt-in vs modified 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:

- ... pod-complete: yes
+ ... pod-complete: yes [session: 7 ads spoofed]

Counter held on notifyAdComplete.sessionAdsSpoofed (function-property pattern matching the existing loggedNoMatch / loggedBadStatus style — survives across calls within one worker instance).

(3) Main-thread session counter on CSAI ad request detected:

- ... not blockable via m3u8)
+ ... not blockable via m3u8) [session: 4 CSAI requests so far]

Counter (sessionCsaiRequests) declared at module scope, incremented on every edge.ads.twitch.tv request (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:

  • Total ads spoofed across the session
  • Total CSAI requests delivered to the session

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

  • All 4 vaft files share the Spoofed ad completion line — same transform on each. (1) and (2) shipped to the testing pair already at master commit 73ee921. The release pair adds (1) + (2) + (3); the testing pair doesn't have the edge.ads.twitch.tv fetch-hook detection, so the CSAI counter is release-only.
  • video-swap-new: spoofing is vaft-only; no port needed.
  • acorn-clean on both release files.

🤖 Generated with Claude Code

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>
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