summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2026-10-14Give a stored break its kindPeter Stone
Existing rows become advertising, which is what they behaved as: every row in this table was skipped unconditionally before kinds existed. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018AwnALZL6bD4VBtATDVv3B
2026-10-14Publish what kind each break isPeter Stone
The phone filters on it: advertising is always skipped, the show's own audio by preference. Without the kind on the wire every break arrives looking like an advertisement.
2026-10-14Fix break classification for zero-served and short episodesPeter Stone
Finding 1: Treat zero or invalid servedMs as unjudgeable, falling back to advertising classification to match the constraint that anything unjudgeable must be conservative (ffprobe duration probe returning 0 is plausible upstream defect). Finding 2: Use proportional edge windows for short episodes (< 240s) to avoid misclassifying interior and closing breaks as intro when opening and closing windows overlap. For a short episode with breaks at 0s, 50s, 90s in a 100s episode, classify them correctly as intro, cue, outro instead of all intro.
2026-10-14Decide whether a break is advertising or the show's own audioPeter Stone
An episode no longer than its declared length had nothing inserted into it, so whatever recurs in it is the show's furniture however strongly it matched. 138 of 322 mirrored episodes are in that position and the scan published ad breaks on 111 of them.
2026-10-12Plan the break-kinds slice and the furniture toggleClaude
Eight tasks covering the spec decisions end to end: the server decides a kind for every break it publishes, the phone stores it, advertising is always skipped and a show own intro, cue and credits follow one preference, and the readout names which is which. The cue prior and the furniture library are deliberately not planned here. Each is independently shippable, and the cue signature thresholds should be chosen against kinds visible in real data rather than guessed at before any exist. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018AwnALZL6bD4VBtATDVv3B
2026-10-08Play episodes whose enclosure is still cleartext httpClaude
Reported from the phone: Show 62 of Hardcore History failed with ERROR_CODE_IO_CLEARTEXT_NOT_PERMITTED. Android has refused cleartext since API 28 and this app declares no exemption, so any enclosure published over http fails the moment it is streamed rather than played from a downloaded file. Dan Carlin's older episodes are published that way while the recent ones are not, which is why it went unnoticed; the manifest has not changed since long before the skip server, so this is not a regression from that work. Upgrading the scheme rather than permitting cleartext: that exact URL answers 200 over TLS and a range request returns 206 audio/mpeg, podcast CDNs serve the same path either way, and an exemption would weaken every other request the app makes for the sake of a few old enclosures. A host with genuinely no TLS is no worse off, since cleartext was refused already. Two paths, because they do not share a stack. Everything that goes through OkHttp -- downloads, feeds, chapters, artwork -- is covered by an interceptor on the one client the graph builds, which is the right home for a property of the app's networking rather than of any one feature. ExoPlayer has its own data source, so playback converts the URI as it builds the media item. Putting the conversion at the downloader's call site instead broke four of its MockWebServer tests, which was the tests making a fair point: a global network policy does not belong at one call site. Components under test build their own client and are untouched by the interceptor. Also stops the server starving on-demand episode requests. The poll loop and the request queue share a goroutine, so an episode the phone asked for waited out the whole cycle -- hours across 42 shows, which is why the tap that produced this report registered the episode and never fetched it. Now drained before each feed, bounding the wait at one feed. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018AwnALZL6bD4VBtATDVv3B
2026-10-08Record the approach-2 decision and the furniture toggleClaude
Approach 2 chosen, built in the phase order already proposed -- it is a superset of approach 1, so the ad-detection work still lands first and the library last. Advertising is always skipped; the show own intro, cue and credits obey a single preference defaulting to on, because that is what happens today. The toggle settles a bootstrapping question the design had left open. A furniture clip cannot be promoted until a second fetch occasion has passed, so until then there is nothing to label with. The zero-gap classification fills that gap: served length equal to declared means nothing was inserted, so every break is furniture and position decides which kind; otherwise a break is advertising unless a promoted clip says otherwise. Day one is correct on the 138 zero-gap episodes and identical to current behaviour everywhere else. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018AwnALZL6bD4VBtATDVv3B
2026-10-08Design: separate a show's own audio from the inserted advertisingClaude
Three defects turn out to be one missing distinction. Ad detection finds a median 67% of the advertising the length gap implies, because it can only see what two simultaneously-mirrored episodes share. It reports a show's own intro, break cue and credits as advertisements on 111 of the 138 episodes that had nothing inserted into them. And intro/outro offsets stay withheld for want of independent evidence. Peter's observation about theme music around ad breaks is the clue, and probing it showed both what it gives and what it does not: the cue is real, already detected, and marks a break's entry but not its extent -- scanning to r=0.6 finds one isolated hit per slot in ad-laden and ad-free copies alike, so there is no closing cue to bracket against. Writing this up changed the recommendation. The furniture library is only needed for the intro/outro problem; the mislabelling falls out exactly and for free from served length versus declared, and cues are identifiable from their signature within a single batch. So the proposal is now the cheap approach first, with the library kept for later and only if the withheld offsets are wanted. Nothing here is built. Review document, not an implementation. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018AwnALZL6bD4VBtATDVv3B
2026-10-08Bridge ad pods fragmented by brief lapses in agreementClaude
A pod of several advertisements is found as several matches, because agreement lapses between them. Published unbridged, 45% of the gaps between consecutive breaks came in under ten seconds and 152 of 262 multi-break episodes contained one -- which plays as a skip, a one-to- nine-second burst of advertisement, then another skip. Bridging also moves agreement with the declared length gap from 69% to 73% median, because what was bridged was advertising too. MaxBreakMs now applies to the matches rather than to what bridging makes of them. Applied after bridging it refused five episodes that bridging had pushed over the four-minute cap, Radiolab's Grass Apes among them -- a 3:55 pre-roll and an 0:18 tag two seconds apart fuse to 4:15, and the episode the whole chain was device-verified on would have published nothing. One enormous match is evidence of shared programme; a chain of ordinary matches a beat apart is evidence of an ad pod. MaxSkipFraction still guards the episode as a whole. Also pins the ad scan's production values, which were measured rather than picked, and records what probing Peter's theme-music observation turned up: the cue is real and already detected, it marks a break's entry but not its extent, a second fetch is not an ad-free reference, and 138 of 322 mirrored episodes contain no inserted advertising at all while the scan reports breaks on 111 of them. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018AwnALZL6bD4VBtATDVv3B
2026-10-07Examine each batch once instead of every pollClaude
The first full pass over all 42 feeds finished, then the server kept re-deriving the same answers: Radiolab reported "53:29 of 59:39" four times in one day. pollOne called detect unconditionally and the mirror skips files it already has, so nothing had changed between passes. At ~6.5 minutes a show that is 4.5 hours a cycle against a two-hour poll interval -- the machine never finished a cycle and never idled, burning 13h42m of CPU in 11h of wall clock, roughly 60% of it on the intro search whose results are deliberately not published. Show.DetectedBatch records the episode ids a completed pass examined. The batch is the unit rather than the episode because every offset and every break comes from comparing an episode against the others fetched alongside it, so one arrival or one pruning legitimately changes all of them. Order-independent, since feeds are not reliably sorted. Recorded only on completion, so a cancelled or failed pass is retried. Episode.DetectedAtUnix could not serve as the gate: it is only set for episodes appearing in result.Offsets, so an episode nothing was found in never got a timestamp and the gate would never close. Also records what the first full corpus showed, including a disproven hypothesis worth not retrying -- filtering breaks by partner count or run length looks obviously right and makes agreement with the declared length gap substantially worse -- and a correction: Sleepy History's 117 minutes of "advertising" was a show-level sum sitting almost entirely inside the two episodes its own guard already refused. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018AwnALZL6bD4VBtATDVv3B
2026-10-06Follow the data: detect the advertising, not the introPeter Stone
The property that broke intro detection is the property that makes this work. Eight episodes mirrored within one minute are maximally dependent, because the ad server inserts whatever campaign is running into all of them identically. For intro detection that destroys the independence the confirmation threshold needs -- which is how it came to confirm an advertisement on 8 of 8 episodes. For ad detection it is the signal. And unlike intro detection it is checkable against a number the detector does not produce: the feed declares the ad-free length, the file served is longer, and the difference is the advertising. **Measured on the live deployment, Radiolab's eight mirrored episodes: the scan accounted for 53:29 of the 59:39 the length gap implies, with every individual episode between 71% and 105%.** That is the first time detection in this project has been checked against external ground truth and agreed with it. The old sliding search could never have done this -- one full-length correlation per window position, 199 seconds for a 240-second clip. BestLags computes the cross-correlation over every lag in a single FFT pair, which says where two recordings align; MatchedRuns then walks the extent of the agreement directly, window by window, with no transform. Sized against measurements rather than guesses: 2^22 is 1.69s, so a 70-minute episode decimated to 250Hz is about five seconds a pair. Silence is explicitly not agreement, or separate advertisements weld together across the pauses between them. Breaks publish as ranges into episode_midrolls, which MidrollSkip and PlayheadPolicy already read -- no playback changes and no migration. Intro and outro offsets are still computed and logged but no longer published, and the ad-derived ones already in the server's state were cleared. Two guards publish nothing rather than something wrong: an episode whose matches cover over 35% of it, and any single match over four minutes. A re-aired episode or a two-parter would otherwise be eaten. Both record the refusal, because "found nothing" and "refused what it found" are different states and conflating them is the readout mistake over again. Also three data-loss bugs, found by reading the journal after a restart rather than by any test. The subscription list -- the one thing the server cannot rediscover -- was persisted only when a whole poll cycle finished, which for 61 feeds is hours. A cycle re-applied its stale snapshot at the end, which would undo a push that arrived during it and then delete the audio of every show the snapshot omitted. And detection ignored cancellation, so systemd's 90-second stop SIGKILLed the process before the save-on-exit could run. All three fixed. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018AwnALZL6bD4VBtATDVv3B
2026-10-05Move skip detection to a server, and find that it detects adsPeter Stone
The server is Peter's design and it works: listend polls the phone's feed list, mirrors the newest 8 episodes per show, detects across all of them at once, and serves the offsets *and the audio they belong to*. Deployed on tungsten behind Apache at https://listen.terst.org. FingerprintWorker and MidrollWorker are deleted -- the battery drain is gone because the work is. Serving the audio is load-bearing. Dynamic ad insertion turned out to be on every episode: Grass Apes declares 22:05 and the server was served 28:18. An offset measured on one copy is minutes wrong for another, so the phone has to play the bytes the detector examined. The offsets land in the same columns the on-device detector wrote, so playback needed no changes and there is no migration. **The headline finding is a failure, and it is proved rather than suspected.** Detection reported the intro confirmed on 8 of 8 Radiolab episodes and passed its self-check. It had locked onto an advertisement. The chosen segment was searched for in an ad-free copy of the same episode fetched hours earlier: r = 0.0621. It is in the ad break, not the programme. The confirmation threshold assumes three *independently fetched* episodes. Mirroring 8 within one minute from the same ad server makes them maximally dependent -- whatever campaign is running is in all of them, identical -- and SelfCheck cannot catch it, because the segments genuinely are the same audio. Moving to a server fixed the cost problem and broke the independence the safety mechanism rests on. The published offsets are head-window matches, so they happen to skip pre-roll advertising, which is useful by accident and will move whenever the campaign rotates. It is not intro detection and is not described as such anywhere. The fix, not made: record when each episode was fetched and require the agreeing episodes to span more than one fetch occasion. Reasoning, and an argument for detecting the ads directly instead, in docs/detection-findings.md. Also recorded there: two tooling traps that each cost real time. `android-ui tap` can land on the soft keyboard, because the dump reports layout coordinates the IME does not move -- a Save button and a text field both appeared tapped and neither fired. And the server's token is alphanumeric now because `adb shell input text` ate the leading "-" of a base64url one and produced a silent 401 that looked like broken wiring. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018AwnALZL6bD4VBtATDVv3B
2026-10-05Find why Tier 3 never confirmed, and port detection to GoPeter Stone
Peter's report: the phone runs hot, uses a lot of battery, playback takes a moment to start, and intelligent skipping has never done anything. **The hot phone and the dead detection were one bug.** The candidate search correlated 117 window positions against the whole of the other clip, re-transforming that unchanged clip every time -- 199 seconds per episode end, measured on a desktop, so minutes more on a phone. FingerprintWorker is a plain WorkManager worker, Android stops one at ten minutes, and nothing was persisted until a comparison returned. So it was killed mid-flight, saved nothing, and was re-enqueued to start over, forever. IntroOutroDetectorScaleTest is the tripwire whose absence allowed this: the unit tests ran on 300-sample clips while production ran on 1,920,000. Fixed coarse-to-fine, plus AudioCorrelation.prepareTarget so the target clip is transformed once per search rather than 117 times. 10.6x, and a test asserts the chosen reference window is byte-identical to what a full-resolution search picks. **Midroll detection could never have run at all.** decodeFull buffered a whole episode at its native rate -- 434MB for a 13-minute episode, no largeHeap -- to produce 6MB of 8kHz mono. It threw OutOfMemoryError into a swallowing runCatching and the episode was then marked checked forever. MonoResampler now streams the decode so the peak allocation is the output, and maxDecodableMs skips a longer episode before spending anything and without marking it checked. **Detection is moving to a server**, Peter's call, in Go to match podkit and doot. server/ holds the ported core, verified three ways because this is the second port of this maths and the first shipped a normalization bug: numpy's literals extracted mechanically from AudioCorrelationTest, the FFT against a direct DFT, and the whole correlation path against a brute-force Pearson. On four real Radiolab episodes it confirms the intro on 4 of 4, at 48.0s, 8.65s, 8.65s and 65.15s -- the varying pre-roll, observed in working code at last. skips.SelfCheck verifies located segments against *each other* rather than against the reference, which is a different claim: correlation is not transitive, so two segments can each clear 0.6 against a reference and be unrelated. It rejected the outro on its first real run (r=0.746), withholding offsets that would have ended three episodes early. Offsets are published only when they verify. Also: the episode screen gets a working scrubber with ad-break marks and a declared-versus-measured length readout, queue rows open the episode instead of doing nothing, PrepareTrace logs playback-start timing against episode length for the still-open pause question, and -PphoneOnly drops the emulator's CPython from a sideload build (114MB -> 99MB). Full history and numbers in docs/detection-findings.md. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018AwnALZL6bD4VBtATDVv3B
2026-09-29Protect a show's Tier 3 pending episode from retention reclaimPeter Stone
Peter's call (option 1 of the three in docs/detection-findings.md): exempt an episode retention would otherwise reclaim while it is a show's pending comparison basis, rather than extending the grace period or accepting the gap. RetentionSweeper gains a pendingEpisodeIds seam (suspend () -> Set<String>, defaulting to empty) and filters its reclaim candidates against it before the grace-period policy ever sees them -- every existing caller and test was unaffected by the default. RetentionWorker wires the real thing: the union of two new, narrow DAO queries -- ShowFingerprintDao.getAllPendingEpisodeIds() (intro/outro) and MidrollDao.getAllMidrollPendingEpisodeIds() (midroll, reading SubscriptionEntity.midrollPendingEpisodeId). Applied to both fingerprinting mechanisms, not just the one that got diagnosed: MidrollUpdater's discovery has the identical rolling-pending- episode shape and would race retention the same way for a fast show, just silently, with no frozen row to reveal it. Not yet re-verified on a device -- the next live test is two Up First downloads close enough together to actually compare, confirming pendingEpisodeId advances to a real second episode instead of restarting. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Sj3CoWEedM56bebByKgNxA
2026-09-29Find the actual root cause: retention races the pending-episode filePeter Stone
Triggered a fresh Up First download on the phone and watched androidx.work.workdb and show_fingerprints immediately after, live. A new FingerprintWorker job appeared and succeeded within seconds, and show_fingerprints updated for the first time since 2026-09-27 -- but instead of advancing toward a second comparison, it just replaced the stale pending episode with the new download. confirmedCount stayed 0. That's checkAgainstPending's own designed fallback when pendingClipOf can't re-decode the stored pending episode because its file is gone. And it is gone: RetentionPolicy's grace period is one day, and Up First is a fast, daily, ~15-30 minute news show that gets played through quickly. By the time a second episode is downloaded and processed, retention has very often already reclaimed the first one's file -- so the detector never gets two episodes' audio to compare at once, and keeps discarding its only candidate and restarting from whatever the newest download is. Cruising the Waves reaching a real Tentative candidate the same day is consistent with this: a show whose downloads happen to land further apart, or whose previous pending episode hadn't been played+reclaimed yet, doesn't hit the race. This was never a signal-processing problem -- DEFAULT_REFERENCE_SECONDS, MIN_SCORE and CONFIRM_THRESHOLD were the wrong place to look the whole time. Wrote up three options (exempt a pending episode from reclaim, extend the grace period for a show still building its first candidate, or accept the gap for fast shows) as a decision for Peter, not something to just change. Separately unresolved and now secondary: Up First's actual second download (2026-09-28) left zero trace in show_fingerprints, which the live test's fallback path would have if it had run at all -- most likely a deferred or dropped one-shot WorkManager job, not reproduced live this session. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Sj3CoWEedM56bebByKgNxA
2026-09-29Find the real Tier 3 blocker: Up First's second episode never got comparedPeter Stone
The phone reconnected mid-session, so this moved from desktop simulation to live device state -- pulled listen.db and WorkManager's own execution history straight off it (read-only, via run-as + adb exec-out cat, nothing modified). The pipeline is not broken: show_fingerprints for Cruising the Waves Podcast shows a real Tentative INTRO candidate (confirmedCount=2, a populated referenceClipPcm) from an ordinary download today. Something does reach Tentative on this exact build. Up First specifically is stuck, and the evidence is more precise than "nothing found yet" suggested. Its show_fingerprints row for both INTRO and OUTRO hasn't updated since 2026-09-27T02:19 -- the moment its very first episode was ever processed. A second real episode was downloaded, played, and swept by retention the next day, and its midrollCheckedAtMs is set, proving MidrollWorker's decodeFull read that exact file successfully that day. But FingerprintUpdater.processEnd calls fingerprints.upsert() on every outcome, confirmed, tentative, or discarded -- so if any comparison involving that second episode had run at all, the row's updatedAtMs would have moved. It didn't. The second episode's FingerprintWorker run either was never enqueued, or decodeHead/decodeTail both returned null for it, and the latter looks unlikely given decodeFull succeeded on the identical file the same day. Read EpisodeDownloader.downloadOverHttp end to end looking for a download-vs-playable race; there isn't one -- it's a blocking download to .part then an atomic rename before onDownloaded fires. WorkManager prunes completed WorkSpec rows after about a week, so the actual historical FingerprintWorker run (if any) for that episode is already gone. Narrows "What to check on the phone" to one live test: trigger a fresh Up First download and watch androidx.work.workdb and show_fingerprints immediately after, the same way this session just did. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Sj3CoWEedM56bebByKgNxA
2026-09-29Disprove the leading Tier 3 detection hypothesis on real Up First audioPeter Stone
The brief's leading hypothesis -- an 8-second reference window too wide for a ~6-second sting -- does not survive contact with real data. Simulating IntroOutroDetector.findCandidate exactly (the same normalized_xcorr/best_match math AudioCorrelation.kt uses, unmodified) against the four Up First episodes already cached from the original prototype: every one of six pairs confirms cleanly at both ends, at the app's real DEFAULT_REFERENCE_SECONDS=8 and MIN_SCORE=0.6 -- intro r 0.79-0.998, outro r 0.994-0.999. Also ruled out: the naive linear-interpolation resampler MediaCodecClipSource actually uses. Reproduced it exactly against a fresh re-fetch's native 44.1kHz audio and compared to a proper ffmpeg decode -- 0.9991 correlation, and the production simulation confirms identically either way. Two findings beyond the original brief: - Pre-roll length varies a lot (44s-94s across four episodes) but the global search already handles that; it isn't the blocker the first draft worried it might be. - The same episode URL, fetched fresh today against a copy from 2026-09-26, is byte-identical for the first ~50 seconds and then diverges completely -- sharper evidence for "dynamic ad insertion is the environment" than the Radiolab duration mismatch alone, though it lands after the useful intro signal so doesn't threaten detection specifically. Experiment 6 (re-check the Darknet Diaries trap) didn't need a new fetch -- the midroll prototype session's already-cached data answers it: the shared ~51s segment still matches at r=1.000 across a nine-year gap, which a truly rotating per-request ad could not do by chance. Looks like a real intro, not the trap the threshold exists to catch. Net effect: the algorithm and its tuned constants are no longer plausible suspects on real audio. What's left points at the specific on-device run rather than the approach -- see "What to check on the phone" for the three concrete things to look at that this sandbox has no way to check itself. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Sj3CoWEedM56bebByKgNxA
2026-09-29Write the desktop session's brief for Tier 3 detectionPeter Stone
The fingerprinting runs on a device now and has still confirmed nothing for a real show. That is an open question, not a known bug, and answering it needs the prototype rather than the app -- only the prototype can show what a parameter change costs in false positives, which is the number that matters here. docs/detection-findings.md collects what this round established: that the pipeline works, that the confirmation threshold earns its place, and the finding that reframes the problem -- dynamic ad insertion means the same Grass Apes came back 29:34 on one fetch and 27:39 on another, so ad content and the offset of everything behind it differ per request. It lists the experiments in order, including using insertedAdMs as ground truth for the midroll scan, and what not to touch. Linked from the known-gaps list, which is where a future session looks. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018AwnALZL6bD4VBtATDVv3B
2026-09-29Start shared timestamps playing, and stop the feed clobbering real lengthsPeter Stone
**The hand-off.** Sharing a timestamped YouTube link now opens Listen on the player, already playing at that point. Two things were missing. The timestamp was only honoured on first insert -- the insert ignores a clashing guid, so every share after the first silently did nothing and playback resumed wherever Listen had last left it, which is exactly the going-back- and-forth case. And nothing started playing; the video landed in the library to be found. Re-sharing now moves the position and unplays the episode, because sharing a moment in something you finished is how you go back to it. A share with no timestamp still just adds it quietly -- interrupting whatever is playing would be rude. **A regression in yesterday's duration fix, found by following Peter's own observation.** He noted the 22:05-vs-29:34 gap was probably content versus ads. It is -- and that has two consequences I had missed. The first is that `EpisodeMatcher.mergedWith` rewrites `durationMs` from the feed on every refresh, correctly, because it is feed metadata. Writing the measured length into that column meant the correction survived until the next refresh and then silently reverted. So there are two columns now: `durationMs` stays the feed's claim, `actualDurationMs` is what the player measured, and `playbackDurationMs` prefers the latter. The second is that the wrong number was never only cosmetic. It sizes the decode buffer a full-episode midroll scan allocates -- truncating the scan by minutes on precisely the shows that have midrolls -- places the outro offset, and drives the finished check, which would mark a 29-minute episode played at 21 and advance the queue. Those all read `playbackDurationMs` now. And the third thing, which is Peter's idea and free: the difference between the two numbers is the advertising in the episode, with no audio analysis at all. `insertedAdMs`, shown on the episode screen, and a check on the midroll detector -- whatever it eventually finds should add up to about that much. Measuring it turned up something worth knowing: the same Grass Apes came back 7:29 longer than declared on one fetch and 5:34 on another. Insertion happens per request, so this is a property of a file, not of an episode. Verified on the emulator. Hand-off: cold start into the player at 12:39 from a stored 12:30, and the warm onNewIntent path at 25:14 from 25:00. The YouTube resolver itself cannot be exercised here -- this host gets a 302 bot page for every watch URL, as CLAUDE.md already records -- so the new code was driven through the intent it receives, with the resolver's own behaviour unchanged. Durations: list showed 22m on a fresh subscribe, 27m after playing, with 1325000 and 1659454 stored separately, and the episode screen reading "Ads inserted ~5:34". 550 unit tests, 12 migration tests on device, detekt and lint clean. Coverage 92.96% -> 93.02%. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018AwnALZL6bD4VBtATDVv3B
2026-09-28Correct durations from the file, and make the notification open the appPeter Stone
Two from Peter, one of which turns out to matter more than it looks. **The list said 22m, the player said 29:34.** The feed is lying, not the parser: Radiolab publishes Grass Apes as `00:22:05` and the file ExoPlayer opens is 29:34. Checked against the live feed rather than guessed. The seven and a half minutes between them are dynamically inserted advertising -- the feed declares the ad-free content length and the CDN stitches in the rest -- so the error is large, systematic, and worst on exactly the shows the midroll detector exists for. The player is the first thing in the app that sees the truth, so PositionWriter now writes it back, through a new narrow PlaybackStateDao. Once per episode rather than once per tick: this runs on the position timer for the length of an episode, and a lookup on every tick is precisely the per-episode work that does not scale. A two-second disagreement is left alone, being a container arguing with an encoder rather than a lie, and an unprepared player reporting nothing never wipes what the feed said. PlaybackStateDao is a split by meaning, not by count -- it owns the two things playback learns and writes back, the only writes in the app whose loss is unrecoverable. It also keeps EpisodeDao under detekt's interface limit, which the new query had pushed it over; the config's own comment argues against splitting a DAO to satisfy a count, so this splits it for a reason that would stand on its own. **Tapping the notification opens the app**, via setSessionActivity. It had none, so the transport buttons worked and the body did nothing, which reads as breakage rather than omission. Verified on the emulator against the real feed: Grass Apes stored as 1325000ms on subscribe, 1770553ms after twenty-five seconds of playback. The notification now carries `contentIntent=PendingIntent{... startActivity}` in dumpsys -- I confirmed the intent is attached and targets this app's activity, but did not simulate the physical tap. That same dump corroborates what I told Peter about the notification being Auto's doing and not ours: importance=2, sound=null, vibrate=null, category=transport. ExoPlayhead joins the coverage exclusions. It is four one-line getters over ExoPlayer that happen to live in PlaybackService.kt, so it read as covered by that entry while actually being measured -- it is the seam that makes PositionWriter testable, not logic. 540 unit tests, detekt and lint clean. Coverage 92.73% -> 92.96%. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018AwnALZL6bD4VBtATDVv3B
2026-09-28Keep bedtime shows out of the car, and midroll clips out of the databasePeter Stone
Peter, on the sixty-second cap from the last commit: "won't be enough for tangle or the daily show at least. Both have theme music around ads at the end at least." He is right, and the cap was the wrong trade -- trimming a clip to fit a database row truncates the very thing being identified, and the music wrapping a break is part of what makes it recognisable. So the clips leave the database. MidrollClipStore writes them as files beside the audio library and the row holds a path, which removes the length limit rather than negotiating with it: three minutes is 2.88MB, and a CursorWindow hands back nothing over 2MB. Migration 10->11 drops existing candidates instead of converting them -- a migration cannot write files, and every stored candidate was written under the sixty-second cap, so it is the wrong length anyway. They are a cache; detection starts again. The intro/outro fingerprints are untouched, being eight seconds and correct. StoredClip.fits now guards the one decoded clip still kept in a row, the intro/outro reference, at the point it is written. Unreachable at the current eight seconds, and there precisely because this table already shipped a clip that was not. Bedtime shows are gone from Android Auto's browse list too, as asked. Driving is the opposite of falling asleep and a car list is scrolled blind at a traffic light -- the same argument that already hides played episodes there. Voice search still reaches them: asking for a show by name is unambiguous about wanting it. Found while doing it: unsubscribing never deleted anything from disk. The dialog has always promised "episodes, downloads and playback positions", and the rows did cascade -- taking with them the only record of where the downloaded audio was, so the files stayed forever with nothing pointing at them. Midroll clips would have joined them. Unsubscriber deletes the files first and the row last, because the other order is exactly how the leak happened, and it drops the row even if a file will not delete: a show stuck in the library is the worse failure of the two. Verified: 533 unit tests, detekt and lint clean, 11 migration tests on the emulator. Coverage 91.84% -> 92.73%. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018AwnALZL6bD4VBtATDVv3B
2026-09-28Bedtime shows, dimmed caught-up shows, a show menu, and skip visibilityPeter Stone
Four things Peter asked for, plus a crash found while verifying them. - Bedtime shows. A per-show flag (schema 8->9) that takes a show out of the library entirely; the moon icon in the top bar switches to listing only those. Not a category system -- the one grouping worth building is the one with behaviour attached, which is that entering bedtime mode also arms the sleep timer. BedtimePolicy owns the two cases that make that safe: it will not overwrite a timer set by hand, and leaving only cancels a timer bedtime itself armed. The mode is deliberately not persisted; a restart is morning. - Shows with nothing waiting are dimmed. Same condition the library sort already used -- nothing unplayed and unqueued -- now returned alongside it as SubscriptionListing.hasWaiting. That comes from a COUNT rather than the sort key on purpose: an episode with no publish date ranks at 0, which is right for ordering and would have greyed out a show with one sitting unheard. LibraryOrderTest pins that case. The lastError line keeps its error colour through the dimming, since a failing feed looks exactly like a feed with nothing new. - Per-show controls moved into an overflow menu and a settings sheet, and the tutorial prose is gone. Reaching the episodes used to mean scrolling past drip cadence and two paragraphs; Peter wrote the requirements and does not need them explained back. Unsubscribe went into the same menu, off the top bar where it sat one tap from Refresh. - Skip detection is visible at last, per show and per episode. SkipSummary is pure and its wording is tested, because the distinction that matters is confirmed-and-acting versus still-gathering, and "not checked yet" is a third state again -- midroll scanning runs nightly, so a fresh download legitimately has nothing to say yet. And the crash. Opening the new readout on a device threw SQLiteBlobTooBigException, which turned out not to be the readout's fault: show_fingerprints.pendingClipPcm held a whole decoded head/tail window -- 240s at 8kHz is 3.84MB as 16-bit PCM -- and Android reads every Room row through a CursorWindow that refuses anything over 2MB *on the way out*. The insert succeeded and the next read threw. Intro/outro detection therefore died the moment a show's second episode was fingerprinted and could never have worked as shipped; nothing off-device could have caught it. Migration 9->10 drops the column and keeps only pendingEpisodeId, re-decoding on demand -- exactly what midrollPendingEpisodeId already did for the same reason. StoredClip now owns the limit, MidrollUpdater caps a candidate segment at 60s before persisting it (a long sponsor block would hit the same wall) and refuses anything that still would not fit, and StoredClipSizeTest pins both against the limit so the class cannot come back quietly. Trimming under-skips a very long break rather than over-skipping into content, which is the safe direction. Verified on the emulator: 10 migration tests including the never-before-run 7->8, LibraryOrderTest, and the whole reported flow by hand -- bedtime split, timer arming and cancelling, the dimmed row, both readouts. Re-ran the exact sequence that crashed: three downloads, no crash, FingerprintWorker SUCCESS, and the MP3 decoder visibly running, which is the first time MediaCodecClipSource has executed on hardware at all. Still open, and recorded in CLAUDE.md rather than glossed: detection has not actually confirmed an intro or outro for a real show. Three Up First downloads left both ends "Nothing found yet". Possibly correct -- the threshold is strict by design -- or possibly the 8-second reference window against a roughly 6-second sting. That wants the desktop prototype, not a guess at a tuned constant. Coverage 91.76% -> 91.84%. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018AwnALZL6bD4VBtATDVv3B
2026-09-26Extend Tier 3 fingerprinting to midroll ad breaksPeter Stone
Desktop-prototyped first, same discipline as the intro/outro half: three Darknet Diaries episodes spanning 2026 and one from 2017 were fetched fresh and cross-correlated. Beyond the show's fixed ~51s intro (present unchanged across all nine years), the same coarse-to-fine scan found a second, shorter segment recurring at a *different* timestamp in every episode's body and independently present in the 2017 episode too -- a real recurring house promo, not a coincidence of two fetches landing close in time. That two-episode, different-position, still-present-nine-years-later shape is exactly what a midroll break looks like and exactly what IntroOutroDetector was never built to find: it only ever compares fixed head/tail windows. Midroll detection means scanning a whole episode body, and a show can have several distinct breaks at once, not one fixed slot per end. - MidrollScanner: pure, single-resolution "find every segment two recordings share, wherever each has it" -- deliberately position-agnostic, built on the existing AudioCorrelation primitive rather than a new one. - Decimate: block-averaging downsample, the coarse half of a coarse-to-fine split. A brute-force native-rate scan across a full episode measured 30-160s per episode *pair* on a desktop CPU in the prototype; MidrollUpdater runs MidrollScanner once on ~8x-decimated audio to find candidates cheaply, then re-verifies each at full resolution with a single AudioCorrelation call -- both for a trustworthy score and to reject anything the decimation made look like a match but isn't. - MidrollDetector: IntroOutroDetector's confirm/discard state machine, generalised from one candidate per show to a list. A candidate an episode doesn't confirm is discarded outright, same discipline, same reason: the Darknet Diaries trap applies here too. - MidrollUpdater: orchestrates discovery and confirmation per show. Discovery compares the show's single rolling "pending" episode against whatever is newest; unlike ShowFingerprintEntity's pendingClipPcm, no audio is stored for it between runs -- a pending *whole episode* is tens of megabytes of PCM, not the few seconds an intro/outro clip costs, so the file is re-decoded from disk on demand and the pending slot just moves forward if it's since been reclaimed by retention. A real bug the tests caught: the same segment surfaces again every time the pending pointer rolls forward, which without dedup became a second row for content already tracked. Fixed by recognising a fresh discovery hit as already-tracked by *where* it landed in the new episode (MidrollDetector.allMatches), not by re-correlating extracted clip content, which two different coarse passes don't reliably extract the same sub-range of. - Storage: AppDatabase 7->8, a show_midrolls table (one row per candidate, not per show -- several breaks can be tracked at once) and an episode_midrolls table (the confirmed ranges detected per episode). EpisodeEntity gains midrollCheckedAtMs (per-episode, not a show cursor, so an out-of-order backfilled download still gets checked). SubscriptionEntity gains midrollPendingEpisodeId. - Playback: MidrollSkip mirrors AdChapters' shape exactly. PlayheadPolicy checks it unconditionally, same as intro/outro -- no per-show toggle, the confirmation threshold is the safety mechanism. PlaybackSources grows a midrolls() method alongside chapters() rather than threading a new DAO through PlaybackAdvancer's constructor, which would have pushed it over detekt's LongParameterList threshold for no real reason. - Trigger: MidrollWorker runs nightly while charging, not per-download like FingerprintWorker -- a full-body scan is too expensive to run eagerly, and unlike a download it never touches the network, so there is no wifi gate either. Peter's call. MediaCodecClipSource gains decodeFull, sizing the decode buffer from durationMs with a margin rather than the fixed 4-minute clip window decodeHead/decodeTail use. Coverage 91.70% -> 91.76%. Neither half of Tier 3 has run on a device this session -- see CLAUDE.md's known-gaps list. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Sj3CoWEedM56bebByKgNxA
2026-09-26Tier 3 skip detection: audio fingerprinting, prototyped and builtPeter Stone
Closes the last deferred Phase 2 item. Desktop-prototyped first, per the design plan's own instruction, against three real shows (see the prototype findings recorded in memory): NPR Up First (a clean ~6s intro sting, r 0.96-0.998 across every pair tested), Tangle (a long 60-90s open/sponsor read, equally reliable), and Darknet Diaries (no real intro -- a segment that matched between two temporally-close episodes turned out to be a dynamically-inserted ad, confirmed by checking a 2018 episode that matched the same "intro" despite the multi-year gap). That last finding drove the actual design: IntroOutroDetector requires 3+ independently-fetched episodes to agree before trusting a candidate and auto-applying it, which is exactly what the Darknet Diaries ad would not have survived. The confirmation threshold is the safety mechanism, not just caution for its own sake -- and it's now a parameter, not a hardcoded assumption, after coverage review found the "still tentative" branch was unreachable at the original threshold. - AudioCorrelation: FFT-based normalized cross-correlation, a Kotlin port of the validated prototype. Tested against numpy/scipy-derived ground truth fixtures, not just self-consistency -- the prototype's own normalization bug (global mean instead of each window's local mean, producing a bogus 0.98 "match" plain correlation put at -0.02) is exactly what that guards against being ported here unnoticed. - IntroOutroDetector: the pure state machine (waiting/tentative/confirmed/ discard-on-mismatch), mirroring DripSchedule's shape. - MediaCodecClipSource: the one Android-only piece (MediaExtractor/ MediaCodec decode to mono 8kHz PCM), on the framework-adapter coverage exclusion list for the same reason PlayerConnection is. - Storage: AppDatabase 6->7, a new show_fingerprints table (one row per show per intro/outro, tracking the current candidate clip and how many episodes have confirmed it) and two new nullable EpisodeEntity columns. Tier 2's manual per-show offset remains the fallback -- PlaybackProgress itself is unchanged; DetectedSkip.kt is the entire integration surface. - Trigger: EpisodeDownloader gained an onDownloaded hook (every download route ends up there, manual or queued) firing a new one-shot FingerprintWorker per episode. Coverage improved (90.13% -> 91.70%): the new pure logic is fully tested, and closing two real gaps the coverage review surfaced (an untested first-two-episodes-disagree path, and ShowFingerprintEntity's hand-written equals/hashCode, needed because a ByteArray property breaks the generated one) accounted for more than the new Android-glue lines cost. Not yet verified on a device -- no phone connected this session. The MigrationTest 6->7 case and the actual decode/match pipeline both need a real run before this is trusted with real playback. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Sj3CoWEedM56bebByKgNxA
2026-09-26Drop ID3 CHAP frames, having measured the real libraryPeter Stone
Peter asked how expensive it would be to check before dropping them. Checking turned out to be cheaper than arguing about it, so here is the answer from his own 61 subscriptions rather than from general knowledge. Every feed's newest episode was fetched far enough to read its entire ID3 tag -- the declared size from the header, not a guessed window, which matters because several are multi-megabyte (Cruising the Waves carries 10MB of cover art) and a first pass with a 400KB window left thirteen of them inconclusive. ID3v2.2's 3-byte frame headers needed handling separately from v2.3/2.4's 4-byte ones, which is what made Dan Carlin's feeds look truncated at first. Not one of the 61 carries a CHAP frame. The frames present are all artwork and metadata: APIC, TALB, TIT2 and friends. Exactly one show publishes chapters at all -- Wards Way Podcast -- and it does so as Podcasting 2.0 JSON, which has been supported since the skip work landed. So CHAP is dropped rather than deferred. The two survey scripts are kept under tools/ so this can be rerun in a minute if a new subscription ever suggests otherwise, rather than re-derived. Two things fell out of the survey worth writing down. A feed can carry two chapters elements per item -- the podcastindex one with a url and a podlove one without; Buzzsprout emits both. The parser takes the first non-null url so it is unaffected, but a last-wins read would silently lose chapters. And the one show with chapters marks none of them toc:false, so ad-chapter skipping -- on by default as of this morning -- currently has nothing to act on anywhere in the library. It is correct and idle, waiting for a publisher who marks breaks. Documentation and tooling only; no behaviour change. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018AwnALZL6bD4VBtATDVv3B
2026-09-26Hide played episodes, and hand off to the video at the right momentPeter Stone
Two of Peter's asks. Played episodes are hidden by default. An episode you have heard is done with, and leaving it in the list buries the ones that are not. A global toggle on the show screen brings them back, so a mis-tapped "played" can still be found -- stored in DataStore, which has been a declared dependency since phase 1 with nothing using it. Android Auto always hides them regardless of the toggle: a car list is scrolled blind at a traffic light. Hand-off carries the position both ways. Out: "Watch from here" opens the video on its own site at the point reached. In: a link shared from YouTube with a timestamp on it was shared at that moment deliberately, so the episode starts there rather than at the top. WatchLink does both and is pure, because an unrecognised URL shape fails silently -- as a link that simply starts from the beginning -- and YouTube produces a lot of shapes. The button sits on the episode screen as well as the player. That was not the first design, and testing changed it: the player-only version is unavailable exactly when it is most wanted, because an episode YouTube declines to serve never starts playing and so never reaches the player at all. Verified on a device, round trip: youtu.be/dQw4w9WgXcQ?t=90 shared in stored a position of 90000, the episode screen offered Watch, and tapping it fired youtube.com/watch?v=dQw4w9WgXcQ&t=90s. Marking an episode played removed it from the list, the toggle brought it back, and the preference survived a restart. An ordinary podcast offers no hand-off, having no page to open. Two things caught on the way. A crash: the episode cache was declared after the init block that collects from a StateFlow, which emits synchronously, so it was still null on the first emission -- caught by the launch check, now a plain field declared with the others. And the played switch needed a contentDescription distinct from its visible label, or it is ambiguous to pick -- the same trap the drip switch hit. Preferences joins the coverage exclusions: a Context, a file and a generated Flow, deciding nothing. WatchLink is fully covered. No permission changes, no schema change. 442 unit tests green, detekt and lint clean, coverage steady at 90.13. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018AwnALZL6bD4VBtATDVv3B
2026-09-26Skip marked breaks by default, and drop the instrumented-coverage halfPeter Stone
Two things. Ad-chapter skipping is on by default, at Peter's request after living with it. It shipped off out of caution, being the one part of the skip feature that removes audio nobody has heard -- but it only ever acts on sections a publisher explicitly marked as not content, never on a guess from a title, and doing that without being asked each time is the point. Migration 5 -> 6 moves existing shows rather than leaving the new default to apply only to new ones. The column's SQL default stays 0 while the Kotlin default becomes true. Room writes every column on insert, so the SQL default is only ever consulted by an ALTER TABLE that has already happened; changing it would mean recreating the table for a value nothing reads. Said so at the field. Two unit tests were leaning on the old default to mean "not opted in". They now say `skipAdChapters = false` explicitly, which is what they meant. Second: enableAndroidTestCoverage is gone again, a day after adding it. It was the "both" half of the coverage change, and measuring it made the trade obvious -- it instruments every class in the debug build, which cost 25MB on the APK (118MB -> 143MB) plus runtime probes, on every sideload, for a report that would be run rarely. I had already published one of those builds. The framework-adapter exclusions carry this on their own; they are what moved the number from 65% to 90%, and what makes a future drop mean something. No permission changes. 428 unit tests green, 6 migration tests on a device, detekt and lint clean, coverage 89.97 -> 90.12. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018AwnALZL6bD4VBtATDVv3B
2026-09-26Name a shared video from the extractor when its page will notPeter Stone
Facebook serves no og: tags to a non-browser at all, so a shared video was filed as "Video 10153231379946729". yt-dlp knows perfectly well what it is called, and is going to be run against that URL anyway. The probe only happens when the page gave no title: a title that was shared is the one that was meant, and this costs a network round trip. It is allowed to fail, because it buys a nicer name rather than anything the episode needs -- a video that cannot be probed still downloads and plays. Duration comes along with it, which Facebook episodes previously had to do without entirely. This retires the last entry but one from the reachability allowlist: YouTubeAudio.probe has been sitting there since phase 1 described as "the resolver will want it for episode durations", which turned out to be exactly right. Verified on a device: the same Facebook video that arrived as "Video 10153231379946729" this morning now arrives as "How to Share With Just Friends", 74 seconds. No permission changes, no schema change. 428 unit tests green, detekt and lint clean, coverage 89.93 -> 89.97. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018AwnALZL6bD4VBtATDVv3B
2026-09-26Exclude framework adapters from coveragePeter Stone
Peter's call. The gate had been overridden eight times running, every one a class whose whole body is a call into ExoPlayer, Media3, Room, WorkManager or Chaquopy -- none of which execute on the JVM. The last few overrides were the argument for doing this. Pulling completion decisions out of PlaybackService into tested classes lowered the number, because the tested part was already counted and the glue it left behind was counted too. Writing an instrumented test for a migration lowered it again, because jacocoTestReport measures unit tests only. A metric that punishes both of those is measuring how much Android glue the app contains, not how well its logic is tested. Same code, 65.04% -> 89.93%: 629 uncovered lines were adapters, 131 are real. What is left is honest -- page-fetch coroutines that need the actual host, a few data classes, and Room's Converters, which are plain Kotlin and genuinely untested. A drop from here will mean something. The list sits next to its reasoning in the build file, with the bar written down: "cannot execute off a device", not "awkward to test". QueueRepository, PlaybackAdvancer, EpisodeDownloader and ChapterFetcher all touch framework-adjacent things and all stay measured. Also added jacocoFullReport, which folds in instrumented coverage for when you want the fuller picture with a device attached. The commit gate deliberately does not read it: device data only exists after a device run, so including it would make the gate report different numbers for identical code depending on whether one happened recently -- worse than a narrow gate. One trap worth recording: Kotlin block comments nest. A KDoc mentioning a glob with `/*` in it opened a nested comment, so the closing `*/` only closed the inner one and the comment ran on until it hit a `*/` inside a later string literal -- producing syntax errors on innocent lines well below the real cause. No behaviour change. 425 unit tests green, detekt and lint clean. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018AwnALZL6bD4VBtATDVv3B
2026-09-26Seed the default filters on a fresh install too, not only on upgradePeter Stone
Caught while verifying on a device: after a reinstall the rules table was empty. A fresh install creates the schema at the current version and never runs a migration, so putting the seeding only in MIGRATION_4_5 gave the trailer and preview filters to upgraders and silently to nobody else. Peter's own phone would have been fine -- it is an upgrade from v4 -- but a reinstall later would have quietly lost them, which is the kind of gap that surfaces as "I thought you set that up". The SQL is now shared between the migration and a RoomDatabase.Callback, and covered by an instrumented test building a fresh database and asserting both filters arrive. No permission changes, no schema change. 425 unit tests green, 11 instrumented, detekt and lint clean. Coverage 65.18 -> 65.04, exception recorded. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018AwnALZL6bD4VBtATDVv3B
2026-09-26Facebook videos, and a muxed fallback so they can be fetched at allPeter Stone
Individual videos, which is the whole of what is reliably possible: Facebook pages publish no RSS, so there is no equivalent of subscribing to a YouTube channel. Flagged that before building rather than quietly delivering half. A shared link is recognised across the shapes Facebook actually produces -- watch, page videos with or without a slug, reels, fb.watch and /share/v codes, on www, m and web hosts -- and lands in its own "Saved Facebook videos" container. Its own, because the container carries the kind that decides how its episodes are fetched, and one row cannot be honest about two sources. The guid is prefixed per source too, so a Facebook and a YouTube video that happen to share a numeric id stay separate episodes. The og: tag parsing YouTube already did privately is now OpenGraph, used by both, per the standing instruction about two solutions to the same problem. It also learned to tolerate either attribute order and single quotes, which real pages use. The download seam stops claiming to be YouTube's: yt-dlp takes a URL and works out the site itself, which is exactly what made this cheap. YouTubeDownloadSource is ExtractedAudioSource and ChaquopyYouTubeSource is ChaquopyAudioSource. One real find, and the reason the first attempt failed on a device: Facebook publishes no audio-only stream at all, only pre-muxed sd/hd mp4, so "bestaudio[ext=m4a]/bestaudio[ext=webm]/bestaudio" resolved to nothing and yt-dlp reported "Requested format is not available". _FORMAT now falls back to a muxed mp4. That is still a single already-complete file, so the no-ffmpeg rule holds -- what must never appear there is bestvideo+bestaudio. Media3 plays an mp4's audio track without complaint, and the data model has been media-agnostic since phase 1 for this sort of reason. Verified end to end on a device against a real public Facebook video: resolved to its own container with the right kind and guid, fetched by yt-dlp, and played. This also stands as the first proof of the previous commit's fetch-then-play path against a genuine extractor rather than a direct URL, since YouTube itself is bot-blocked from this machine. Known gap, not fixed here: Facebook serves no og: tags to a non-browser at all -- checked with the app's own user agent -- so a shared video shows as "Video <id>". yt-dlp knows the real title, and YouTubeAudio.probe is still sitting unused in the reachability allowlist waiting for exactly this. Small follow-up. No permission changes, no schema change. 425 unit tests green, detekt and lint clean, coverage 64.90 -> 65.18. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018AwnALZL6bD4VBtATDVv3B
2026-09-26Rank shows by what is still waiting, and seed the trailer filtersPeter Stone
Two of Peter's asks. Ordering. A show ranked by its newest unplayed episode, so queueing something left the show sitting at the top with nothing actually waiting -- his words, once they're on the queue they're noise in the list. Queued episodes are now excluded from the ranking for the same reason played ones already were: they have been dealt with. That is one clause of SQL, and the fake DAOs return insertion order, so it is exactly the kind of rule that cannot be pinned off-device. LibraryOrderTest runs against a real in-memory Room database and covers the change, an older unqueued episode still counting, played episodes still not counting, and a show with nothing waiting sorting last rather than vanishing. Confirmed it fails without the fix before keeping it. Filters. Peter chose the existing rule engine over anything new, with the rules set up for him -- and rules live in the database on the phone, so a migration is the only way to put them there. MIGRATION_4_5 seeds "trailer" and "preview", both mark-played, as ordinary rules: they show up in the Rules screen and can be edited, disabled or deleted. Appended after whatever is already there rather than taking position 0, so they cannot pre-empt rules already relied on, and INSERT OR IGNORE on a fixed id means deleting one does not bring it back on the next upgrade. They act only on newly discovered episodes, so nothing already in the library changes. One judgement call worth flagging: "preview" will catch a sports show's legitimate Season preview. It is two taps to delete if it bites. Schema 4 -> 5, no shape change -- the migration only inserts rows. Covered by two instrumented tests: seeding after an existing rule, and a 1 -> 5 chain landing exactly two. No permission changes. 403 unit tests green, 10 instrumented, detekt and lint clean. Coverage 65.20 -> 64.90, exception recorded: the new code is a migration tested on a device, and the coverage report counts unit tests only. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018AwnALZL6bD4VBtATDVv3B
2026-09-26Download anything that joins the queue, straight awayPeter Stone
Peter asked for it, and it is what makes the YouTube fix comfortable: those episodes have to be fetched before they play at all, so having them already on disk by the time he taps Play turns a thirty-second wait into none. The notification lives on QueueRepository rather than at each call site because the queue is the one choke point every route goes through -- a rule, a drip release, a tap on Play, the share sheet, a drag. It reports only ids that were not in the queue a moment ago, so reordering, removing and advancing say nothing, and re-adding something already queued (which moves it) says nothing either. QueuedDownloads decides what actually needs fetching. Skipping what is already downloaded or already in flight is the part worth testing: a second download of bytes on disk costs real data for nothing. A FAILED episode is deliberately retried, since re-queueing something is a reasonable way to ask for that. The one-off job carries no network constraint, per Peter's choice that this happens immediately on any network. The periodic sweep keeps its wifi constraint. Worth being clear about the implication he accepted: a rule that catches several episodes at once will now pull them over mobile data, capped only by DownloadDrainer's ten per run. Verified on a device: queueing an episode from the episode screen took it from NONE to DOWNLOADING within seconds and to DOWNLOADED with a file on disk, rather than waiting for the two-hourly wifi job. No permission changes, no schema change. 403 unit tests green, detekt and lint clean, coverage 65.16 -> 65.22. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018AwnALZL6bD4VBtATDVv3B
2026-09-26Fetch yt-dlp sources before playing them, and stop losing errorsPeter Stone
Peter reported that YouTube subscribing and individual videos work but nothing plays. Reproduced and root-caused on a device rather than guessed at: UnrecognizedInputFormatException: None of the available extractors (FlvExtractor, FlacExtractor, ... Mp3Extractor, ...) could read the stream A YouTube episode's mediaUrl is its watch page -- the feed carries no enclosure, and the audio URL only exists once yt-dlp has resolved it. SubscriptionKind was consulted in exactly one place, EpisodeDownloader, which routes downloads. So playback handed ExoPlayer an HTML page. SubscriptionKind now says whether a source needs extracting, and PlaybackAdvancer.start reports NeedsFetch instead of a NextUp that cannot work. fetchAndStart runs the extraction and re-resolves, so the two places that start episodes -- the service on queue advance, the view model on a tap -- share one implementation rather than each growing their own. Both had to handle it: the queue moves on without the UI, which was the lesson of the previous commit. The second half of this is that none of it was visible. Nothing in the app observed onPlayerError, and nothing rendered PlayerViewModel.banner at all -- so playback failures, fetch failures and even "sleep timer finished" were set on a flow no screen collected. That is why a broken feature looked like a dead button. Errors now surface in the player bar and on the player screen, and a failed fetch carries yt-dlp's own words: "Sign in to confirm you're not a bot" and "video unavailable" are very different problems and identical without them. A fetch in progress says so rather than reading as "Nothing playing" for thirty seconds. Verified on a device, and one part could not be: The mechanism works end to end. A YOUTUBE_CHANNEL episode pointed at a real audio URL went NONE -> DOWNLOADING -> DOWNLOADED with a file on disk, and then played -- yt-dlp doing the extraction and the download for real. YouTube's own extractor could not be verified here, and I am not claiming it was. This host's IP is bot-challenged for every video tried, directly from the command line as well as from the app -- the same block CLAUDE.md recorded as transient in July. Peter's phone is on a residential connection and is the only place that can confirm the reported bug is actually gone. Correcting something I said earlier in the session: YouTubeAudioTest passing does not prove extraction works. It only starts Python and checks yt-dlp's version; it never extracts anything. No permission changes, no schema change. 392 unit tests green, detekt and lint clean. Coverage 65.33 -> 65.16, exception recorded. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018AwnALZL6bD4VBtATDVv3B
2026-09-25Advance the queue from the service, not from the activityPeter Stone
Marking an episode played and moving the queue on lived in PlayerViewModel, which is scoped to the activity and releases its MediaController in onCleared. So with the activity gone -- swiped off recents, or reclaimed under memory pressure -- the audio carried on from the foreground service while nothing marked anything played and nothing advanced the queue. Background listening with the screen off is the normal case for a podcast app, so this was broken in the case that matters most. The outro offset and ad-chapter skipping added last commit rode the same tick and had the same hole. Completion now belongs to PlaybackService, which is the component that survives backgrounding. Two new tested classes carry the thinking: PlayheadPolicy decides what a tick means (finish early on an outro offset, seek past a marked break, or nothing -- with finishing beating skipping, or a show with both would seek into the credits it was told to skip and sit there), and PlaybackAdvancer owns finishing, advancing, and working out where the next episode starts. Neither knows about Media3, so both are testable off-device; the service turns their answers into player calls. Where an episode starts is now decided in exactly one place. PlaybackAdvancer .start is used by the service when the queue moves on and by the view model when you tap Play, so an episode begins in the same position however it got there. PlayerConnection no longer carries its own copy of the resume rules. PlayerConnection deliberately stops handling STATE_ENDED and PlayerViewModel loses onFinished entirely -- with both in place the queue would advance twice. The view model now follows whatever is playing rather than only what it started, so the player screen's show, speed and chapter list stay right when the service moves on by itself. Verified on a device with "don't keep activities" enabled, which destroys the activity the moment it is backgrounded: an episode was resumed, the app sent to home with no activity records left, and the service took the episode to its outro line, marked it played, dropped it from the queue and started the next one, which went on playing. Also isolated the data loss seen twice this session: connectedDebugAndroidTest uninstalls the app when it finishes, taking the database with it. A plain adb install -r left four episodes in place and the next instrumented run left "run-as: unknown package". Not a migration fault, and now written down as such. No permission changes, no schema change. 385 unit tests green, detekt and lint clean. Coverage 66.23 -> 65.33 with an exception recorded: the logic moved out of the coverage-excluded ui/** tree into the counted service, and the ExoPlayer glue that remains cannot run off-device. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018AwnALZL6bD4VBtATDVv3B
2026-09-25Simple skip: manual offsets and chapter-marked breaksPeter Stone
The last of Phase 2's three tracks, and the part Peter asked for in place of the audio fingerprinting, which stays deferred. Two tiers. Manual per-show offsets start each fresh episode past the intro and treat it as finished before the outro; resuming something part-heard still lands where it was left, and an offset longer than the episode is dropped rather than obeyed, because someone typing minutes where seconds were meant should not have a show start at the end. The fields have been on SubscriptionEntity since phase 1 with nothing reading them. Chapters are the exact tier: where a show publishes a Podcasting 2.0 chapter file, the player lists it and taps seek. Breaks the publisher marked `toc: false` can be skipped, opt-in per show. Nothing is guessed from chapter titles -- a show discussing its own sponsorship deal has a chapter called "Sponsors" that is the actual programme, and a skip feature that eats an episode is worse than none. A break whose end cannot be worked out plays rather than throwing the playhead somewhere arbitrary. Two real bugs surfaced while verifying this on a device, both older than this work: A start position handed to `seekTo` after `prepare()` is silently dropped across the MediaController-to-service boundary. The intro offset began at zero, and so, all along, did every resume -- an episode left half-heard restarted from the top. Nothing failed and nothing logged. It now goes to `setMediaItem`, verified on a device both ways: a fresh episode starts at the offset, a stored position resumes at 150s and plays on from there. Finishing an episode did not stop playback when the queue was empty, because until now the file had always ended anyway. With an outro offset the episode finishes while audio is still playing, so it marked the episode played and then played the credits regardless. Schema v3 -> v4: the chapter file cached per episode, and the per-show opt-in. The migration test now covers 1 -> 4 straight through and asserts the opt-in arrives off -- defaulting it on would have started removing audio from every show at once. Per-show settings moved to their own view model. Drip, the archive fetch and both skip settings are one concern used by one screen, and ListenViewModel had become the entry point for the library, the queue, episode actions and these as well. It also gets its own busy flag: fetching an archive and refreshing a feed are different operations, and one spinner for both had the top bar claiming a refresh was running when it was not. Verified on a device against a real feed throughout: a 60-second intro offset starts the episode at 60s, an outro offset finishes it early and stops the audio, and a seeded chapter file with a five-second marked break plays 0-5s then jumps to 45s with the chapter list rendering alongside. No permission changes. 364 unit tests green, detekt and lint clean, coverage 65.30 -> 66.23. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018AwnALZL6bD4VBtATDVv3B
2026-09-25Slow drip: work through an archive a few episodes at a timePeter Stone
The second of Phase 2's three tracks. A show can be set to release its back catalogue on a cadence -- one a day, oldest first, by default -- and while drip is on the show lists only what has been released rather than the raw feed. A 600 episode archive then reads as a show you are keeping up with instead of a wall. A release always enqueues, and deliberately does not go through the rule engine. Drip decides when you see an episode and the rules decide what happens to one; running a released episode through the rules as well would let a rule silently cancel a release, which reads as the drip being broken. Three pieces of arithmetic worth keeping, all in DripSchedule and all tested: The clock advances by whole intervals rather than to now. Moving it to now discards the part-interval already elapsed, and a six-hourly worker against a daily drip loses hours every day until "one a day" means one every day and a bit. A long absence is capped at ten and the excess is forgiven rather than carried. A month away owes thirty episodes; handing those over empties the archive into the queue, which is the thing the feature exists to avoid. Carrying the debt instead would just pay it out as a capped burst on each of the next three runs. Switching drip on settles what it already owes: everything played or already queued is released up front, because hiding episodes you have heard makes a show followed for a year look like it has three, and hiding one mid-queue strands it where nothing can reach it. Re-enabling starts the cadence from now rather than paying off a debt accrued while it was off. Visibility is a query parameter, not stored state, so switching drip off restores the whole catalogue without touching a row. Android Auto browses the same set. Feed reconciliation deliberately still sees everything -- matching against the visible set alone would read a held-back episode as missing and re-insert it on every refresh. RFC 5005 archive paging is what gives a drip anything to drip: FeedArchiveWalker follows prev-archive pages, resolving relative hrefs against the page that carried them, and stops on a loop, a page cap, or a fetch failure -- keeping what it collected and reporting why, because half an archive is useful and a silent half surfaces months later as "why did this show run out?". Two gaps found while wiring it up, both fixed here: the subscription screen had no snackbar at all, so a refresh started from it reported nothing and an archive fetch would have been silent; and both toggles were bare Switches with no accessible name, which TalkBack cannot announce and the UI checker cannot tap. Schema v2 -> v3. The four non-null drip columns carry SQL defaults because SQLite cannot add a NOT NULL column without one, declared on the entity too so the migration and the exported schema describe the same table. Verified twice: the migration test now covers 1 -> 3 straight through, and a real v2 database seeded with a subscription, an episode at position 424242 and a rule was upgraded in place on a device with all three surviving and drip defaulting off. OPML moved to its own view model rather than growing ListenViewModel past its function limit again -- it shares nothing with the library, is used by one screen, and the settings screen now depends on it alone. The exported-schema trap from the last commit happened again, after I had written the warning down. Step 9 of the pre-commit hook now refuses a commit that modifies an already-committed schema JSON, since a note was demonstrably not enough. No permission changes. 333 unit tests green, detekt and lint clean, coverage 63.63 -> 65.30. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018AwnALZL6bD4VBtATDVv3B
2026-09-25Auto-queue rules: decide what happens to an episode as it arrivesPeter Stone
The first of Phase 2's three tracks. A rule is a set of conditions on a newly discovered episode -- show, title contains/excludes, duration range, age, season -- and an action: queue at the top or bottom, mark played, and optionally download it or pin it to a speed. Rules are ordered, individually switchable, and the first one that matches claims the episode. Every claimed episode records which rule fired and the account that rule gave, shown on the episode screen as `Handled by "News to the queue" - title contains "news"`. That is not decoration. Automation that fills a queue and cannot say why is the thing that makes people stop trusting it, so the reason string is tested as hard as the matching is. Three decisions worth keeping: Rules never fire on a first subscribe. That import discovers the entire back catalogue -- 2,753 episodes on a real feed -- and a catch-all rule would enqueue all of it. `applyEpisodes` takes a `report` flag and `subscribe` passes false. Verified live: subscribing to NPR News Now stored four episodes and queued none; deleting the newest and refreshing queued exactly that one, with its reason recorded. A rule's speed lands on the episode, not the show. Writing it to `SubscriptionEntity.playbackSpeed` would let one matching episode silently reset the speed of everything else the show publishes. Auto-downloads go through a new DownloadWorker rather than the refresh. A refresh should finish in seconds whatever the rules decided; a worker that spent twenty minutes pulling audio would be killed mid-flight with the feed state half written. The drainer caps a batch at ten and leaves a failure FAILED rather than retrying forever against a 404. Schema v1 -> v2, this app's first migration, with MIGRATION_1_2 validated on a device against the exported v1 schema and a seeded playback position read back afterwards. Two pieces of plumbing were needed and both fail obscurely: the schemas directory wired into androidTest assets, and kotlinx-serialization raised to 1.8.1 because Room 2.8's bundle parser calls a method 1.7.3 lacks and dies with AbstractMethodError at runtime. Both are written up in CLAUDE.md, along with the trap that cost the most time -- changing an entity before bumping the version rewrites the exported schema for the old version, destroying the only record of what is on the phone. No permission changes. 298 unit tests green, detekt and lint clean, coverage 61.60 -> 63.63. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018AwnALZL6bD4VBtATDVv3B
2026-09-25Add single videos, make the whole episode row tappable, stamp the buildClaude
Sharing a YouTube video now adds that one video rather than subscribing to its channel -- sharing something interesting is not a request to follow everything the channel ever posts. They land in one "Saved videos" container instead of a subscription each, which would otherwise fill the library with entries that will never publish again. Title, artwork and duration come off the watch page we already fetch, so adding needs no extractor. Only the episode title was tappable, which is too fine a target: Peter tapped the row, nothing happened, and reasonably concluded the details screen wasn't there. The whole row opens it now. Settings shows the commit and build time. A cached browser download and a failed publish look identical from the outside, and "is this the new build?" had no answer that did not amount to trusting me. publish-apk writes a companion .txt with the hash for the same reason. Metadata is entity-decoded. A YouTube thumbnail URL carries query parameters and the raw attribute encodes the separators as &amp;, so the artwork simply failed to load -- spotted in the real resolved output rather than by a test. YouTube URL handling moved to its own YouTubeUrls object. Channel, playlist, handle and watch URLs each need different treatment and two only resolve by reading the page; that is its own concern, not a corner of the general resolver. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018AwnALZL6bD4VBtATDVv3B
2026-09-25Mark-older-as-played, episode details, unplayed-first sortingClaude
After an OPML import every episode of every show arrives unplayed -- a back catalogue already heard, far too large to tap through. markPlayedUpTo marks an episode and everything older in one action. It skips episodes already played, so their original dates survive, and clears positions as it goes: retention reads a non-zero position as "resumed, still in use" and would otherwise never reclaim those files. Sorting now ranks by newest *unplayed* episode rather than newest episode. A show you are caught up on was sitting at the top with nothing to offer, which is backwards; it now drops down the list until it publishes again. An episode details screen, because the list can show two lines and the description -- often the only place a show says what an episode is about -- had nowhere to go. It is also where the bulk action lives: the row already has five controls and a sixth did not fit. One bug worth recording. SubscriptionNav.openEpisode had a `= {}` default, so the subscription route forgot to pass it and tapping an episode title silently did nothing -- it compiled, it ran, the button was simply dead. Default no-ops on navigation callbacks turn a missing wire into a dead control instead of a compile error, so the default is gone. Verified on device: details screen opens, and against real Room on a live feed the bulk action marked 498 older episodes while leaving the 2 newer alone. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018AwnALZL6bD4VBtATDVv3B
2026-09-25Sign debug builds with a shared, checked-in keystoreClaude
"App not installed" when updating. Android generates a debug keystore per machine, so tungsten's build and the laptop's build are signed differently and each refuses to install over the other. Reproduced exactly: INSTALL_FAILED_UPDATE_INCOMPATIBLE, "signatures do not match newer version". The published APKs show the collision plainly -- 0930d0 on the 21st, 106ecafe in between, 0930d0 again after my last publish -- so an update had roughly a coin-flip chance of being installable depending on which machine built it. The checked-in key is tungsten's existing debug keystore, stock alias and password, not a freshly generated one. That matters: a new key would have been just as unusable as the mismatch, forcing a second uninstall and a second loss of every playback position, right after Peter had already done one. Verified by installing the currently-published APK and updating in place over it. Safe to commit -- it signs debug builds of a personal sideloaded app. It must never sign a release, where the key is the app's identity. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018AwnALZL6bD4VBtATDVv3B
2026-09-24Fix YouTube subscriptions, headphone skip, and NPR show namesClaude
YouTube was broken in two separate ways and only the first was visible. Resolution rejected anything without a channel id in the URL -- which is every link YouTube's share sheet produces. The id now comes from the page, so handles, /c/, /user/ and watch URLs all work. Then the deeper one, from Peter testing the link that did resolve: it "subscribed but yields an empty feed". YouTube's feeds are Atom and carry no <enclosure> at all, just <yt:videoId> and a watch link, so the parser dropped every single entry for having no playable media. Subscriptions were being created permanently empty. The watch URL is now the media URL, which is exactly what the yt-dlp path already expects; a podcast item with no enclosure is still dropped. Requests now send a browser user agent. I had refused this on the grounds it was defeating an access control, which was wrong and Peter said so: fetching a public page is content negotiation, not authentication. It is materially different from a proof-of-origin token or a borrowed login, neither of which Listen does. YouTube serves a 2KB stub to anything that doesn't look like a browser, so this is also what makes video links resolve at all -- verified on device, all three of his URLs now subscribe with 15, 15 and 13 episodes. Headphone skip-forward: I broke this removing next/previous commands to free car-notification slots -- headphone remotes send exactly those. Restored, and PodcastPlayer redefines them as skip-forward/back, so they do the useful thing on a podcast instead of nothing. Every NPR show displayed as "NPR" because artist preferred itunes:author, and NPR sets that identically on every feed. Show title comes first now. Also: release dates on the episode list, podcasts sorted by most recent episode rather than alphabetically, a per-feed refresh button, speed chips that wrap instead of overflowing, and the now-playing bar taller, carrying the show name, and present on the queue and podcast screens rather than only the library. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018AwnALZL6bD4VBtATDVv3B
2026-09-23Add artwork, a real player screen, and queue drag-reorderPeter Stone
Closes three of the four Phase 1 gaps in CLAUDE.md's "Known gaps": artwork was parsed and passed to the lock screen but never rendered, playback had a transport bar with no scrubbing or per-show speed, and QueueOrdering.move was tested but unreachable from any screen. Android Auto real-car verification stays deferred, per Peter's call. - Artwork: new Artwork.preferredUrl (episode image falling back to the show's), resolved once at EpisodeEntity.toMediaItem's MediaMetadata boundary so the lock screen, Android Auto, the now-playing bar and the new player screen all read it from one place. Coil3 wired to the app's own OkHttpClient. Pinned to 3.3.0: later releases require a newer Kotlin stdlib or Compose than this project runs (Compose 1.12 needs compileSdk 37, one above what AGP 8.13.2 supports). - Player screen: scrubbing (PlayerConnection.seekTo, committed on drag release) and per-show speed (PlayerViewModel.setShowSpeed persists SubscriptionEntity.playbackSpeed via a new SubscriptionDao.updateSpeed) -- the field existed since Phase 1 with nothing to reach it. Opened by tapping the now-playing bar's title/artwork; Up Next moved to its own icon there. - Queue reorder: drag-and-drop via sh.calvin.reorderable, backed by a new QueueRepository.reorder that writes the final order once on drag release rather than per drag step (the gesture reports intermediate positions continuously). Coverage baseline drop (62.10% -> 61.15%) is entirely in already-0%-covered Media3 glue -- see COVERAGE_EXCEPTION. The new pure logic (Artwork, QueueRepository.reorder) is fully covered by new tests. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Sj3CoWEedM56bebByKgNxA
2026-09-24Ignore Kotlin's build session directoryClaude
.kotlin/ is a build artifact and was untracked but not ignored, so it would have been committed the first time it held anything. Noticed by diffing a fresh clone of the new local remote against the working tree -- which is the sort of thing only a clone tells you. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018AwnALZL6bD4VBtATDVv3B
2026-09-21Make unsubscribe reachable, and guard view models for reachabilityClaude
Found while auditing what phase 1 still owed: unsubscribe existed on the view model and no screen called it, so there was no way to remove a podcast. Not dead code -- a feature the user could not get to, which had survived the whole phase. The reachability guard covered helper objects and DAOs but not view models, which is the third place this class has hidden. It now checks that every view model function is reached by some screen, matching both a direct call and a method reference. It fails on unsubscribe before the fix and passes after. Unsubscribing asks first. It cascades to episodes, downloads and every playback position for that show, and none of that is recoverable from anywhere. CLAUDE.md now records what phase 1 deliberately does not have -- artwork, a player screen, queue reordering -- so the next session finds them written down rather than rediscovering them. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018AwnALZL6bD4VBtATDVv3B
2026-09-21Android Auto support, and give the car its skip-forward buttonClaude
Two things from the car. Skip-forward was missing: a head unit shows about three transport controls, and leaving previous/next track available meant they took the slots. Previous does nothing useful for a single episode anyway, so those commands are now removed in onConnect and the seek buttons get the room. Auto did not recognise Listen as driving-friendly, so it could only be controlled from the phone. That needs a browsable library, which means a MediaLibraryService rather than a MediaSessionService, plus a tree: Up Next and Podcasts at the root, shows beneath, episodes beneath those, capped at 100 because one real feed here holds 2753. Three things were each individually fatal and none failed loudly: - The automotive_app_desc meta-data has to sit at application level. A search-and-replace put a copy inside each activity as well, where it is simply ignored. - The service must be exported, because the controller is another process. - onConnect must grant DEFAULT_SESSION_AND_LIBRARY_COMMANDS. With plain DEFAULT_SESSION_COMMANDS a browser connects successfully and then gets PERMISSION_DENIED on the library root -- the connection looks healthy and browsing is dead. Found by logging the result code rather than assuming. Voice search too, since in a car it is the only interaction that keeps your eyes on the road. Shows rank before episodes: asking for a show by name is the common case, and a show is browsable, so the driver still picks the episode. MediaBrowseTest drives all of this over the real session protocol from a MediaBrowser. It must run on the main thread and await rather than block -- MediaController rejects calls from another thread, and blocking the main thread on a future that completes there deadlocks. Also: XML comments cannot contain "--", which made the manifest unparseable with a merge error that never named the line; and the reachability guard was reporting a method reference (LibraryTree::subscription) as dead because it only matched call syntax with parens. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018AwnALZL6bD4VBtATDVv3B
2026-09-21Notification seek buttons, and resolve redirects to the real feed URLClaude
Two things reported from the phone. The playing notification had a previous button and no skip-forward. Media3's default layout offers previous/next *track*, right for an album and wrong for a podcast: with one episode loaded there is no next track, so a control was dead and the useful ones absent. Skip-by-seconds are not default buttons -- they are custom session commands, and they have to be granted on connect or the buttons appear and do nothing. Media3 ships numbered icons for 5, 10, 15 and 30 only, so back gets the 15 icon and forward gets a plain arrow rather than one captioned 30; an icon stating the wrong number is worse than one stating none. The resolver returned the URL it was handed, not the one redirects landed on. A share link from another app is a redirect to the real feed, so subscribing through one stored that third party's URL as the feed: retire the shortener and the subscription silently stops updating even though the publisher never moved. It now resolves to the final URL, and discovered relative links resolve against where the page actually was rather than where we asked. Verified on device: an Apple Podcasts link for Common Sense resolves to feeds.feedburner.com/dancarlin/commonsense and subscribes under the publisher's own URL. Also fixes lint errors this introduced -- Media3's session API is @UnstableApi and the error result code belongs to SessionError, not SessionResult. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018AwnALZL6bD4VBtATDVv3B
2026-09-21Fix a queue bug that deleted episodes, and delete dead DAO methodsClaude
Review found a data-losing bug. advance() drops the head of the queue, but play() never put the played episode there. Play something from a show list, let it finish, and advance dropped whatever was actually at the head -- a different episode, removed from the queue having never been played. The fix is an invariant rather than a special case: anything played becomes the head, so advance always drops the episode that just finished. playNow() does that, play() calls it, and the tests name the scenario. Two DAO methods had no caller -- getQueue, superseded by observeQueue, and observeUnplayed, written for a screen that was never built. Deleted. Room generates an implementation for each, so they were not free. The reachability guard now covers DAO methods too, which is the shape that bit FeeDreader: three superseded methods sat undetected until a manual audit. Interfaces need looser matching than objects, since a call's receiver varies by site and a @Transaction default method calls its siblings unqualified, so it matches both forms and errs toward "called" -- a false alarm costs more attention than a missed one. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018AwnALZL6bD4VBtATDVv3B
2026-09-21Icon actions, dark-only theme, real media metadataClaude
Five labelled buttons overflowed the episode row on a phone and the last one collapsed into a one-letter-per-line column. They are icons now, each keeping a contentDescription so the row reads the same to a screen reader as it did with labels. Verified on the emulator against the real NPR feed: seven episodes visible where four fitted before. Dark only, not a dark default with a light alternative. This is a listening app used in the dark -- in bed with a sleep timer running, or in a car -- so the light theme is the one nobody would pick and it isn't built. The unqualified resources carry the dark values too, otherwise the window flashes white before Compose draws its first frame. Media metadata was title-only, so the lock screen and any car head unit showed blank lines where artist and album belong. It now carries the show as artist and album, plus the artwork URI. Seek increments are set on the player itself, which is what the notification, lock screen, Bluetooth remote and car controls actually use -- they were running on Media3's defaults, not the app's. Back 15, forward 25, and the in-app bar now uses the same numbers so the two can never disagree about what a skip does. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018AwnALZL6bD4VBtATDVv3B
2026-09-21Pin the reported NPR page shape with a regression testClaude
Verified end to end on device against the actual URL from the bug report: npr.org/podcasts/510318/up-first resolves to feeds.npr.org/510318/podcast.xml and subscribes as 'Up First from NPR' with 500 episodes. The page carries two rel="alternate" links: the RSS feed, and an android-app:// deep link with no type attribute at all. Requiring a recognised feed type is what keeps the deep link from being chosen -- it would resolve to something unfetchable. That was already the behaviour; it now has a test naming the case, since "we happen to filter on type" and "we must filter on type" look identical until something changes. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018AwnALZL6bD4VBtATDVv3B