Repository navigation
Extract AniSprinkles.Core so PageModels can be tested (#62, #117) - #123
Conversation
The unit tests could not reach a single PageModel: tests/AniSprinkles.UnitTests link-compiled individual files out of src/, so anything touching Shell, a popup or the icon font was untestable. Every one of the six defects PR #116 found lives in exactly that code, and three of them were regressions introduced by the previous round's fix. Re-measuring the blocker first showed two of the three package restrictions the issue was written around no longer hold: Microsoft.Maui.Controls 10.0.60 and CommunityToolkit.Maui 14.2.0 both ship plain net10.0 assemblies, so Shell, Keyboard, Popup, PopupOptions and ShowPopupAsync all compile off-device. The real blockers were narrower — the icon font, the XAML popup types, and Android. Layout: src/AniSprinkles/ (net10.0-android) and src/AniSprinkles.Core/ (net10.0) are siblings. Core initially sat inside the app project's folder, where the app's default globs swept up 602 of Core's sources plus its obj/ generated assembly attributes and failed as CS0579. DefaultItemExcludes suppresses that, but siblings need no suppression at all. Core holds Models, Utilities, non-platform Services, Converters and every PageModel. It deliberately references neither CommunityToolkit.Maui nor IconFont.Maui.FluentIcons — leaving those out is what stops the new seams eroding. Three seams carry what stayed behind: - IDialogService covers the five XAML popups plus DisplayPromptAsync, implemented by MauiDialogService next to the existing MauiShellNavigationService and MauiUserFeedback. This matters beyond compilation: Shell.Current is null rather than throwing off-device, so a popup call from a PageModel silently no-ops and its test passes without exercising anything. - IExternalBrowser covers the four "view on AniList" links. - Core mirrors the 57 icon glyphs it uses into Icons/Glyphs.cs, generated by tools/generate-glyphs.cs from the package's PE metadata. The package ships platform TFMs only. Also folded in, because the move surfaced them: - OutageStateService called MainThread.IsMainThread, which throws NotImplementedInReferenceAssemblyException off-device; its catch only covered InvalidOperationException, so the comment promising an inline fallback in unit tests was never true. Now uses the injected IDispatcher. - SettingsPageModel read AppInfo.Current in a field initializer, so the type could not be constructed off-device at all. IAppInfo is injected alongside IPreferences. - Four PageModels each carried a private copy of the same toast/snackbar helpers; they now share IUserFeedback. Plain snackbars move 5s -> 4s as a result; the 20s settings save-failure and 10s permission snackbars are preserved through a new optional duration. - Browser-open failures log at Warning rather than Error, matching how MauiUserFeedback treats its own display failures, and so stop raising Sentry events for a device concern. ListEntryStatusFlow becomes an instance singleton so its confirm/rating prompts can go through IDialogService. The tap-suppression window moves to Core as LongPressTapSuppressor; the Android gesture plumbing stays in Views. The test project now project-references Core. All 391 existing tests pass unchanged; Core's internals stay internal via InternalsVisibleTo rather than being widened for tests.
src/AniSprinkles/AppShell.xaml shipped x:Static icons:FluentIconsRegular.Compass24 — the real member is CompassNorthwest24. x:Static is resolved by the XAML loader at runtime, so the build was completely clean and the app crashed on launch with XamlParseException. That one was lucky: AppShell loads at startup, so it failed immediately and unmissably. The same typo on a details page would build, pass tests, pass CI screenshots, and only crash when a user opened that screen. Two things are checked, both driven off the icon assembly's PE metadata: - Every x:Static icon reference in src/**/*.xaml resolves. The xmlns prefix is read from the file rather than assumed to be "icons:", so renaming it cannot quietly switch the test off. - Every constant in Core's mirrored Glyphs table still matches the package by name AND value. Mirroring those glyphs (#62) was only acceptable on the condition that drift becomes a build failure, and this is that condition. PE metadata rather than Assembly.Load: the package targets net10.0-android36.0 and will not load into a net10.0 test host. Two approaches that produced confidently wrong answers on the way here are documented at the call site — substring-matching the DLL reports Compass24 as present because CompassNorthwest24 contains it, and a regex over the #Strings heap silently misses every other name because entries share NUL delimiters. The pinned version is read from whichever project under src/ declares the package, not a hardcoded path. An unresolvable package cache skips (a fresh machine, an unrestored bump); a missing declaration throws, because that is a repo-structure problem rather than an environment gap. Empty-discovery guards keep both theories from passing vacuously. Verified by reintroducing Compass24 (fails, naming the file and suggesting CompassNorthwest24) and by tampering with a mirrored glyph value (fails, printing both escaped code points and the regeneration command).
The #62 extraction is only worth its diff if the code it unblocked is actually covered. These are the defects PR #116 found across six review rounds — none were reachable by the previous 391 tests, and none are reachable on device either: each needs a specific interleaving that the happy-path pass cannot produce. SearchPageModel: - A failed page 1 on a new query must not re-arm Load More over the previous query's results. The failure clears IsSearching in its finally (that is what stops the spinner), which used to leave the section holding the old items with HasNextPage set — so scrolling appended page 2 of the new query onto the old query's results, one list silently mixing two searches. - Load More must page under the filter page 1 used. The adult filter was read live per page, and Settings debounces 1500ms and only applies the value from the server response, so a user could toggle, return inside that window with nothing detected as changed, and have the new value land in time to page a different policy onto results already on screen. - An adult flip while the first search is still in flight must invalidate. The context used to be recorded on fetch success, so a first search in flight left "nothing searched yet" set and the flip baselined the new context WITHOUT cancelling the old request, whose response then marked itself current forever. - A superseded search resuming late must not clear its successor's spinner. DiscoverPageModel: - Load More must be refused while a refresh is still reading auth. The guard used to cover only the window after IsBusy went up, but LoadCoreAsync awaits the auth read before setting it. Each of these was confirmed to fail against the reverted fix and pass against the current code, so they catch what they claim to rather than merely passing. Also #52's own phase-1 list for MediaDetailsPageModel.LoadAsync (happy path, non-positive id, null media, NotFound hiding Retry, throw keeping Retry, reuse without a second request, in-memory list entry not clobbered) and the reachable SettingsPageModel.LoadAsync branches. SettingsPageModel's authenticated happy path is deliberately absent: it ends in AppSettings.SyncFromViewer, which persists through the static Preferences.Default and throws off-device, so the test would be asserting on the catch block. Giving AppSettings a preferences seam is the open decision on #52 and is noted there. SearchPageModel takes a TimeProvider so its 600ms debounce is deterministic under test rather than a real sleep per case; DiscoverPageModel already took one. Test classes touching the process-wide AppSettings statics now share a non-parallel collection.
An audit of the 130 types now in Core against every test file found 56 never mentioned at all. Most are DTOs and fine, but three groups were not. EntryActionCoordinator had zero coverage and is the highest-value thing #62 unblocked: every list surface (My Anime, Discover, Search, View All) routes its long-press flows through it, so one defect surfaces in four places. It was previously unreachable because each entry point opened a popup through Shell.Current, which is null rather than throwing off-device — the flow would no-op and any test of it would pass without executing a decision. Now covered: menu routing and dismissal, the flush-before-flow hook, remove-vs-move branching, rollback of status/progress/score/repeat on a failed move, retry targeting the id captured at failure time, outage suppressing the retry action, id adoption on add-to-list, and the completion flow's re-entrancy guard. Code added in this branch had none of its own. Covered now: the outage/retry rule in UserFeedbackExtensions, MoveToListChoice's two shapes, LongPressTapSuppressor, and OutageStateService — including the dispatcher fallback that replaced the MainThread call whose catch never covered what it threw. MyAnimePageModel's +1 debounce: six taps collapse to one write (the app's largest single rate-limit saving), a failure reverts to before the first tap rather than one step, switching entries flushes the previous one, and reaching a known total routes to the completion flow instead of the debounce. Takes a TimeProvider for the same reason SearchPageModel does — a real 1500 ms sleep per case is neither fast nor deterministic. Plus #52 phase 3 (converters — the Brush-vs-Color target rule that MAUI's Background/BackgroundColor precedence makes load-bearing, hash stability, format glyph mapping) and ImageUrl, where AniList returns a default.jpg placeholder rather than null and a plain null check leaves its grey graphic on screen. Every new behavioural assertion was mutation-checked: the entry-switch flush, revert depth, completion routing, remove-vs-move, the completion guard, the id-less-create throw, and the dropped-dispatch fallback were each broken in turn and confirmed to fail the intended test. Two of those mutations hung the suite rather than failing it, so both tests are now bounded with WaitAsync — a hang in CI reads as an infrastructure problem, not a regression. 680 tests, up from 603.
There was a problem hiding this comment.
🔵 Needs a closer look
It’s a large cross-cutting refactor (project split + DI seams + MAUI/Android integration changes) where a final human pass is warranted despite only minor actionable nits found.
Pull request overview
Extracts a new AniSprinkles.Core (net10.0) library so PageModels, models, utilities, and non-platform services can be project-referenced by tests/AniSprinkles.UnitTests (instead of link-compiling), enabling deterministic off-device unit testing while keeping MAUI/Android-only code in the app project.
Changes:
- Split code into sibling projects (
src/AniSprinkles.Core/+src/AniSprinkles/) and routed MAUI-only behavior through new/expanded abstractions (IDialogService,IExternalBrowser, updatedIUserFeedback). - Updated app XAML namespace references to point at
AniSprinkles.Coretypes (clr-namespace:...;assembly=AniSprinkles.Core) and added new/adjusted views/popups to support the new seams. - Expanded the unit test suite with new fakes/helpers and additional coverage for newly testable logic.
File summaries
| File | Description |
|---|---|
| tests/AniSprinkles.UnitTests/TestDataBuilder.cs | Clarifies AppSettings reset strategy for tests on plain net10.0. |
| tests/AniSprinkles.UnitTests/AppSettingsCollection.cs | Serializes tests that mutate process-wide AppSettings state. |
| tests/AniSprinkles.UnitTests/MediaListSectionsMergerTests.cs | Joins the AppSettings-serialization collection. |
| tests/AniSprinkles.UnitTests/MediaListEntryProgressTests.cs | Joins the AppSettings-serialization collection. |
| tests/AniSprinkles.UnitTests/MediaListEntryActionPredicatesTests.cs | Joins the AppSettings-serialization collection. |
| tests/AniSprinkles.UnitTests/ListEntryStatusMutationsTests.cs | Joins the AppSettings-serialization collection. |
| tests/AniSprinkles.UnitTests/ImageUrlTests.cs | Adds regression tests for AniList “default.jpg” placeholder handling. |
| tests/AniSprinkles.UnitTests/Fakes/RecordingUserFeedback.cs | Adds a recording IUserFeedback double for asserting user-facing signals. |
| tests/AniSprinkles.UnitTests/Fakes/ImmediateDispatcher.cs | Adds an inline IDispatcher fake for off-device PageModel execution. |
| src/AniSprinkles.Core/AniSprinkles.Core.csproj | Introduces the new net10.0 Core library with deliberate package constraints. |
| src/AniSprinkles.Core/Properties/AssemblyInfo.cs | Keeps test visibility to internal members via InternalsVisibleTo. |
| src/AniSprinkles.Core/Services/OutageStateService.cs | Moves outage UI-thread marshalling onto injected IDispatcher for testability. |
| src/AniSprinkles.Core/Services/AniListApiException.cs | Centralizes error icon glyph selection via mirrored Glyphs. |
| src/AniSprinkles.Core/Services/Abstractions/IExternalBrowser.cs | Adds seam for browser launching to keep PageModels testable. |
| src/AniSprinkles.Core/Services/Abstractions/IUserFeedback.cs | Extends snackbar API with optional duration override. |
| src/AniSprinkles.Core/Converters/SortFieldStrokeConverter.cs | Adds converter for sort-chip stroke highlighting. |
| src/AniSprinkles.Core/Utilities/ImageUrl.cs | Adds canonical placeholder-URL detection for artwork URLs. |
| src/AniSprinkles.Core/Utilities/AppSettings.cs | Keeps model-accessible static settings surface in Core. |
| src/AniSprinkles/Services/Maui/MauiExternalBrowser.cs | Implements IExternalBrowser in MAUI app layer. |
| src/AniSprinkles/Services/Maui/MauiShellNavigationService.cs | Implements INavigationService over Shell.Current. |
| src/AniSprinkles/Services/Maui/MauiUserFeedback.cs | Updates snackbar action overload to accept optional duration. |
| src/AniSprinkles/MauiProgram.cs | Registers Core seams + DI for IPreferences/IAppInfo and other services. |
| src/AniSprinkles/AniSprinkles.csproj | References Core project and documents the split. |
| src/AniSprinkles/Utilities/ServiceProviderHelper.cs | Adds shared DI resolution helper for views needing late/defensive DI access. |
| src/AniSprinkles/Utilities/NavigationTelemetryHelper.cs | Adds helpers to parse nav trace/timing from Shell query parameters. |
| src/AniSprinkles/AppShell.xaml / AppShell.xaml.cs | Reintroduces/updates Shell with bottom tabs and per-tab icon swapping. |
| src/AniSprinkles/App.xaml / App.xaml.cs | Updates app startup + resource wiring for the new structure. |
| .github/workflows/ci-build-and-preview.yml | Updates build paths/cache key after project split. |
| .github/workflows/android-release.yml | Updates restore/build paths/cache key after project split. |
| README.md | Updates build commands to the new app csproj path. |
| AniSprinkles.slnx | Adds Core project to the solution manifest. |
| .gitignore | Refines tools/ ignore patterns to keep tracked scripts included. |
Review details
- Files reviewed: 90/263 changed files
- Comments generated: 1
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
…with an action PR review (Copilot) on #123. `LastSnackbarAction` was only ever assigned, never cleared, so after a snackbar that offered no action it still held an earlier one's. The underlying mismatch: the property tracked "the most recent snackbar *that offered an action*" — a filtered subset — while `Assert.Null(LastSnackbarAction)` means "the last snackbar offered none", which is a statement about the latest event. Those only agree while at most one snackbar has been shown, which is why no existing test was wrong. It matters on retry chains, which show several. Added the behavioural test that was hiding behind it: a delete that fails, is retried, and fails again into a service outage must stop offering a retry button that cannot work. That test fails against the old double *with correct production code*, which is the whole problem — the double was answering for a snackbar that was not the one under assertion. Doc comment updated to match; the old wording described the old behaviour accurately, so changing one without the other would have swapped a latent trap for a real doc/code mismatch. Considered recording (message, action) pairs instead, which is immune to ordering entirely. Rejected: it churns all 8 assertion sites and turns `Assert.Contains("AniList is Down", feedback.Snackbars)` into a predicate lambda, for precision only needed to assert about a non-final snackbar — which splits into separate tests instead.
There was a problem hiding this comment.
🔵 Needs a closer look
It currently includes at least one compile-breaking API call (DisplayAlertAsync) and a security gap where Bearer-token redaction is bypassed by logging/reporting the raw exception.
Review details
- Files reviewed: 90/272 changed files
- Comments generated: 0 new
- Review effort level: Lite
|
Triaged the second Copilot review (0 inline comments, so recording the findings here).
The redaction gap is real — filed as #124, not fixed here.
The vector is live: Two things the review did not distinguish: Not introduced here: |
The zero-warning rule in AGENTS.md covers the whole project, but the test project had been building with seven warnings — five of them since #123, and two added by this branch. The solution now builds clean. - xUnit1051 on the deliberate bounded waits: pass TestContext.Current.CancellationToken alongside the existing timeout. The WaitAsync(TimeSpan, CancellationToken) overload does both, so the timeout that turns a deadlock into a failure is unchanged; the token only adds responsiveness to a cancelled run. - xUnit1051 in AniListClientCancellationTests: pass the same token to the calls under test. The one call that deliberately passes its own token keeps it — there the token is the subject. - CS8620/CS8619 in DiscoverPageModelTests: AuthGate.WaitAsync returns Task<string?> to match IAuthService, which lets the null-suppression at the call site go rather than papering over the mismatch.
* Extract the shared spine from the four details page models (#120) Character (581 lines), Staff (585) and Studio (344) were three variations on one page, and MediaDetails (1,719) was a fourth copy of most of it. Pull the shared load/error/retry/favourite/external-link spine into DetailsPageModelBase<TEntity> and adopt it in all four: 3,229 lines across the page models becomes 2,491, plus a 379-line base. The entity is reached through a protected abstract accessor rather than held in the base, so each page model keeps its own [ObservableProperty] field and with it every XAML binding and NotifyPropertyChangedFor list. MediaDetails shares six of the eight members rather than all eight — it never had ShowError or OpenSiteUrl — and its load differs enough to need hooks: ShouldSkipLoad for its in-flight guard, OnEntityReused for the list-entry merge, NullResultIsRetryable, OnLoadStarting, OnAuthenticationResolved, and its own RetryLoadCore. It keeps the two-arg LoadAsync as its public entry point. Three divergences are unified rather than carried forward: - ErrorDetails on Character/Staff/Studio now records through ErrorReportService, as MediaDetails already did, instead of showing a raw exception message. - Favourites render through IFavouritable.FavouritesDisplay (MetricFormat.Compact) on all four. Character and Staff each carried a private copy that shadowed the model's, and those copies had no M tier — 1.2M favourites rendered as "1200k". - MediaDetails passes the page token to GetAccessTokenAsync, so its auth fetch is cancellable on navigate-away like the other three. Also fixes a bug the extraction surfaced: a failed load used to leave the previous entity in place with its sections already reset, so navigating back to it hit the same-id guard and showed Content over empty lists. The base drops the entity before fetching, with a regression test. ShowError is public so the four page code-behinds report render failures through one call instead of five property assignments each. Tests: one shared spine suite run against all four adopters, plus per-page suites for what is genuinely specific and MediaDetails.RetryLoad from #52 Phase 1. 681 -> 796. * CI: Update UI screenshots [skip ci] * Guard IsBusy against a superseded load clearing it (#126 review) A second load on the three reference-data pages supersedes the first via Scope.Begin(), which cancels its token. The superseded load then reaches its finally and clears IsBusy while its replacement is still fetching. Capture a generation at the start of the load and only clear IsBusy if it is still the live one, mirroring the guard PaginatedSection already uses. No reachable defect today — nothing on a details page binds IsBusy, and the code-behind's shouldShowContent also requires CurrentState == Content — but the ordering is only safe by accident, and the next caller to depend on IsBusy would inherit it. The accompanying spine test documents the invariant rather than proving the fix: it passes with and without the guard, because the unit harness resumes the cancelled load inline where a real MAUI SynchronizationContext posts it. * CI: Update UI screenshots [skip ci] * Only commit a MediaDetails load's state once it is accepted (#126 review) LoadAsync assigned _lastRequestedListEntry and _loadRequestId before LoadCoreAsync ran the in-flight guard, so a load that was then dropped left both behind for the load still running. The live load could seed the wrong list entry in SeedSections, RetryLoadCore could retry with it, and every remaining trace line the live load emitted was renumbered to the dropped load's id — which makes the load#N correlation worse than not having one. The original LoadAsync set both after its busy guard; the extraction moved them ahead of it. Move the guard into LoadAsync so nothing the load owns is written until it has been accepted, and drop the ShouldSkipLoad hook from the base now that nothing overrides it (ten hooks down to nine). Tests: a dropped load must not hand its list entry to the live one, must not renumber its trace lines, and retry must follow the load that was actually accepted. All three fail against the previous ordering. Also pins the timeout/cancellation split the details pages depend on: the page models swallow OperationCanceledException, which is only safe because AniListClient classifies a TaskCanceledException carrying an inner TimeoutException as ApiErrorKind.Network first. Without that a timeout would leave the page on a spinner with no error and no retry, so it is worth a test rather than an assumption. Adds RecordingLogger so the NAVTRACE/DATATRACE contract is assertable at all. * CI: Update UI screenshots [skip ci] * Clear the test project's warnings (#126 review) The zero-warning rule in AGENTS.md covers the whole project, but the test project had been building with seven warnings — five of them since #123, and two added by this branch. The solution now builds clean. - xUnit1051 on the deliberate bounded waits: pass TestContext.Current.CancellationToken alongside the existing timeout. The WaitAsync(TimeSpan, CancellationToken) overload does both, so the timeout that turns a deadlock into a failure is unchanged; the token only adds responsiveness to a cancelled run. - xUnit1051 in AniListClientCancellationTests: pass the same token to the calls under test. The one call that deliberately passes its own token keeps it — there the token is the subject. - CS8620/CS8619 in DiscoverPageModelTests: AuthGate.WaitAsync returns Task<string?> to match IAuthService, which lets the null-suppression at the call site go rather than papering over the mismatch. * Correct the details-spine docs after the guard moved (#126 review) The project-architecture skill still described ShouldSkipLoad as a hook MediaDetails overrides, and listed a skip-guard step in the templated load. Both went away in 5e86f30 when the in-flight guard moved into MediaDetails.LoadAsync, and the doc was not updated with them. Records why the guard sits there rather than in a hook, since that placement is what keeps a dropped load from writing state the live one reads — the thing the move was for. * CI: Update UI screenshots [skip ci] --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
* Extract AniSprinkles.Core as a sibling project (#62) The unit tests could not reach a single PageModel: tests/AniSprinkles.UnitTests link-compiled individual files out of src/, so anything touching Shell, a popup or the icon font was untestable. Every one of the six defects PR #116 found lives in exactly that code, and three of them were regressions introduced by the previous round's fix. Re-measuring the blocker first showed two of the three package restrictions the issue was written around no longer hold: Microsoft.Maui.Controls 10.0.60 and CommunityToolkit.Maui 14.2.0 both ship plain net10.0 assemblies, so Shell, Keyboard, Popup, PopupOptions and ShowPopupAsync all compile off-device. The real blockers were narrower — the icon font, the XAML popup types, and Android. Layout: src/AniSprinkles/ (net10.0-android) and src/AniSprinkles.Core/ (net10.0) are siblings. Core initially sat inside the app project's folder, where the app's default globs swept up 602 of Core's sources plus its obj/ generated assembly attributes and failed as CS0579. DefaultItemExcludes suppresses that, but siblings need no suppression at all. Core holds Models, Utilities, non-platform Services, Converters and every PageModel. It deliberately references neither CommunityToolkit.Maui nor IconFont.Maui.FluentIcons — leaving those out is what stops the new seams eroding. Three seams carry what stayed behind: - IDialogService covers the five XAML popups plus DisplayPromptAsync, implemented by MauiDialogService next to the existing MauiShellNavigationService and MauiUserFeedback. This matters beyond compilation: Shell.Current is null rather than throwing off-device, so a popup call from a PageModel silently no-ops and its test passes without exercising anything. - IExternalBrowser covers the four "view on AniList" links. - Core mirrors the 57 icon glyphs it uses into Icons/Glyphs.cs, generated by tools/generate-glyphs.cs from the package's PE metadata. The package ships platform TFMs only. Also folded in, because the move surfaced them: - OutageStateService called MainThread.IsMainThread, which throws NotImplementedInReferenceAssemblyException off-device; its catch only covered InvalidOperationException, so the comment promising an inline fallback in unit tests was never true. Now uses the injected IDispatcher. - SettingsPageModel read AppInfo.Current in a field initializer, so the type could not be constructed off-device at all. IAppInfo is injected alongside IPreferences. - Four PageModels each carried a private copy of the same toast/snackbar helpers; they now share IUserFeedback. Plain snackbars move 5s -> 4s as a result; the 20s settings save-failure and 10s permission snackbars are preserved through a new optional duration. - Browser-open failures log at Warning rather than Error, matching how MauiUserFeedback treats its own display failures, and so stop raising Sentry events for a device concern. ListEntryStatusFlow becomes an instance singleton so its confirm/rating prompts can go through IDialogService. The tap-suppression window moves to Core as LongPressTapSuppressor; the Android gesture plumbing stays in Views. The test project now project-references Core. All 391 existing tests pass unchanged; Core's internals stay internal via InternalsVisibleTo rather than being widened for tests. * Validate every icon glyph reference against the package (#117) src/AniSprinkles/AppShell.xaml shipped x:Static icons:FluentIconsRegular.Compass24 — the real member is CompassNorthwest24. x:Static is resolved by the XAML loader at runtime, so the build was completely clean and the app crashed on launch with XamlParseException. That one was lucky: AppShell loads at startup, so it failed immediately and unmissably. The same typo on a details page would build, pass tests, pass CI screenshots, and only crash when a user opened that screen. Two things are checked, both driven off the icon assembly's PE metadata: - Every x:Static icon reference in src/**/*.xaml resolves. The xmlns prefix is read from the file rather than assumed to be "icons:", so renaming it cannot quietly switch the test off. - Every constant in Core's mirrored Glyphs table still matches the package by name AND value. Mirroring those glyphs (#62) was only acceptable on the condition that drift becomes a build failure, and this is that condition. PE metadata rather than Assembly.Load: the package targets net10.0-android36.0 and will not load into a net10.0 test host. Two approaches that produced confidently wrong answers on the way here are documented at the call site — substring-matching the DLL reports Compass24 as present because CompassNorthwest24 contains it, and a regex over the #Strings heap silently misses every other name because entries share NUL delimiters. The pinned version is read from whichever project under src/ declares the package, not a hardcoded path. An unresolvable package cache skips (a fresh machine, an unrestored bump); a missing declaration throws, because that is a repo-structure problem rather than an environment gap. Empty-discovery guards keep both theories from passing vacuously. Verified by reintroducing Compass24 (fails, naming the file and suggesting CompassNorthwest24) and by tampering with a mirrored glyph value (fails, printing both escaped code points and the regeneration command). * Add PageModel state-machine tests for the #116 defects (#52 phase 1) The #62 extraction is only worth its diff if the code it unblocked is actually covered. These are the defects PR #116 found across six review rounds — none were reachable by the previous 391 tests, and none are reachable on device either: each needs a specific interleaving that the happy-path pass cannot produce. SearchPageModel: - A failed page 1 on a new query must not re-arm Load More over the previous query's results. The failure clears IsSearching in its finally (that is what stops the spinner), which used to leave the section holding the old items with HasNextPage set — so scrolling appended page 2 of the new query onto the old query's results, one list silently mixing two searches. - Load More must page under the filter page 1 used. The adult filter was read live per page, and Settings debounces 1500ms and only applies the value from the server response, so a user could toggle, return inside that window with nothing detected as changed, and have the new value land in time to page a different policy onto results already on screen. - An adult flip while the first search is still in flight must invalidate. The context used to be recorded on fetch success, so a first search in flight left "nothing searched yet" set and the flip baselined the new context WITHOUT cancelling the old request, whose response then marked itself current forever. - A superseded search resuming late must not clear its successor's spinner. DiscoverPageModel: - Load More must be refused while a refresh is still reading auth. The guard used to cover only the window after IsBusy went up, but LoadCoreAsync awaits the auth read before setting it. Each of these was confirmed to fail against the reverted fix and pass against the current code, so they catch what they claim to rather than merely passing. Also #52's own phase-1 list for MediaDetailsPageModel.LoadAsync (happy path, non-positive id, null media, NotFound hiding Retry, throw keeping Retry, reuse without a second request, in-memory list entry not clobbered) and the reachable SettingsPageModel.LoadAsync branches. SettingsPageModel's authenticated happy path is deliberately absent: it ends in AppSettings.SyncFromViewer, which persists through the static Preferences.Default and throws off-device, so the test would be asserting on the catch block. Giving AppSettings a preferences seam is the open decision on #52 and is noted there. SearchPageModel takes a TimeProvider so its 600ms debounce is deterministic under test rather than a real sleep per case; DiscoverPageModel already took one. Test classes touching the process-wide AppSettings statics now share a non-parallel collection. * Close the biggest remaining test gaps in Core (#52) An audit of the 130 types now in Core against every test file found 56 never mentioned at all. Most are DTOs and fine, but three groups were not. EntryActionCoordinator had zero coverage and is the highest-value thing #62 unblocked: every list surface (My Anime, Discover, Search, View All) routes its long-press flows through it, so one defect surfaces in four places. It was previously unreachable because each entry point opened a popup through Shell.Current, which is null rather than throwing off-device — the flow would no-op and any test of it would pass without executing a decision. Now covered: menu routing and dismissal, the flush-before-flow hook, remove-vs-move branching, rollback of status/progress/score/repeat on a failed move, retry targeting the id captured at failure time, outage suppressing the retry action, id adoption on add-to-list, and the completion flow's re-entrancy guard. Code added in this branch had none of its own. Covered now: the outage/retry rule in UserFeedbackExtensions, MoveToListChoice's two shapes, LongPressTapSuppressor, and OutageStateService — including the dispatcher fallback that replaced the MainThread call whose catch never covered what it threw. MyAnimePageModel's +1 debounce: six taps collapse to one write (the app's largest single rate-limit saving), a failure reverts to before the first tap rather than one step, switching entries flushes the previous one, and reaching a known total routes to the completion flow instead of the debounce. Takes a TimeProvider for the same reason SearchPageModel does — a real 1500 ms sleep per case is neither fast nor deterministic. Plus #52 phase 3 (converters — the Brush-vs-Color target rule that MAUI's Background/BackgroundColor precedence makes load-bearing, hash stability, format glyph mapping) and ImageUrl, where AniList returns a default.jpg placeholder rather than null and a plain null check leaves its grey graphic on screen. Every new behavioural assertion was mutation-checked: the entry-switch flush, revert depth, completion routing, remove-vs-move, the completion guard, the id-less-create throw, and the dropped-dispatch fallback were each broken in turn and confirmed to fail the intended test. Two of those mutations hung the suite rather than failing it, so both tests are now bounded with WaitAsync — a hang in CI reads as an infrastructure problem, not a regression. 680 tests, up from 603. * CI: Update UI screenshots [skip ci] * Make RecordingUserFeedback track the latest snackbar, not the latest with an action PR review (Copilot) on #123. `LastSnackbarAction` was only ever assigned, never cleared, so after a snackbar that offered no action it still held an earlier one's. The underlying mismatch: the property tracked "the most recent snackbar *that offered an action*" — a filtered subset — while `Assert.Null(LastSnackbarAction)` means "the last snackbar offered none", which is a statement about the latest event. Those only agree while at most one snackbar has been shown, which is why no existing test was wrong. It matters on retry chains, which show several. Added the behavioural test that was hiding behind it: a delete that fails, is retried, and fails again into a service outage must stop offering a retry button that cannot work. That test fails against the old double *with correct production code*, which is the whole problem — the double was answering for a snackbar that was not the one under assertion. Doc comment updated to match; the old wording described the old behaviour accurately, so changing one without the other would have swapped a latent trap for a real doc/code mismatch. Considered recording (message, action) pairs instead, which is immune to ordering entirely. Rejected: it churns all 8 assertion sites and turns `Assert.Contains("AniList is Down", feedback.Snackbars)` into a predicate lambda, for precision only needed to assert about a non-final snackbar — which splits into separate tests instead. * CI: Update UI screenshots [skip ci] --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
* Extract the shared spine from the four details page models (#120) Character (581 lines), Staff (585) and Studio (344) were three variations on one page, and MediaDetails (1,719) was a fourth copy of most of it. Pull the shared load/error/retry/favourite/external-link spine into DetailsPageModelBase<TEntity> and adopt it in all four: 3,229 lines across the page models becomes 2,491, plus a 379-line base. The entity is reached through a protected abstract accessor rather than held in the base, so each page model keeps its own [ObservableProperty] field and with it every XAML binding and NotifyPropertyChangedFor list. MediaDetails shares six of the eight members rather than all eight — it never had ShowError or OpenSiteUrl — and its load differs enough to need hooks: ShouldSkipLoad for its in-flight guard, OnEntityReused for the list-entry merge, NullResultIsRetryable, OnLoadStarting, OnAuthenticationResolved, and its own RetryLoadCore. It keeps the two-arg LoadAsync as its public entry point. Three divergences are unified rather than carried forward: - ErrorDetails on Character/Staff/Studio now records through ErrorReportService, as MediaDetails already did, instead of showing a raw exception message. - Favourites render through IFavouritable.FavouritesDisplay (MetricFormat.Compact) on all four. Character and Staff each carried a private copy that shadowed the model's, and those copies had no M tier — 1.2M favourites rendered as "1200k". - MediaDetails passes the page token to GetAccessTokenAsync, so its auth fetch is cancellable on navigate-away like the other three. Also fixes a bug the extraction surfaced: a failed load used to leave the previous entity in place with its sections already reset, so navigating back to it hit the same-id guard and showed Content over empty lists. The base drops the entity before fetching, with a regression test. ShowError is public so the four page code-behinds report render failures through one call instead of five property assignments each. Tests: one shared spine suite run against all four adopters, plus per-page suites for what is genuinely specific and MediaDetails.RetryLoad from #52 Phase 1. 681 -> 796. * CI: Update UI screenshots [skip ci] * Guard IsBusy against a superseded load clearing it (#126 review) A second load on the three reference-data pages supersedes the first via Scope.Begin(), which cancels its token. The superseded load then reaches its finally and clears IsBusy while its replacement is still fetching. Capture a generation at the start of the load and only clear IsBusy if it is still the live one, mirroring the guard PaginatedSection already uses. No reachable defect today — nothing on a details page binds IsBusy, and the code-behind's shouldShowContent also requires CurrentState == Content — but the ordering is only safe by accident, and the next caller to depend on IsBusy would inherit it. The accompanying spine test documents the invariant rather than proving the fix: it passes with and without the guard, because the unit harness resumes the cancelled load inline where a real MAUI SynchronizationContext posts it. * CI: Update UI screenshots [skip ci] * Only commit a MediaDetails load's state once it is accepted (#126 review) LoadAsync assigned _lastRequestedListEntry and _loadRequestId before LoadCoreAsync ran the in-flight guard, so a load that was then dropped left both behind for the load still running. The live load could seed the wrong list entry in SeedSections, RetryLoadCore could retry with it, and every remaining trace line the live load emitted was renumbered to the dropped load's id — which makes the load#N correlation worse than not having one. The original LoadAsync set both after its busy guard; the extraction moved them ahead of it. Move the guard into LoadAsync so nothing the load owns is written until it has been accepted, and drop the ShouldSkipLoad hook from the base now that nothing overrides it (ten hooks down to nine). Tests: a dropped load must not hand its list entry to the live one, must not renumber its trace lines, and retry must follow the load that was actually accepted. All three fail against the previous ordering. Also pins the timeout/cancellation split the details pages depend on: the page models swallow OperationCanceledException, which is only safe because AniListClient classifies a TaskCanceledException carrying an inner TimeoutException as ApiErrorKind.Network first. Without that a timeout would leave the page on a spinner with no error and no retry, so it is worth a test rather than an assumption. Adds RecordingLogger so the NAVTRACE/DATATRACE contract is assertable at all. * CI: Update UI screenshots [skip ci] * Clear the test project's warnings (#126 review) The zero-warning rule in AGENTS.md covers the whole project, but the test project had been building with seven warnings — five of them since #123, and two added by this branch. The solution now builds clean. - xUnit1051 on the deliberate bounded waits: pass TestContext.Current.CancellationToken alongside the existing timeout. The WaitAsync(TimeSpan, CancellationToken) overload does both, so the timeout that turns a deadlock into a failure is unchanged; the token only adds responsiveness to a cancelled run. - xUnit1051 in AniListClientCancellationTests: pass the same token to the calls under test. The one call that deliberately passes its own token keeps it — there the token is the subject. - CS8620/CS8619 in DiscoverPageModelTests: AuthGate.WaitAsync returns Task<string?> to match IAuthService, which lets the null-suppression at the call site go rather than papering over the mismatch. * Correct the details-spine docs after the guard moved (#126 review) The project-architecture skill still described ShouldSkipLoad as a hook MediaDetails overrides, and listed a skip-guard step in the templated load. Both went away in 5e86f30 when the in-flight guard moved into MediaDetails.LoadAsync, and the doc was not updated with them. Records why the guard sits there rather than in a hook, since that placement is what keeps a dropped load from writing state the live one reads — the thing the move was for. * CI: Update UI screenshots [skip ci] --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>









Closes #62. Closes #117. Advances #52.
The unit tests could not reach a single PageModel.
tests/AniSprinkles.UnitTestslink-compiledindividual files out of
src/, so anything touchingShell, a popup or the icon font wasuntestable — and all six defects PR #116 found across its review rounds live in exactly that code.
Three of those six were regressions introduced by the previous round's fix, which is the signature
of logic whose correctness rests on an argument with nothing executable to check it.
What changed
src/AniSprinkles/andsrc/AniSprinkles.Core/are now sibling projects. Core (net10.0) holdsthe models, utilities, non-platform services, converters and every PageModel; the app
(
net10.0-android) keeps pages, views, platform code and theServices/Maui/adapters. The testproject project-references Core, and the 33 link-compile globs are gone.
Core deliberately references neither
CommunityToolkit.MauinorIconFont.Maui.FluentIcons.Leaving them out is what stops the new seams eroding back into direct popup calls.
Three seams carry what stayed behind:
IDialogServiceDisplayPromptAsyncMauiDialogServiceIExternalBrowserMauiExternalBrowserIcons/Glyphs.cstools/generate-glyphs.csIDialogServicematters beyond compilation:Shell.Currentisnullrather than throwingoff-device, so a popup call from a PageModel silently no-ops and its test passes without
exercising anything.
The issue's premise had gone stale
Two of the three package restrictions #62 was written around no longer hold.
Microsoft.Maui.Controls10.0.60 and
CommunityToolkit.Maui14.2.0 both ship plainnet10.0assemblies, soShell,Keyboard,Popup,PopupOptionsandShowPopupAsyncall compile off-device — verified bybuilding a throwaway project against the pinned versions before any code was written. Only the icon
font is genuinely platform-only. The issue body and its blocker list were corrected in place before
implementation started.
Bugs found and fixed along the way
OutageStateServicecalledMainThread.IsMainThread, which throwsNotImplementedInReferenceAssemblyExceptionoff-device. Itscatch (InvalidOperationException)never covered that, so the comment promising an inline fallback in unit tests was never true.
SettingsPageModelreadAppInfo.Currentin a field initializer, so the type could not beconstructed off-device at all.
IAppInfois now injected alongsideIPreferences.duration drift between two of them. They now share
IUserFeedback.Tests: 391 → 681
Beyond the six #116 defects, this covers
EntryActionCoordinator(which had zero tests and is thehighest-value thing the extraction unblocked — every list surface routes long-press through it),
MyAnimePageModel's +1 debounce,MediaDetailsPageModel.LoadAsync, the reachableSettingsPageModelbranches, #52's Phase 3 converters, and #117's glyph validator.Every new behavioural assertion was mutation-checked. The entry-switch flush, revert depth,
completion routing, remove-vs-move branching, the completion-flow guard, the id-less-create throw,
the dropped-dispatch fallback and the outage retry-suppression rule were each broken in turn and
confirmed to fail the intended test.
Three things that came out of that are worth a reviewer's attention:
WaitAsync— ahang in CI reads as infrastructure flake, not a regression.
compile-gated.
testhostreported 557 passing tests against a stale assembly. That is the same classof invisible failure as CI reports success when tests silently skip #122.
Review feedback addressed
RecordingUserFeedback.LastSnackbarActiontracked the most recent snackbar that offered anaction rather than the most recent snackbar, so on a retry chain an earlier action could answer
for a later snackbar. No existing test was wrong (each asserted after a single snackbar), but the
fix came with the behavioural test that was hiding behind it: a delete that fails, is retried, and
fails again into an outage must stop offering retry. That test fails against the old double with
correct production code.
Verification
-p:CiBuild=true.583 / 644 / 680.
/run-anisprinkles: every popup path re-walked through the new seam (action menu,move-to-list, rate, edit progress, remove confirm, the Media Details episode prompt), plus Discover,
Search, the Settings version string, and a
+1 EPtap confirmed in logcat driving the debouncethrough the injected
TimeProvider. Logcat clean throughout.Reviewing this
The first commit is large and cannot be split further — the file moves do not compile until the
seams exist. Its 218 renames are recorded as renames, so
git log --followandgit blamesurvive,and
--statshows only real content changes. The three test commits are additive and readindependently.
Follow-ups filed
AppSettingswrites through the staticPreferences.Default, which is whySettingsPageModel's authenticated path is still untestable.glyph cases into skips, which CI would have shown green.
#119 is not unblocked by this work —
AuthServiceusesAndroid.Webkitand stays in the appproject. The token-state split that would make its race testable is written up on that issue.