Skip to content

Keep cached Apps and Games visible when refresh fails - #112

Open
Jim8y wants to merge 1 commit into
neoorder:masterfrom
Jim8y:fix/audit-p2-07
Open

Keep cached Apps and Games visible when refresh fails#112
Jim8y wants to merge 1 commit into
neoorder:masterfrom
Jim8y:fix/audit-p2-07

Conversation

@Jim8y

@Jim8y Jim8y commented Sep 5, 2026

Copy link
Copy Markdown
Contributor

Summary

Fix audit P2-07: a failed catalog refresh must not turn a usable disk cache into an empty Apps/Gaming screen or retain content that the current preferences prohibit.

  • Display cached items as soon as they are available, including when the other tab has already loaded the shared collection.
  • Refilter cards and recent items before awaiting settings, using restrictive defaults until the complete settings read succeeds.
  • Keep cached content visible alongside a connection-error/retry state; distinguish a failed empty load from a successful empty catalog.

Validation

  • dotnet test tests/p2-07/OfflineCatalog.Tests.csproj --no-restore --nologo: 12/12 passed.
  • iOS 26.5 simulator and Android API 36 arm64 emulator: eight native assertions passed on each platform using the actual GamingPage/DAppsPage, production CachedCollection and disposable SQLite. Scenarios covered shared-cache visibility, offline failure, tightening preferences and recent lists, permissive restoration, malformed stored settings failing closed, and recovery to a genuinely empty catalog.
  • After removing the external fixture, each platform was rebuilt, installed and launched into the normal Home/four-tab product UI. No OneGate app crash was observed.
  • Final tested source patch SHA-256: 7c930ba630b7b9c2a311b9e1037f8d918b4b96ac80421533f3f0a5d2cfc1830c; verified against both platform evidence sets before committing.

Limitations and integration

Native error scenarios used controlled HTTP, not a live outage; no wallet signing, game play or chain submission was performed. Screenshots and QA fixtures remain outside the repository and are not attached to this PR; local validation does not imply hosted CI has run.

Independently based and validated on master@623603d; merge solution project entries as a union and revalidate any integration changes, since this is not a combined validation of all audit fixes. When integrating audit P2-08/P2-09, preserve forced refresh, identity-based cache updates and this offline/preference handling together, including the P2-08-cache linked-source ICachedEntity dependency.

Copilot AI lite review requested due to automatic review settings September 5, 2026 07:59

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The new LoadCatalogAsync implementation in both pages serializes settings before catalog load, which can delay or prevent disk-cache visibility (and can skip catalog load entirely on settings failure), conflicting with the PR’s stated offline/cache goals.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

Updates the Apps and Gaming catalog pages so cached catalog content remains visible during refresh failures, while introducing an explicit error state (HasError) to drive an inline “connection issue / retry” UI instead of showing an empty state.

Changes:

  • Add LoadingService.HasError and surface it in Gaming/DApps XAML to show a retry card while keeping cached items visible.
  • Refactor GamingPage and DAppsPage loading to “fail closed” on settings (restrictive defaults while settings load).
  • Add a focused offline/audit regression test project (tests/p2-07) that compiles production page/service code against test boundaries.
File summaries
File Description
tests/p2-07/TestBoundary.cs Adds MAUI/network/DB stubs so production page/service sources can compile in tests.
tests/p2-07/OfflineCatalogTests.cs Adds regression tests for offline refresh + preference-tightening + settings-failure behavior.
tests/p2-07/OfflineCatalog.Tests.csproj New test project linking production sources and dependencies.
OneGateApp/Services/LoadingService.cs Adds HasError flag set/reset around load execution and exception handling.
OneGateApp/Pages/GamingPage.xaml.cs Refactors load pipeline and hooks cache-load events to refresh filtered UI.
OneGateApp/Pages/GamingPage.xaml Shows connection issue + retry UI and hides empty view during error state.
OneGateApp/Pages/DAppsPage.xaml.cs Refactors load pipeline and hooks cache-load events to refresh filtered UI.
OneGateApp/Pages/DAppsPage.xaml Shows connection issue + retry UI and hides empty view during error state.
OneGateApp.slnx Adds the new offline test project to the solution.
Review details
  • Files reviewed: 9/9 changed files
  • Comments generated: 4
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +93 to +108
async Task LoadCatalogAsync()
{
// Do not leave a previous permissive policy visible while settings are
// loading. A failed read remains restricted rather than reusing old flags.
allowRestrictedContent = false;
developerModeEnabled = false;
OnDataLoaded(this, EventArgs.Empty);
try { await LoadSettingsAsync(); }
finally
{
// An already loaded/shared collection will not send another disk-load
// event, and an offline refresh will not send a success event either.
OnDataLoaded(this, EventArgs.Empty);
}
await LoadDAppsAsync();
}
Comment on lines +60 to +75
async Task LoadCatalogAsync()
{
// Do not leave a previous permissive policy visible while settings are
// loading. A failed read remains restricted rather than reusing old flags.
allowRestrictedContent = false;
developerModeEnabled = false;
OnDataLoaded(this, EventArgs.Empty);
try { await LoadSettingsAsync(); }
finally
{
// An already loaded/shared collection will not send another disk-load
// event, and an offline refresh will not send a success event either.
OnDataLoaded(this, EventArgs.Empty);
}
await LoadDAppsAsync();
}
Comment on lines 39 to 41
LoadingService.Loaded += OnDataLoaded;
DApps.CollectionLoaded += OnDataLoaded;
LoadingService.BeginLoad();
Comment on lines 40 to 42
LoadingService.Loaded += OnDataLoaded;
DApps.CollectionLoaded += OnDataLoaded;
LoadingService.BeginLoad();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants