github ryanbr/TwitchAdSolutions v68.5.57
Release v68.5.57

2 hours ago

v68.5.57 (2026-12-03)

Versions: vaft 68.5.57 (internal 143), vaft testing 715.0.14 (729); video-swap-new 1.103 (71), video-swap-new uBlock testing 636; strip 1.13 (30); twitch-brave-fix 1.3.3. Covers everything since v68.5.43.

Fixed

  • Tools — tools/capture-har.js ran again. Its get() helper was declared inside the argument-check if (isCli) block and used in the separate capture block, so every run died at once with get is not defined. The suite only requires the module, which reaches neither block, so nothing caught it until a live scan. get() is now at module scope, and a new test runs the CLI against a port with nothing listening and requires it to get as far as ECONNREFUSED. That test fails on the old code with the original error.

  • twitch-brave-fix 1.3.3 — intercepts exactly Twitch's three endpoints, and a retry names its own host. Which requests the helper watches was decided by a substring: gql.twitch.tv/gql anywhere in the URL matched a query string (?r=gql.twitch.tv/gql) or a look-alike host (gql.twitch.tv.example.com), and the userscript would then retry that request with its spoofed headers. It now parses the URL and requires https:, no embedded credentials, and exactly gql.twitch.tv/gql, gql.twitch.tv/integrity or passport.twitch.tv/integrity, behind a case-insensitive pre-filter so ordinary page fetches skip the parse. URL arguments are normalised first; they used to skip the helper. In the userscript, every GM retry sent Host: gql.twitch.tv, including retries of passport.twitch.tv/integrity; it now sends the request's own host. The spoofed Origin also had a trailing slash (https://www.twitch.tv/), which no browser sends; it is now https://www.twitch.tv. Both files' internal version flag goes from 5 to 6, and their load line now says v1.3.3 (it still said v1.3.1).

    Tested on both files through the shipped isInterceptable (five matching URLs, ten that must not match) and the userscript's shipped gmRetry with a stubbed GM xhr (Host per request, Origin without a slash). All six checks fail on the old code; four mutations (credential check, protocol check, case-sensitive pre-filter, fixed Host) are each caught.

  • strip 1.13 — the main-thread fetch hook matches Twitch's GQL endpoint exactly and no longer throws. It treated any URL containing gql as Twitch GQL and rewrote the body (the forced playerType, and the mature-content removal when enabled). It read init.body without checking that init existed, and ForceAccessTokenPlayerType defaults to 'site', so that read always ran: a fetch() with no second argument to any URL containing gql threw a TypeError out of the hook and killed the caller's own request. With DisableMatureConentPopup on, a missing or non-JSON body threw the same way. URL and Request arguments skipped the hook entirely, including the CSAI log. It now uses vaft's matcher: a case-insensitive pre-filter, then exact https://gql.twitch.tv origin and /gql path, with embedded credentials rejected. It rewrites only a string body, guards both JSON.parse calls, and normalises the URL argument first.

    Tested by driving the shipped hookFetch with the shipped csaiAdRequestUrl against a fake window. Look-alike hosts, other paths, embedded credentials and an unrelated gql URL are left alone; the rewrite still applies on the real endpoint, including an uppercase host; a missing init, non-JSON and non-string bodies, and a Request all reach the real fetch; and Request/URL CSAI requests are logged. On the old code, 9 of those checks fail. Mutation-checked six ways: the init guard, the parse guard, the credential check, the exact path, the normalised CSAI URL and the case-insensitive pre-filter each fail a test.

  • vaft 68.5.57 / video-swap-new 1.103 — values pasted into the worker are quoted with JSON.stringify. The worker is built from a template literal, and the player type plus the captured GQL headers (device ID, Authorization, Client-Integrity, and in vaft the client version and session) were pasted into it between hand-written single quotes. A ', \, or line break in any of them made the worker source fail to parse, so the worker never started and the player could not load the stream. The player type is the realistic case, since twitchAdSolutions_playerType is whatever the user typed; the header values come from Twitch and have not been seen to carry quotes. Each is now quoted with JSON.stringify, and the unset defaults (null, or undefined for Authorization) are unchanged. strip and the Brave fix inject nothing this way.

    Tested by slicing the shipped injection lines out of all seven files, rendering them with a value containing quotes, a backslash, a line break, ${, a backtick and U+2028, and running the result: every value comes back unchanged. The old code fails that, and a guard fails on any hand-quoted injection coming back. Mutation-checked one line at a time, including changing a default. Found reviewing rrro0orrr/TwitchAdSolutions.

Added

  • Tools — tools/capture-har.js --inject=<script>. Runs a script (the userscript, or a uBlock resource with its header line dropped) in the page before Twitch loads, and saves its [AD DEBUG] console output and any exceptions, from the page and the player's workers, to <har>.console.log. A capture of what Twitch serves becomes a capture of what the script did with it. Tested: the flag parses alongside the others without moving the output path, and both vaft files inject as parseable code.

  • vaft 68.5.56 — the end-of-break line reports when the playlist went live again. Twitch writes a twitch-stream-source DATERANGE with STREAM-SOURCE="live" at the exact millisecond the last stitched ad ends; on the three committed fixtures that run that far it equals START-DATE + DURATION to the millisecond. The playlist keeps its ad markers for many polls after that while the ad block is held and released, and vaft treats every one of them as still in the break: 16, 13 and 21 ad-marked polls in those fixtures. Finished blocking ads now appends playlist marked live Xs before break end (N ad-marked polls after it). It is a measurement only, to find out whether that marker could safely end a break sooner; nothing acts on it. Where every ad of the pod is stitched, the seconds repeat the existing tail: figure to within POD-FILLED-DURATION's rounding (it is floored: 30 for a 30.241s ad), so what is new there is the poll count. The two should part where the rest of the pod is client-side and the declared pod end lies far past the return to live; no committed fixture runs long enough to show that yet. It says the playlist is live again, not that the break is over, since a pod can continue client-side after its stitched ads. getDeclaredAdWindow returns it as liveResumeMs: the earliest live source starting after the last ad in the window, so the session's own pre-break source never counts and a later ad supersedes it.

    Tested on the committed fixtures through the shipped helper and the shipped per-poll update sliced out of processM3U8, plus synthetic cases. Mutation-checked: counting the pre-break source, dropping the later-ad supersede, taking the latest marker instead of the earliest, not counting polls, not resetting at detection, and printing a negative each fail.

Fixed

  • vaft 68.5.55 — removed SoftReloadNoStrip, which never took effect. Added in v68.5.0 for issue #129 mode D, it was meant to make the end-of-break reload soft when a break stripped nothing. Its choice (!hadStrippedSegments ? 'post-ad' : 'early') sat inside the else of if (!hadStrippedSegments), where that condition is always false, so every reload it governed was hard, and twitchAdSolutions_softReloadNoStrip changed nothing. Confirmed in all four vaft files and in the original v68.5.0 commit. The option, its worker injection and its localStorage key are gone, and that reload is now a literal 'early'. No behaviour change: this is what has shipped since July. The no-strip branch's own reload after a committed backup stays hard on purpose, since mixed backup/native segments in the MediaSource buffer need the flush. CLAUDE.md no longer describes the option as working. Found reviewing rrro0orrr/TwitchAdSolutions (8bddf2e), which removed it too.

  • vaft 68.5.54 — 2K/4K quality is restored after a no-strip ad break. On an HEVC/AV1 stream, ad detection reloads the player onto a master with those variants swapped for AVC, because the backups are AVC-only and a cross-codec splice risks error #4000. The strip path reloads back onto the original master when the break ends. The no-strip (CSAI-only) path cleared the flag but reloaded only if a backup had been committed, so a break with no committed backup left the viewer on the AVC substitute until some unrelated reload. It now soft-reloads back, soft like the swap itself, since a codec change has nothing injected to flush. A committed backup still gets its single hard reload, which already re-fetches the master. The break-end log line now says a reload follows when one does, instead of without player action. This also makes AlwaysReloadPlayerOnAd reload on leaving such breaks, as that option promises.

    Tested by running the shipped no-strip branch, sliced out of the teardown, against a fake stream state: soft reload when swapped with no backup, one hard reload when a backup was committed, nothing for a plain break. It passes on the fix and fails on the previous code. Found reviewing rrro0orrr/TwitchAdSolutions (31416a1).

  • vaft 68.5.53 / video-swap-new 1.102 / strip 1.12 — a playlist that fails processing is served unmodified instead of hanging the player. Every worker fetch hook called the async processAfter(response) and discarded its promise. Any throw while processing a playlist (in processM3U8, the marker removal, or the master-playlist codec rewrite) was therefore an unhandled rejection, and the player's request never settled. v68.5.34's missing blob function reached users as a loading screen and then error #2000 that way. Each of the 13 playlist sites now processes a clone() of the response and, if that fails, serves the untouched original, so playback continues, at worst with an ad for that poll. It logs Playlist processing failed, served it unmodified..., deduped to the first failure and every 30th with a running count. Network failures still reject as before, and so does the player aborting its own request (a quality switch or reload), without being logged as a processing failure. strip's blank-MP4 substitution for cached ad segments is deliberately excluded: it now rejects on failure, because serving the response it replaces would serve the ad segment itself.

    Tested through each file's shipped hookWorkerFetch (all four vaft, all three video-swap-new, strip) with processing stubbed to throw: the playlist is served unmodified and logged once, normal processing is unaffected, 31 failures log twice, network errors and player aborts still reject (aborts unlogged), the strip segment site rejects, and no unhandled rejection escapes. vaft's master-playlist path was checked the same way. Mutation-checked: reverting one site to the dropped promise, removing the dedupe, and failing open at the segment site each fail. Found reviewing rrro0orrr/TwitchAdSolutions (828c5b5, f34b7d2), which rejects the request instead.

  • vaft 68.5.52 — the clean-rescue reload skip now measures how long the stream froze. At the end of a strip break, the hard reload that flushes accumulated audio/video drift is skipped when a cycle rescue handled the break cleanly: a freeze of 2 polls or fewer, and no early reload. The break teardown zeroed TotalAllStrippedPolls before that rule read it, so the length test was always true. Any cycle-rescued break with no early reload skipped the flush, however much it had frozen. That happens when a break freezes several times in short runs: a live poll resets the consecutive count, so no run reaches the 3-poll early-reload threshold, but together they add up to more than 2 polls. It also happens when the threshold is set to 0. The count is now captured before the teardown resets it. Some breaks that skipped the reload will now reload, which is the documented behaviour.

    A new test covers the whole class rather than this one field: within the teardown block, no counter reset to 0/false/null/'' may be read on a later line. Run against the previous code, it flags exactly this read in all four vaft files and nothing else among 22-23 resets. Mutation-checked, including a read-after-reset of a different field. Found reviewing rrro0orrr/TwitchAdSolutions (a06533c).

  • vaft 68.5.51 — the backup search right after a reload no longer skips the head of its own order. For 1.5s after any reload, the search takes the first backup it gets rather than cycling (fewer requests while the player restarts). It started that at a fixed index 2, which was autoplay when the list was shorter. That index was applied after the pinned-type, fast-autoplay and contamination reorders, so it skipped whatever those had placed first and committed an arbitrary type, ad-laden or not. Examples are mobile_web or embed on a midroll, after a mid-break early reload or the HEVC reload at ad detection. The loop now starts at 0, with the type this break already committed in front, since that is the stream the player was on. A committed type known to carry ads this break stays where the contamination reorder put it.

    Tested by running the shipped ordering block, sliced out of processM3U8, with the shipped option values, on all four vaft files. Mutation-checked: dropping the contamination guard, not promoting the committed type, and restoring a fixed start index each fail. Found reviewing rrro0orrr/TwitchAdSolutions (41827be).

  • vaft / video-swap-new (all seven files) — no */ comment terminator left in code. The unknown-ad-marker regex ended [^:\n]*/gi, and that */ is half of the */ … /* pair that PR #276's author reported uBO stripping as a comment. Nothing followed it with a /*, so it was latent, but one comment such as tests/fixtures/*.json would have broken the uBlock script again. It is spelled [^:\n]{0,}/gi now: the same quantifier, with identical matches on all 164 real playlists in the fixtures plus edge cases. A new test fails on an unpaired */ or an unclosed /* in any uBlock file; mutation-checked both ways. No behaviour change, so no version bump. Ported from rrro0orrr/TwitchAdSolutions 76ab060.

  • video-swap-new 1.101 — a variant without RESOLUTION no longer defeats the cached backup. Such a variant (an audio_only rendition, say) is never put in streamInfo.Urls, so the HEVC→AVC merge loop passed undefined to getStreamUrlForResolution, which threw on .Resolution. The clean backup was still served: the player type is marked found before the merge, so the loop breaks after the catch. But storing BackupEncodings was skipped, so the cached-backup shortcut never engaged. Every ad-laden poll repeated the full token and usher search, the banner read no backup, and the error was logged each time. The function now returns null for a missing or resolution-less entry: the merge skips that variant, and the other two callers already reject a null URL inside their own catch.

    This is latent. Every variant in all seven captured masters carries RESOLUTION, so nothing Twitch sends today reaches it. Tested through the shipped setStreamInfoUrls on a real master with a synthetic audio_only variant appended, on all three video-swap-new files, and mutation-checked. Found while reviewing rrro0orrr/TwitchAdSolutions (b5b7139), which guards the merge call site only. The same commit's stale-worker guard was not ported: a field log shows Twitch constructing two workers at once, so "last constructed" is not a reliable test for "active".

  • vaft 68.5.50 — the playlist capture now redacts the twitch-assignment DATERANGE ID. It is a bare 32-hex value issued per serving assignment, beside the SERVING-ID that was already redacted, and no rule covered it. The first complete committed capture had both of its IDs removed by hand. The rule keys on the ID's shape ([:,]ID="<32 hex>") rather than on the class name, so attribute reordering cannot defeat it. COMMERCIAL-ID, AF-ICR-AD-ID, GROUP-ID and DATA-ID are untouched. Tested in both attribute orders, on all four vaft files, from synthetic input. Every committed fixture is already a fixed point, so no fixture changes.

  • Tests — the first complete 30s ad as a fixture. tests/fixtures/midroll-complete30-2026-12-02.json spans a whole 30.241s SSAI ad, contiguously on one variant: detection one poll ahead of the media, 16 of 16 ad segments, the all-ads window, the frozen MEDIA-SEQUENCE, and the +17 release. Every earlier 30.2s fixture stopped at 5-9 segments. New realComplete30 checks pin that anatomy and run every poll through the shipped strip path (0 leaked). The truncation assertion in breakAnatomy now names this fixture as the one complete exception. The capture's twitch-assignment IDs, which the shipped redaction does not cover, were removed by hand, and a test fails if any identifier comes back.

  • twitch-brave-fix (uBlock variant) — the scriptlet was cut off after 24 lines and never ran. uBlock Origin ends a user resource at the first blank line, and twitch-brave-fix-ublock-origin.js had seven. uBO stored only the first fragment, which does not parse, so none of the Brave defenses applied for uBO users. The blank lines are removed. This is the same bug PR #276 fixed in vaft's uBlock files.

    A new test-shipped.js check runs every uBlock file through a mirror of uBO's own resource parser (resourcesFromString, legacy-header path). It requires exactly one resource with the file's header, stored whole apart from column-0 // comments, which uBO drops harmlessly, and that the stored text compiles. acorn could never catch this, because it is handed the whole file. The check fails on the old brave file (24 of 117 lines stored), on a blank line, and on a column-0 # line, which uBO also drops silently.

    The userscript is unchanged, so @version stays 1.3.2.

  • vaft 68.5.49 — ADVERIFICATIONS is replaced with an empty verification list on stripped playlists. The stitched-ad DATERANGE carries the ad's verification vendors and their tracking beacons as base64 JSON. The existing rewrite only reaches attributes ending in -URL/-URLS, so this one reached the player whole. It is now replaced with base64 of {"Verification":[]} rather than "", so anything that decodes and parses it still gets well-formed input. Matched by suffix, so either ad namespace is covered.

    Whether Twitch's player actually fires these beacons for a stripped ad is not verified; this closes the gap the click-URL rewrite already closes for its own attributes. It only applies where the strip path runs: with BackupSwapFirst on, most breaks are served a backup stream instead.

  • vaft 68.5.48 — the playlist capture no longer emits ADVERIFICATIONS, and a committed fixture that leaked a maf-ad token is re-redacted. X-TV-TWITCH-AD-ADVERIFICATIONS is base64 JSON whose URLs carry signed bx= tokens and per-impression bid IDs. Every other URL in a capture has its query string stripped; base64 hid these from that rule, so they survived whole, in 74 places across seven committed fixtures. Now redacted by suffix, in both namespaces. Nothing reads it, and it was up to 60% of a fixture.

    Re-running the shipped redaction over the committed fixtures also found that midroll-fulltail-2026-12-02.json still carried X-TTV-MAF-AD-RADS-TOKEN and X-TTV-MAF-AD-AD-SESSION-ID in full: it was captured before v68.5.47 and never re-run through the new rule. The token came from the anonymous headless capture session (viewer empty). Both values are now redacted at HEAD; they remain in git history from 0f78277.

    A test now requires every committed fixture to be a fixed point of the shipped rules, which is what would have caught that; the old idempotence check covered the preroll alone. benchmark.js restores an 8640-char filler where ADVERIFICATIONS was, because production parses the real value and the re-redacted poll would otherwise measure about a fifth cheaper.

  • vaft 68.5.47 — SECURITY: the playlist capture leaked a session token from the maf-ad namespace. A capture on 2026-12-02 carried the first real twitch-maf-ad DATERANGE with its own attributes, and those use a second namespace: X-TTV-MAF-AD-, not X-TV-TWITCH-AD-. Every redaction rule named the first, so X-TTV-MAF-AD-RADS-TOKEN was emitted whole — a JWT whose payload holds session (32 hex) and video_session_id (19 digits) — along with X-TTV-MAF-AD-AD-SESSION-ID. viewer was empty on that anonymous session, which is the only thing that kept it from being worse.

    A capture exists to be pasted into a public issue, so this is the failure that matters most in that feature. The rule now keys on the attribute's suffix (RADS-TOKEN|AD-SESSION-ID|CLICK-BEACON-ID) rather than on one of Twitch's prefixes, so a third namespace cannot repeat it. COMMERCIAL-ID, DECISION, PRIMARY-POD and FALLBACK-FORMATS are kept — campaign metadata is what makes a captured maf-ad diagnosable at all.

    If you captured a fixture with v68.5.32-68.5.46 and a maf-ad marker was present, do not post it. Re-capture on 68.5.47, or strip X-TTV-MAF-AD-RADS-TOKEN and X-TTV-MAF-AD-AD-SESSION-ID by hand first.

    Driven from unredacted input in tests/test-shipped.js, since asserting over a committed fixture passes with the rules deleted.

  • video-swap-new 1.100 — the HEVC→AVC merge no longer builds a RegExp out of a playlist URL. It used new RegExp(`^.*(?=\n.*${lowResUrl})`, 'm') to find a variant's #EXT-X-STREAM-INF line, interpolating a URL from the remote master unescaped. Found while reviewing rrro0orrr/TwitchAdSolutions, whose de88d6d fixed the same class of alert in its own tree.

    Four distinct failures, each verified against the old form: a URL containing ( threw SyntaxError; ?s=1+2 in the query returned null, because + and ? are metacharacters; an undefined lowResUrl matched the literal text undefined and returned whichever line preceded it, i.e. the wrong variant; and a CRLF playlist never matched at all, since \r terminates a line for both . and ^.

    The throw is the serious one: onFoundAd runs inside the worker blob, so a SyntaxError there means no playlist and Twitch error #2000 — v68.5.34 by another route. On the one real master in tests/fixtures/ old and new agree on 2 of 2 URLs, so nothing changes for input Twitch actually sends.

    Inlined rather than factored into a helper, because onFoundAd is serialized into the blob and a helper would have needed registering in its toString list. The test therefore slices the block's own source out and evaluates it, rather than reimplementing it. A separate guard fails the build on any new RegExp( built from a template interpolation.

  • vaft 68.5.46 / video-swap-new 1.99 / strip 1.11 — the CSAI ad host is matched on the hostname, not as a substring. Every CSAI counter tested url.includes('edge.ads.twitch.tv'), so https://example.com/t?r=edge.ads.twitch.tv counted as a client-side ad request. In vaft that printed CSAI ad request ... with NO break detected — vaft never saw this ad about somebody else's URL, and armed the playlist capture with it. Ported from rrro0orrr/TwitchAdSolutions, which fixed the same thing in its own tree.

    csaiAdRequestUrl(url) parses the URL and returns it when the hostname is edge.ads.twitch.tv or a subdomain, '' otherwise. shouldBlockVodAdRequest had always done this for the actual blocking decision — only the counter beside it was guessing — and CsaiAdHost is now the first entry of VodAdRequestHosts so there is one pattern rather than two.

    It returns the URL instead of a boolean so the bp= type test runs on a string even for a Request or a URL, which also lets the XHR hooks drop their typeof url === 'string' gate: an XHR opened with a URL object was a real CSAI request that went uncounted.

    Seven scripts changed. video-swap-new-ublock-origin-testing.js has no CSAI detection to fix (it declares loggedCsaiTypes and never uses it) and is unversioned here.

Changed

  • vaft 68.5.45 — the fast-autoplay reorder log no longer claims a prior break when it was this one. LastBreakUsedEscapeHatch is set at the autoplay commit and read at the next backup-search entry; on a long break that entry is the same break. A field log (channel warn, v129, 76.6s CSAI-only break) printed Fast-autoplay first-try — prior break exhausted Source-tier directly after Autoplay backup committed — 360p fallback after 4 Source type(s) ad-laden.

    Reordering autoplay to the front is right either way — all four Source types are known contaminated — so only the message was wrong, and it was wrong in the way that costs diagnosis: it attributes this break's evidence to a break that may not exist. It now says Source-tier already exhausted this break when LoggedBackupAdsByType holds four entries, that set being cleared at break teardown and therefore able to tell the two cases apart, which LastBreakUsedEscapeHatch cannot.

    No behaviour change. Checked while looking at the same log: FastAutoplayConsecutive is not inflated by these within-break re-entries, because it only increments when autoplay commits with sourceTried === 0 and LoggedBackupAdsByType keeps its four entries until teardown.

  • vaft 68.5.44 / video-swap-new 1.98 — twitch-maf-ad and twitch-trigger are no longer ad signifiers. Both move from AdSignifiers to KnownNonAdSignifiers. They are not ad markers: measured over 4,664 real media playlists (fifteen 12-minute single-variant captures, three channels, 2026-12-02), twitch-trigger is present on 4,664 of them — every poll, break or not — and twitch-maf-ad on 1,310 of the 4,603 clean ones.

    Nothing changes today, which is the point: both entries were written as 'EXT-X-DATERANGE:CLASS="..."', anchoring CLASS= straight to the tag, and Twitch emits ID= first in 22,247 of 22,247 DATERANGE lines. They have therefore never matched anything, and that made them look like harmless dead weight. They were not. The day Twitch reorders those two attributes — a cosmetic change to its playlist template, nothing it would announce — hasAdTags would have returned true on every poll of every channel, and vaft would have behaved as though an ad break never ends: continuous backup swapping and reloads, for every user at once.

    A marker present on 100% of clean polls is not an ad signal under any attribute order, so the fix is to stop calling it one rather than to keep the entries and hope the order holds. The attribute-order fact is still worth watching and is now a test over the fixtures instead of a production behaviour.

    EXT-X-CUE-OUT stays, although it has also never fired (0 of 4,664 polls). It is correctly written as a bare substring, it is standard HLS rather than a Twitch class name, and it names a marker that has never been seen outside a break — so unlike the two removed entries it cannot fire on ordinary output. AdSegmentURLPatterns likewise stays: still 0 hits, still kept deliberately.

    Also removes a stale note in vaft-testing-ublock-origin.js claiming twitch-trigger was "added for testing soak", which the testing script had already diverged from.

Added

  • tools/capture-pod.js — captures a complete break on a single variant. capture-har.js watches the player, and Twitch's signed variant URL rotates at the break, so the player's own requests can never span a pod on one URL. Every passively captured fixture is truncated for that reason, and that truncation is what was briefly mistaken for Twitch never disclosing a pod's later ads.

    It learns a variant URL from the player, then polls that one URL every 2s via fetch() from inside the page — same origin and cookies as player traffic — straight through the break, stopping only after 45 clean polls (~90s) past the last ad-laden one. Continuity becomes ours to control rather than the player's to break. It reports a re-learn count: anything above 0 means the signed URL expired mid-run and the sequence has a hole, so it must not be committed as contiguous.

  • tests/fixtures/midroll-fulltail-2026-12-02.json — the first capture of a whole break on one variant: 168 contiguous polls, 0 re-learns, trimmed to 1 clean lead-in + 19 ad-laden + 14 clean trailing.

    It is the only fixture with trailing context, and therefore the only one that can exercise the post-break tail with a positive value: +31.0s past the declared pod end, measured where the shipped code measures it (three clean polls past the last ad-laden one). That is about one playlist window, which is direct evidence that the tail measures window length rather than an overrun — previously an inference from three field breaks all reading 34.0s.

    The pod was POD-LENGTH=1, so it still does not answer whether a capture spanning a multi-ad pod sees positions 0..N. The method now exists; it needs a run that happens to catch a bigger pod.

Changed

  • The fixture contiguity threshold moves from 2500ms to 3500ms. An actively polled variant has round-trip jitter (2620ms observed) on its ~2s cadence, while a genuinely missing poll shows ~4000ms — so this still catches a hole without rejecting a late arrival.

Tests

  • The new fixture is asserted to have trailing context at all (stripping it fails), to yield a positive tail, and for that tail to track the window length. Mutation-confirmed on two: removing the trailing polls, and a 4s hole in the sequence.

567 assertions.

Corrected

  • "Twitch marks exactly ONE ad per pod and never discloses the rest" was wrong. A 40-minute capture of pikabooirl shows a 3-ad pod disclosing positions 0 and 1, with timestamps that chain exactly — pos=0 starts 00:51:45.371 with DURATION=30.235, and pos=1 starts 00:52:15.606. Twitch discloses each ad as it starts, which is what the original comment said and what this changelog then "corrected" into a falsehood.

    Every capture that supported the wrong claim ended ~120s into its break, so each could only ever show the ad that was playing when it began. Six captures agreeing meant six captures sharing one truncation, not six independent confirmations — a truncated capture looks exactly like an absence.

    Reverted: the shipped comments in all four vaft files (the per-poll declared-end refresh is not inert — it exists because the ends arrive one at a time), the ad-spoofing coverage note (N/N is reachable for a break observed throughout, not 1/N), and the CLAUDE.md section. The affected tests now assert a property of these fixtures rather than a claim about Twitch, and their failure messages say to widen them rather than revert when a longer capture lands.

    The two-ad disclosure is not committed as a fixture: it sits on a variant with 7 polls and a 30.19s gap, and a gapped sequence must not be committed. Capturing a whole pod on one variant is still open.

Added

  • tests/fixtures/midroll-longmarker-2026-12-01.json — a complete SSAI midroll on hiimsky: 1 clean poll then 31 consecutive ad-laden ones, contiguous at 2s, with a master. The strongest strip-path input in the repo, and the evidence for the two findings below. POD-LENGTH=1 with FILLED-DURATION=15 and DURATION=15.241.

Findings from a five-channel scan

Captured hiimsky, summit1g, pikabooirl, shroud and ludwig in parallel with tools/capture-har.js, one browser each. All five caught a break inside 20 minutes.

  • Twitch marks exactly ONE ad per pod, at POD-POSITION=0, and never discloses the rest. Pods of 1/4/2/5/5 across the five channels, plus the earlier aspen capture and four breaks in a field log: every one unions to a single START-DATE over the whole break, including 31 consecutive ad-laden polls. The belief that "a multi-ad pod surfaces one ad per poll" was wrong — it surfaces one ad, full stop. So the per-poll declared-end refresh has never had anything to do (kept anyway: one regex on ad-laden polls, and it would work if Twitch changed), and ad spoofing reaches 1/N on a multi-ad pod, not the N/N its comments claimed. Comments corrected in all four vaft files; spoofing is off by default.
  • Pod seconds cannot be computed from pod length. hiimsky's one-ad pod declares 15s, while the 5-ad pods declare 150s. No multiplier fits both, which settles the n=2 doubt noted in v68.5.42 and confirms POD-FILLED-DURATION must be read.
  • The "34s tail" and the "lingering DATERANGE" are one phenomenon: the playlist window. During a break the window grows rather than slides — MEDIA-SEQUENCE stalls while segments accumulate (hiimsky pinned at 4115 for eight polls while segments went 15→21) — so an ad's segments never age out and its marker stays visible with them. A 15.241s ad kept its DATERANGE for 43.2s, with 8 ad-tagged segments still in the final window. That is why three consecutive field breaks all read tail: 34.0s despite pods of 3/2/2: 34.0s is one window length (17 × 2.0s), not an overrun. Neither competing explanation was right; they were the same thing, and Twitch was not misbehaving.

Changed

  • --break stops its trailing run at a gap >10s. A window that straddles a hole is not a committable sequence: the hiimsky capture had 31 contiguous ad polls, a 53.6s gap where the signed variant URL stopped being polled, then a resumption — and the untrimmed window reported maxPollGapMs 53568. Also recorded: variant rotation bounds a fixture's post-break context, so a trimmed fixture's tail is systematically understated.

Tests

  • Six checks over the new fixture, including that only one ad is ever marked across 31 polls, that the marker span tracks the window length rather than the ad duration, and that the window grows while MEDIA-SEQUENCE stalls.
  • A fixture must not assume MEDIA-SEQUENCE advances once per poll. The first version of these tests asserted exactly that and failed on real data; time contiguity (maxPollGapMs) is the property that matters for a committed sequence.

Added (fixtures)

  • The other four scan captures are committed too: midroll-summit1g, midroll-pikabooirl, midroll-shroud and midroll-ludwig, all 2026-12-01, pods of 4/2/5/5 declaring 120/60/150/150 seconds. Seven fixtures now. They are the evidence for the one-ad-per-pod finding, so committing them makes it reproducible rather than asserted in a changelog.
  • A generic sweep replaces per-fixture tests. Every tests/fixtures/*.json is now checked for: nothing sensitive (no address but 0.0.0.0, no signed query, and USER-IP/SERVING-ID/VIDEO-SESSION-ID/C/E redacted in any master); a filled-in description; time contiguity; exactly one ad marked across the whole break, at POD-POSITION=0; podSeconds matching the declared attribute; and the strip path leaking nothing. A new capture lands without anyone writing a test for it, and if Twitch ever discloses a pod past position 0 the sweep says so.
  • One cross-fixture check that no multiplier maps pod length to pod seconds — the sharpest form being that pod length 1 appears with both 15s and 30s. The first version keyed a Map on pod length and silently dropped one of those two, so it reported the opposite; it now collects pairs. Mutation-confirmed on three: an un-redacted USER-IP, an un-redacted SERVING-ID, and a second marked ad.

Findings from the committed fixture set

Four things the seven fixtures establish, each now pinned by a test whose failure message says what to conclude.

  • AdSegmentURLPatterns has never matched anything: 0 hits against 349 real ad-segment URLs. /adsquared/, /_404/ and /processing are inherited from upstream; detection has rested entirely on signifiers in all seven captures. They cost ~0.85µs per poll in the strip path (14 URLs × 3 patterns) for no benefit. Kept rather than deleted, since they may match a CDN shape nobody has captured — if one ever fires, that is new information.
  • Three of the five AdSignifiers never fire, and the two that do are redundant. EXT-X-CUE-OUT is 0/7, and the two CLASS-anchored entries cannot match Twitch's ID-first order. "twitch-stitched-ad" contains both stitched-ad and twitch-stitched, so a single substring does the work of the whole list: the array reads like five independent signals and is one.
  • No marker reveals an ad past POD-POSITION=0, not even the quartiles. twitch-ad-quartile is the set's most common DATERANGE class (195) and tracks progress within the one disclosed ad (QUARTILE 0..4, the five VAST events), tied to it by a shared epoch. Across the full 20-minute captures for pods of 5/5/4/2: one stitched-ad epoch, one creative, position 0 only. The one-ad-per-pod finding therefore holds against every signal Twitch emits, not just the one we read.
  • A declared pod far exceeds the ad media actually stitched in — 150s/150s/120s/60s declared against ~10-12s of ad segments. POD-FILLED-DURATION is the pod's intended length and only the position-0 ad is server-stitched, the rest presumably CSAI, which never reaches the m3u8. So these fixtures cannot validate the pod-end arithmetic end to end, and their large negative tails follow from that rather than from a bug. A logged-in session's break duration does track the full pod (field logs: 74.3/83.8/67.8s for pods of 3/2/2), which is why v68.5.42's reference is still right.

555 assertions, up from 508.

Don't miss a new TwitchAdSolutions release

NewReleases is sending notifications on new releases.