- rename .forgejo/workflows/ to .gitea/workflows/ (git mv preserves
history); Gitea Actions reads either path, but the directory now
matches the active platform
- collapse ANDROID_STORE_PASSWORD + ANDROID_KEY_PASSWORD into a
single ANDROID_KEYSTORE_PASSWORD secret (PKCS12 keystores require
the two passwords to be identical, so the duplication carried no
information); build.gradle.kts still reads two env vars to stay
format-agnostic, both now sourced from the same secret in CI
- ignore android/*.keystore, android/*.keystore.*, android/*.jks,
android/keystore.properties so the regenerated signing material
never reaches a remote on accident
- update prose references from Forgejo to Gitea in CLAUDE.md and
the docs; the historical "migrated from Forgejo" note in CLAUDE.md
is kept intentionally; forgejo/upload-artifact@v3 action refs are
left untouched (canonical artifact action, resolves cleanly under
Gitea Actions)
Operator side: ANDROID_KEY_ALIAS, ANDROID_KEYSTORE_PASSWORD, and
ANDROID_KEYSTORE_B64 secrets registered in Gitea before this lands.
Last meaningful-feature release on Flutter. Ships:
- #472: notification + Wear OS controls stay live across idle
teardown (audio_handler softTeardown split)
- #479: system-playlist tap surfaces empty / slow / failed
states with SnackBar feedback
- #399: drift test cohort re-enabled on ci-flutter:1.26
- Tier-A deps sweep (audio_session 0.2, flutter_lucide,
permission_handler), Go server bumps, golangci v2 schema,
Flutter 3.44 ListTile strictness fixes
Future Flutter releases on this codebase are bugfix-only; the
v1 Android native rewrite has been planned.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
pubspec.yaml already requires audio_session ^0.2.3, flutter_lucide,
and permission_handler as direct deps (committed in earlier sweeps)
but the lock file on HEAD was stale — still referenced audio_session
0.1.25 transitive, missed flutter_lucide / permission_handler
entirely, listed the now-dropped cupertino_icons.
Regenerated locally via `dart run build_runner build` (which runs
`flutter pub get` first). Also picks up an in-range
flutter_secure_storage 10.1.0 -> 10.2.0 patch bump.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The Wear OS companion app's MediaController caches the MediaSession
token at first bind. When our idle timer fired super.stop() — which
calls stopSelf() on the AudioService and makes it eligible for OS
destruction under memory pressure — the next play() spun up a fresh
MediaSession with a different token. The companion's cached controller
still pointed at the dead one, so transport taps from notification
+ watch silently no-op'd even though PlaybackState broadcasts kept
flowing (those go through the live session). User-side workaround
was unpair/repair of the Watch.
Split stop() into:
- _softTeardown: stops the player, clears mediaItem/queue, broadcasts
idle. Display surfaces drop their visible state (this is what made
notification + watch tile cleanup work today; not super.stop()).
- stop(): _softTeardown + super.stop(). Reserved for explicit close
(onTaskRemoved while idle).
_onIdleTimeout now calls _softTeardown — the FGS + MediaSession stay
alive across idle, preserving the Wear binding. Explicit user-close
still terminates the service fully.
Diagnostic debugPrints from the investigation phase removed.
Research: ryanheise/audio_service 0.18.18 has been stale ~13 months,
no Media3 migration in flight upstream. This is the surgical fix
that respects the plugin's lifecycle contract.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Tapping a system-playlist PlayCircleButton before the mix had loaded
silently stalled — three failure modes all looked identical to the
user (PlayCircleButton's spinner clears with no playback):
- api.systemShuffle returns empty (mix not built server-side yet)
→ silent return at `if (refs.isEmpty)`
- api call slow / hung → spinner spins indefinitely (no client
timeout was set; Dio default is unlimited)
- api throws → uncaught; spinner finalizer clears it silently
Bundle:
- 8s `.timeout` on the systemShuffle / get call; TimeoutException
→ "Couldn't load playlist — check your connection"
- empty refs after filtering → "Mix isn't ready yet — try again
in a moment"
- other throws → "Playlist load failed: <error>"
- thread BuildContext through and capture ScaffoldMessenger before
the first await so no `use_build_context_synchronously` lint
No pre-warm — system playlists are intentionally uncached per the
api endpoint comment ("varies per play"); pre-warming would decide
the shuffle order at home-screen load instead of at tap, breaking
the fresh-per-play contract.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The 'flag keeps drift optimistic + queues mutation on server failure'
case trips a StreamProvider<bool> lifecycle issue when the async catch
path's awaited MutationQueue.enqueue → unawaited drain() chain reads
connectivityProvider.future. The other 3 quarantine tests pass with
the same _container helper (incl. the never-closing connectivity
override); only the throw variant surfaces this. Full diagnostic and
suggested next investigations are in Fable #476.
Closes#399's drift-re-enable scope: 11/11 originally-scoped tests
(4 sync_controller + 5 audio_cache + 2 storage_section) pass on the
libsqlite3-bearing ci-flutter:3.44 image, plus 3/4 quarantine tests
and the widgets_smoke suite.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
like_button_test 'tap toggles icon optimistically; rollback on error':
Stale survivor of the pre-MutationQueue era. The test name claims
to verify rollback after error, but LikesController.toggle no
longer rolls back — it adopted the same offline-first pattern as
quarantine: optimistic drift write, on API failure enqueue a
mutation for replay, drift state stays (user's intent persists
offline). The test's `expect(heartFilled(), isTrue)` after the
failed unlike happens to align with current "don't rollback"
behavior by accident; the test's intent is stale. The genuine
offline-first property is exercised by the quarantine test.
Delete rather than rewrite — no unique coverage to preserve.
quarantine connectivity override:
Previous Stream.value(true) override emitted true and then closed
the stream immediately. Riverpod's StreamProvider transitions
loading → data → closed when the underlying stream completes,
and that "closed" transition during the AsyncNotifier + mutation
replayer's overlapping lifecycle was tripping "disposed during
loading" on the throwing-API variant. Replace with an async*
generator that yields true and then holds open via
`Completer<void>().future` until tearDown disposes the container.
Same .future semantics for consumers; the provider stays in
AsyncData(true) throughout the test instead of transitioning to
closed mid-flight.
Closes the last 2 of the 6 drift-cohort surfaced failures. Fable #399.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Last 2 of the 6 surfaced drift-cohort failures. Diagnoses below.
quarantine_provider_test 'flag keeps drift optimistic + queues
mutation on server failure':
MyQuarantineController.build() schedules unawaited _refreshFromServer()
which reads connectivityProvider (a StreamProvider<bool>). In tests
without an override, that stream never emits — its real impl listens
to connectivity_plus's platform channel which has no fixture in
flutter test. The success-path quarantine tests resolve their main
flow before _refreshFromServer's chain reaches the connectivity read,
so they don't trip the "disposed during loading" guard at tearDown.
The throwing-API variant's `await ref.read(mutationQueueProvider)
.enqueue(...)` advances enough async work that the connectivity read
IS reached, then container.dispose() trips Riverpod's invariant.
Fix: override connectivityProvider in the shared _container helper
with `Stream.value(true)` so it resolves immediately. The previous
`await Future.delayed(Duration.zero)` workaround is removed — the
cleaner fix makes that band-aid unnecessary.
like_button_test 'tap toggles icon optimistically; rollback on error':
LikesController.toggle:
final user = _ref.read(authControllerProvider).value;
if (user == null) return;
The test only overrode `likesApiProvider`; authControllerProvider was
in AsyncLoading state at toggle() time → user was null → early return
→ no drift write → likedIdsProvider never emits "liked" → heart never
fills → assertion fails. The test would never have passed against the
current controller; it was a stale survivor of an older API.
Fix: stub authControllerProvider with _FakeAuthController that yields
User(id: 'u1', …) immediately. Also add overrides for appDbProvider
(NativeDatabase.memory, bypasses drift_flutter's Timer) and
connectivityProvider (Stream.value(true), unblocks cacheFirst's
isOnline check) — both are transitive dependencies of
likedIdsProvider's cacheFirst.
After this push, the full drift cohort should be all-green. Fable #399
/ local #62 closes when CI lands.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
All six tests had been silently skipped under @Tags(['drift']) for
6+ months, so they accumulated test-vs-implementation drift. Now
running against the libsqlite3-bearing ci-flutter:3.44 image, each
failed for a distinct reason. Diagnoses below.
audio_cache_manager_test 'usageBytes sums sizeBytes across rows':
usageBytes() is a directory walk (authoritative on-disk total,
catches orphan partials the index misses). The test inserted drift
rows but never wrote files, so the walk returned 0. The actual API
for summing drift sizeBytes is bucketUsage(). Rename to
'bucketUsage sums drift sizeBytes across rows', use that API,
assert liked+rolling == 350. Also give the two rows unique paths
per row-shape sanity.
sync_controller_test (3 200-path tests, all returning null result):
Map literals in Dart 3 with mixed value types infer as
Map<String, Object>, not Map<String, dynamic>. The sync controller
casts `resp.data as Map<String, dynamic>` (and several nested
casts), which is invariant on generics and throws TypeError. The
silent try/catch in sync() swallowed the throw and returned null.
Real JSON parsing produces Map<String, dynamic>, so this never
surfaced in production. Fix: route the test stub body through
jsonDecode(jsonEncode(body)) in _stubDio — mimics real Dio's
parsed-response shape. Affects '200 with artist upsert', '200 with
track delete', and 'like_track upsert + delete round-trip'.
quarantine_provider_test 'flag keeps drift optimistic + queues
mutation on server failure':
When the API stub throws, the controller catches + queues to
CachedMutations. The drift watch() stream in MyQuarantineController
was still in loading state when addTearDown disposed the
container, tripping Riverpod's "StreamProvider disposed during
loading" assertion. The success-path tests resolved before
tearDown so they didn't see it. Fix: await one microtask before
the test ends so the stream emits.
like_button_test 'tap toggles icon optimistically; rollback on error':
After the LikeButton was migrated to LucideHeart in the Lucide
sweep, the prior fix replaced the find.byIcon assertion with a
heartFilled() helper reading LucideHeart.filled. But likesController
.toggle() goes through an async chain (optimistic state flip + await
api.like + state notification), which one frame of tester.pump()
doesn't flush. Use pumpAndSettle after both tap and rollback toggle
so the widget rebuilds with the new state before the assertion.
After this push, the drift cohort should be all-green on the
libsqlite3-bearing image. Fable #399 / local #62.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Both fixes paired with the ci-flutter:3.44 rebuild that adds
libsqlite3-dev to the runner image (CI-runner push #2: libsqlite3-0
→ -dev because dart:ffi opens the unversioned .so symlink that only
the dev package ships).
widgets_smoke_test (TrackRow):
TrackRow contains CachedIndicator which reaches
audioCacheManagerProvider → appDbProvider → drift_flutter's
`driftDatabase()`. That schedules a deferred-init Timer that
outlives the test widget tree and trips the
"A Timer is still pending after dispose" invariant. Override
appDbProvider in the test to use AppDb(NativeDatabase.memory())
directly — bypasses drift_flutter's Timer-using init path, still
exercises real SQLite via FFI.
like_button_test (tap toggles + rollback):
LikeButton was migrated to LucideHeart (SVG widget with `filled`
bool) in the Lucide sweep; the test's `find.byIcon(Icons.favorite)`
is stale. Replace with a small heartFilled() helper that reads
the LucideHeart's `filled` prop straight off the widget tree.
Same assertion semantics, just against the post-migration shape.
The four sync_controller failures need no code change — they're
the same root cause as the drift-tagged cohort (libsqlite3.so
missing → try/catch returns null → `result?.upserts` is null
instead of the expected 0). The image fix should clear them.
Fable #399 / local #62.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Drops the libsqlite3-missing skip cohort now that the ci-flutter
runner image installs libsqlite3-0 (CI-runner commit on its main).
Per-file removals (no behavior change in tests themselves — they
just stop being skipped):
- `@Tags(['drift'])` + `library;` directive from 5 files.
- `const _skipDrift = ...;` declaration + its rationale comment
from 6 files (the 5 above + like_button_test.dart, which had its
own _skipDrift for the rollback-via-drift case).
- `skip: _skipDrift` annotations from 17 test invocations across
those 6 files (16 single-line + 1 multi-line in like_button).
- Stale `@Tags(['drift']) tier covers it` reference in
home_screen_test.dart's drift-coverage comment.
Net -79 +18 lines across 7 files; 17 previously-silent tests are
now part of the CI signal. Fable #399.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Two fixes for CI bounces caused by the new ci-go:1.26 / ci-flutter:3.44
toolchain images surfacing stricter checks than the previous runners.
1. .golangci.yml: migrate to v2 schema
- Add `version: "2"` (now required).
- `linters.disable-all: true` → `linters.default: none`.
- Move `gofmt` + `goimports` out of `linters` into the new
top-level `formatters:` block (v2 separates linters and
formatters).
- Nest `linters-settings:` under `linters.settings:`.
- Drop the v1-only `issues.exclude-use-default: false`
(v2 default exclusion behavior is what we want).
2. Flutter 3.44 made ListTile-inside-ColoredBox a hard assertion
(was a warning before). Both bottom sheets in track_actions/
set Container.color on the outer surface, which inserts a
ColoredBox above their ListTiles. Wrap each ListTile in
`Material(type: MaterialType.transparency)` so it has an ink
target beneath the outer color paint without changing the
visual surface:
- track_actions_sheet.dart `_MenuItem.build`
- add_to_playlist_sheet.dart inner ListTile
5 failing widget tests should pass with this change. Local task #70.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Both verified unused at the source/config level (Fable #461 +
audit note #460):
- cupertino_icons: zero `CupertinoIcons` / cupertino imports in
flutter_client/lib/. Pure `flutter create` template residue;
the design system mandates Lucide.
- tslib: web/tsconfig.json does not set `importHelpers: true`,
so TypeScript inlines helpers per-file. Declared peer with no
runtime consumer.
`npm uninstall tslib --save-dev` updated package-lock.json
surgically (8 lines removed for the tslib entry only). No other
deps disturbed.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Reported: on poor coverage a track ends and the next (uncached) track
never starts — streams, hangs, no retry. Root cause: a buffering stall
emits NO error event so the onError path never fires and there was no
stall watchdog; even on a real error _handlePlaybackError immediately
skipped the literal-next (likely also-unreachable) source with no retry.
- _reconcileStallWatchdog: while playing+buffering, a 15s window; if
buffered position hasn't advanced it's a dead stream → recover; if
progressing, re-arm (slow-but-downloading is fine). Driven from
_broadcastState like the idle/position reconcilers.
- _recoverPlayback unifies stall + onError: retry the SAME track once
(skipToQueueItem rebuilds a fresh source/HTTP — a transient blip no
longer loses it); on exhaustion, surface via the #58 SnackBar and
skip to the next cached track, else pause (no thrashing through
unreachable streams).
- per-track retry budget resets when a track reaches ready+playing.
- _handlePlaybackError now delegates into the unified path.
Core playback change — device-verify on a throttled connection.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The home screen renders solely from the per-item cached_home_index
path (proven on devices for many releases); the legacy snapshot stack
was dead weight.
- library_providers: remove homeProvider + _encodeHomeData +
_albumToJson/_artistToJson/_trackToJson; drop now-unused dart:convert
and models/home_data.dart imports
- metadata_prefetcher: re-point off homeIndexProvider/HomeIndex —
pre-warm artistProvider from the rediscover/last-played artist
sections (album/track tiles hydrate their own artist on render)
- live_events_dispatcher: homeProvider -> homeIndexProvider so live
events still refresh the home screen
- db.dart: drop CachedHomeSnapshot (table class + @DriftDatabase
entry); schemaVersion 10->11; from<3 createTable -> raw
customStatement so the historical step compiles without the
generated symbol; from<11 DROP TABLE cached_home_snapshot
No test references the removed symbols. db.g.dart regenerated by CI.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Device logcat (Pixel 6 Pro / Android 16) showed audio_service throwing
on every state broadcast:
java.lang.IllegalArgumentException: You must specify an icon resource
id to build a CustomAction
at com.ryanheise.audioservice.AudioService...
The #57 MediaControl.custom favorite makes audio_service build a
PlaybackStateCompat.CustomAction whose icon id resolves to 0 on real
builds; the exception aborts the ENTIRE media notification, so nothing
posts to the tray or the watch (emulator tolerated it). Not a
permission / PathParser / FGS issue — POST_NOTIFICATIONS was verified
granted. Pre-#57 there was no CustomAction, matching the regression.
Remove the custom favorite control; the notification is rebuilt with
only the standard transport controls (audio_service ships their icons).
customAction handler / refreshFavoriteControl left as harmless no-ops
to minimise churn. Like/favorite remains in-app + lock screen.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Device-surfaced on physical Android 13+ (worked on emulator):
A) The media notification never appeared because the app never
requested POST_NOTIFICATIONS at runtime — the manifest declares it
and the foreground service is correct, but Android 13+ denies it by
default until asked. Add permission_handler ^12.0.1 and request
Permission.notification once at startup (post-first-frame,
Platform.isAndroid-guarded; no-op on <13 / once decided).
B) When the #52 idle/dismiss teardown nulled mediaItem while the full
NowPlayingScreen was open, it stranded the user on an empty
"Nothing playing." Scaffold. Now post-frame maybePop() so it
auto-minimizes (the mini bar is already gone).
pubspec.lock + db.g.dart regenerated by CI/build.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Fast-follow of #54. After the #52 idle/dismiss teardown, pressing play
on a headset / watch / lock screen did nothing (handler.play() was just
_player.play() with nothing loaded; the handler is Riverpod-agnostic).
- audio_handler: _resumeHook + setResumeHook(); play() is now async —
when mediaItem == null and a hook is set it awaits the hook (which
restores + plays) and returns, else _player.play()
- resume_controller: extract shared _loadAndRestore() (bool); _restore()
keeps the paused launch path; new resumeFromMediaButton() restores
then starts playback; start() registers it via setResumeHook
Recursion-safe (post-restore mediaItem != null so the re-play hits
_player.play()); no-op when nothing to resume / auth missing / a
session is already active.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
#60 swapped Icons.more_vert -> LucideIcons.ellipsis_vertical in
playlist_card.dart; the widget test still asserted the old Material
icon (find.byIcon(Icons.more_vert)) and failed. Update both finders
+ import flutter_lucide.
Note: like_button_test.dart still references Icons.favorite but is
skip:true (gated on Fable #399) so it compiles and doesn't run;
flagged as stale to update when that test is unskipped.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Mechanical sweep across 30 files: every Material Icons.* replaced with
the signed-off Lucide equivalent + a flutter_lucide import per file.
Zero Material Icons.* remain in lib/; no unused imports.
Judgment-call mappings: album->disc_3, library_music->library_big,
playlist_play->list_video, graphic_eq->audio_lines,
system_update->download, restore->archive_restore,
download_done->circle_check_big.
track_actions_sheet like menu row: collapsed `liked ? favorite :
favorite_border` to a single LucideIcons.heart (the row's Like/Unlike
text label conveys state). Icon-only LikeButton + the notification keep
the filled-vs-outline shape per the design decision.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Design system mandates Lucide, not Material. Foundation before the
mechanical Icons.* sweep:
- pubspec: add flutter_lucide ^1.11.0
- shared/widgets/lucide_heart.dart: LucideHeart renders the verified
lucide-icons/lucide heart path as outline (stroke) or filled, via
flutter_svg, tinted by color — Lucide ships no filled heart, so the
liked state fills the same Lucide silhouette (user-chosen approach)
- like_button: use LucideHeart instead of Icons.favorite/_border
- notification drawables re-derived from the verbatim Lucide heart
path (border = stroke, filled = fill); separators spaced for
Android pathData
Unit 2 (mechanical Icons.* -> LucideIcons.* sweep) follows once this
is CI-green. pubspec.lock regenerated by CI.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
_handlePlaybackError silently skipped a dead track (404 / decoder /
EOS / network drop) with only a debugPrint, hiding the signal that
tells a broken track from a flaky app.
- audio_handler: _playbackErrors broadcast stream; emit the failing
track title (mediaItem.value?.title — correctly mapped post-#49)
before the skip/pause
- playback_error_reporter (new): global scaffoldMessengerKey +
reporter that buffers, 2s-debounces, and coalesces bursts into one
SnackBar ("Couldn't play X — skipping" / "Skipped N unplayable
tracks")
- app.dart: scaffoldMessengerKey on MaterialApp.router + postFrame read
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
`Future<dynamic>` in the customAction doc comment tripped
unintended_html_in_doc_comment (bare angle brackets read as HTML).
Wrap the code identifiers in backticks.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Adds a heart action to the media notification implemented as a custom
control + customAction handler — NOT setRating, which is broken
upstream (audio_service #376: onSetRating never fires from a
notification tap) and previously blanked the Pixel Watch.
- res/drawable/ic_stat_favorite{,_border}.xml: white 24dp vector hearts
- audio_handler: favorite MediaControl.custom in _broadcastState
(icon/label toggle by LikeBridge state; kept out of
androidCompactActionIndices so compact/lock + Wear transport are
unchanged); customAction override (Future<dynamic>, matches base)
toggles the like then re-broadcasts; refreshFavoriteControl()
- player_provider: cascade refreshFavoriteControl into the likedIds
listener so liking from TrackRow/kebab/SSE flips the notification heart
Reliable on phone notification + lock screen; Wear/Auto display of a
non-transport custom action is platform-dependent (not a bug).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
AudioServiceConfig handed full-res album art to the notification /
lock screen / Wear. Add artDownscaleWidth/Height: 300 + preloadArtwork
so external surfaces get a smaller, faster, lower-memory cover with a
warm first paint.
6b (notification tap-to-open) dropped: androidNotificationClickStarts
Activity already defaults to true, so the tap foregrounds the app;
deep-linking to now-playing isn't a config knob and was judged
disproportionate.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
_broadcastState only set updatePosition on transitions, so the lock-
screen / Wear / Android Auto scrubber jumped in chunks (the in-app bar
uses positionStream and was fine). Add _positionBroadcastTimer: a 1s
periodic PlaybackState re-broadcast while actively playing so
updateTime/updatePosition stay fresh and external surfaces interpolate
smoothly. Idempotent (driven from _broadcastState, which the tick
itself calls — guarded against pile-up), cancelled when not playing
and in stop(). 6a: the notification progress bar now advances since
MediaItem.duration was already set.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The #52 teardown clears the session when idle/dismissed, so the
headset / lock-screen play button had nothing to resume and the user
lost their place.
- track.dart: toJson() (round-trips fromJson)
- db.dart: CachedResumeState single-row snapshot, schema 9->10 + migration
- audio_handler.dart: queuedTracks getter
- player_provider.dart: restoreQueue() — configure + setQueueFromTracks
+ seek, no play (restores PAUSED)
- resume_controller.dart: restores last snapshot paused on launch;
persists {source,index,position_ms,tracks} debounced on track
change / pause and immediately on app teardown; never clobbers the
saved snapshot when the queue is empty so a teardown stays
recoverable; restore gated on auth + no active session
- app.dart: wired into postFrame
db.g.dart regenerated by CI per project convention. Deferred fast-follow:
media-button-when-fully-stopped re-init (needs a configure()-injected
callback; tracked on #54).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
AudioSessionConfiguration.music() is a const constructor; the earlier
pre-emptive drop of `const` tripped prefer_const_constructors under
flutter analyze --fatal-infos.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The Flutter client had no audio_session integration, so it didn't pause
for phone calls / other media, didn't duck for navigation prompts, and
kept blasting the phone speaker when earbuds were unplugged.
Add audio_session ^0.2.3 and configure AudioSessionConfiguration.music()
in MinstrelAudioHandler (best-effort, fully try-caught):
- becomingNoisy -> pause (no speaker blast on unplug/BT drop)
- interruption begin: duck -> lower volume; pause/unknown -> pause,
remembering whether we were actively playing
- interruption end: duck -> restore volume; pause -> resume only if we
paused it and the session isn't torn down (guards the idle-teardown
-during-long-call edge; re-init is resume-last-session territory);
unknown -> no auto-resume
pubspec.lock regenerated by build/CI.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Nothing drove the audio_service session to a terminal state and the
notification is configured ongoing, so the Wear tile / lock screen /
notification lingered on a stale paused track indefinitely.
- stop() override: pause, broadcast idle, clear queue/mediaItem, then
super.stop() so the foreground service + notification (and watch tile)
tear down; in-app mini bar collapses in lockstep.
- onTaskRemoved(): keep playing if audio is active (standard media
behaviour), otherwise stop so a dismissed-while-paused app doesn't
leave a stale tile.
- 5-minute idle timer armed while paused or on a finished queue,
cancelled on resume / new queue, re-checked at fire time.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
player: setQueueFromTracks fast-starts a single source at player-index 0
while the full queue is broadcast, so the transient currentIndexStream→0
emission clobbered the correct mediaItem with queue.value[0] (the first
track). Mini bar / playlist marker pinned to the wrong track until a
later index event (~the "passive ~30s recovery"). Track a logical-index
base so the player→queue mapping stays correct during the fill window;
also fixes the latent forward-fill auto-advance off-by-base.
lidarr #50: approving no longer fails when Lidarr is down. Approve
records the decision durably first, then best-effort adds; the
reconciler idempotently (re)sends unconfirmed adds every tick until they
stick (new additive lidarr_add_confirmed_at; AddArtist/AddAlbum map
Lidarr's "already exists" 400 → ErrAlreadyExists). No failed-state or
expiry by design — Lidarr keeps trying, operator monitors.
lidarr #51: Create() is now idempotent — a non-terminal request for the
same MBID returns the existing row instead of inserting a duplicate.
Rewrites the obsolete LidarrUnreachable_503 test to assert the durable-
approve contract; threads a client factory into NewReconciler.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The Flutter Discover screen was Lidarr-search-only; its empty state
showed a "Type to search" placeholder while web's /discover renders
the LB-derived out-of-library artist SuggestionFeed as its default
surface. Parity gap that slipped #356.
- ArtistSuggestion/SeedContribution model mirroring web types, with
attributionText() matching web's "Because you liked/played X[, Y, and
Z]." (Oxford comma, max 3).
- DiscoverApi.listSuggestions() → GET /api/discover/suggestions
(image_url already resolved server-side from Lidarr, a7bea43).
- discover_screen: empty search box → suggestions feed (artist art +
name + attribution + Request, reusing the existing createRequest +
mutation-queue-replay flow with optimistic hide); typing → Lidarr
search replaces; clearing → suggestions return. Mirrors web exactly.
Flutter-only; server endpoint unchanged.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
HOTFIX for v2026.05.15.0. R3 added deep_cuts/rediscover/new_for_you/
on_this_day/first_listens producers + registry entries but not their
system_variant values to the playlists_kind_variant_consistent /
playlists_seed_consistent CHECK constraints (0021's whitelist).
insertSystemPlaylist for any new mix → SQLSTATE 23514, and since
BuildSystemPlaylists is one all-or-nothing txn that aborts the
ENTIRE build — For-You/Discover refresh 500s and the daily lazy
build fails too. System playlists are fully broken in prod.
Migration 0028 drops + re-adds both constraints with all five new
seedless variants (mirrors the 0021 drop-and-readd pattern).
CHECK-only — sqlc/dbq unaffected (regen produced no drift).
Bumps to 2026.5.15+7 for the v2026.05.15.1 patch release.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Closes the last buildable item of the #411 system-playlists-v2
umbrella. System playlists atomic-replace on rebuild, so created_at
(already on the wire — no server change) is the last-rotated time.
Surface it as a small tile subtitle so users see how fresh a mix
is: "Refreshed just now / today / yesterday / N days ago / Mon D".
- web PlaylistCard: refreshedLabel() + a muted footer line, shown
only when system_variant != null. Unparseable/empty timestamp →
suppressed (web test fixtures use created_at:'' so no test churn).
- flutter PlaylistCard: mirrored _refreshedLabel() + subtitle under
the system badge for isSystem playlists.
Friendly wording deliberately distinct from HistoryRow's "m/h ago";
per-surface helper per the project's existing relative-time
convention. CI-pending; closes with the umbrella on device-check.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Operator's model: offline, surface the cache-backed pools right
where the (now play-disabled, S4a) system playlists sit, so Home
still has something to play.
- ShuffleSource gains recentlyPlayed() (cache by lastPlayedAt desc,
liked included) and liked() (cache ∩ liked set); shared _refs()
materializes ordered ids from cached_tracks/artists/albums.
Shuffle-all reuses the same recency walk.
- Home Playlists row: when offlineProvider is true, prepend two
tiles — "Recently played" / "Liked" — sized to PlaylistCard.
Tap → shuffle+play that pool from cache; empty → snackbar.
System tiles still render (play disabled per S4a) beside them.
- offline=false (online + all widget tests) → no extra tiles;
placeholder-count tests unaffected.
Closes the S4 thread of the #427 umbrella (S4a + S4b).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Query-builder methods come through the generated AppDb, not the
drift package directly — the import was dead. (#427 S4a)
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Operator: Shuffle-all belongs in the Library view, not the Home
app bar. Moved the shuffle IconButton to LibraryScreen's app bar
(same behavior — online server-random / offline cache-union via
shuffleSourceProvider); reverted Home's app bar to the original
MainAppBarActions-only and dropped the now-unused imports.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Headline of S4. "Shuffle all" is always present (home app-bar
shuffle icon); the pool degrades with reachability:
- online → GET /api/library/shuffle?limit=N (new): N random
library tracks server-side, per-user quarantine filtered
(ListRandomTracksForUser, ORDER BY random()).
- offline → ShuffleSource shuffles the whole local cache index
(audio_cache_index ∩ cached_tracks, names from cached_artists/
albums) — a UNION over liked AND recently-played, since the
two-bucket split is storage-only and never filters playback.
Offline gating: refreshable (singleton) system playlists need the
live build/shuffle endpoints, so their tile play is disabled when
offlineProvider is true — Shuffle all is the offline path. User
playlists still play from cache.
playlist_card now reads offlineProvider in build → wrapped the
direct-render widget test in ProviderScope (offlineProvider is
smoke-safe from S1: tracked timers, no connectivity mount).
S4b (offline Recently-played / Liked browsable surfaces over the
cache index) next.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Replaces the single 5GB capBytes with independent Liked + Rolling
budgets (5GB each default). Bucket = liked-ness, NOT CacheSource:
a cached track currently in the liked set is charged to / evicted
under Liked; everything else is Rolling. Storage-only dedup — it
never filters playback (S4's offline lists query the whole index).
- db.dart: schema 8→9, AudioCacheIndex.lastPlayedAt (real play
recency for S4 + rolling LRU; migration backfills to cachedAt).
drift codegen run.
- cache_settings: likedCapBytes + rollingCapBytes (+ setters); old
cache_cap_bytes key dropped, defaults reapply (not data loss).
- audio_cache_manager: touch(); bucketUsage() counts orphan
partials (LockCaching files never indexed) as Rolling so the cap
truly bounds disk; evictBuckets() drains non-liked LRU then
sweeps orphans, Liked only by its own (large) cap — normal use
never evicts the user's liked library.
- prefetcher → evictBuckets with the cached liked set.
- storage_section: two cap selectors + per-bucket usage (folds in
S3 to avoid a broken intermediate).
- Explicit Download dropped: removed album + playlist Download
buttons, autoPlaylist pins, now-unused imports.
- Tests updated/compiled (drift-cohort tests are CI-skipped).
High blast radius (eviction deletes files) — liked-protective by
design; needs operator device-check before "done".
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
offlineProvider: a Notifier<bool> driven by a periodic /healthz
probe. Offline after N=3 consecutive failed probes; recovers on
the first success. Slow heartbeat when online (30s), faster when
offline (10s) so recovery is noticed quickly. 5s initial delay for
provider warmup; optimistic (false) until proven otherwise.
Deliberately NOT coupled to connectivityProvider — subscribing to
that StreamProvider eagerly mounts its 2s timeout and leaks a
pending Timer through widget tests (the MutationReplayer bug).
/healthz failing already covers interface-down. No .timeout()
wrapper either (dio's own timeouts bound the probe) so the only
Timers are the tracked initial+periodic, both cancelled via
ref.onDispose — the proven smoke-safe shape.
Wired in app.dart postFrame to start the poller. No UI yet; S4
gates system-playlist play + Shuffle-all on it.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Replaces the per-kind refresh/shuffle handlers with one generic
pair driven off the kind registry, in lockstep across both clients.
Server:
- systemPlaylistKind gains Singleton; RefreshableSystemKind(key)
exported. for_you/discover singleton; songs_like_artist not.
- New generic POST /api/playlists/system/{kind}/refresh and
GET /api/playlists/system/{kind}/shuffle ({kind} = raw
system_variant). Non-singleton/unknown kind → 404. Deleted
playlists_{foryou,discover}_refresh.go and the per-kind shuffle
wrappers; serveSystemPlaylistShuffle core kept.
- playlistRowView.refreshable: server-derived flag so clients show
the refresh affordance generically without hardcoding kinds.
Web (not drift-cached → uses the server flag):
- refreshSystem(variant) replaces refreshForYou/refreshDiscover;
systemShuffle drops the for_you→for-you mapping (raw variant).
- PlaylistCard + detail page gate the kebab/Refresh button on
playlist.refreshable; label is "Refresh {name}". Tests reworked;
obsolete refresh-foryou/discover api tests deleted.
Flutter (list tiles are drift-cache-sourced → derive, no migration):
- Playlist.refreshable getter = isSystem && variant !=
songs_like_artist (holds for all current + planned kinds).
- refreshSystem/systemShuffle use the raw variant; PlaylistCard +
detail screen gate kebab/Regenerate/source-tagging on refreshable
so songs_like_artist plays via get() (no by-kind endpoint).
Pure-plumbing refactor; CI verifies parity. Next (R3): the five
discovery mixes — each a candidate query + one registry entry.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Flutter half of offline-replay capture. Play events no longer
fire-and-forget: the reporter now tracks each play as a completed
unit (track, original start time, source, duration reached)
independently of connectivity.
- EventsApi.playOffline: single timestamp-preserving call → the new
/api/events play_offline (47aa178).
- MutationQueue: new play.offline kind + handler (EventsApi).
- PlayEventsReporter rework:
- _beginTrack captures start context + fires live play_started;
the server id is adopted only if it lands while still on-track.
- position progress gated on the tracked track id so a track
change can't clobber the finishing track's last values.
- _closeCurrent: if a server id registered, attempt the live
ended/skipped and fall back to the offline queue on failure; if
no id (offline start) enqueue the completed play directly. The
server applies the canonical skip rule, so the offline payload
only carries duration.
- app paused/detached closes durably via the queue (survives a
process kill; a teardown POST would not).
Result: listening to cached tracks fully offline now records
history / recs / scrobble / #415 rotation once back online, with
the original timestamps. Web stays best-effort by standing
occasional-use scope.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>