fix: isolate search loading failures by result group - #116
Open
Jim8y wants to merge 1 commit into
Open
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
Concurrent group failures can race while updating SearchErrorText, potentially dropping error lines and producing incorrect error reporting.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
Improves GlobalSearchPage resilience by isolating search loading failures per result group, keeping usable local/cached results visible when other sources are slow or failing, and enforcing a fail-closed policy for discovery settings.
Changes:
- Reworked search data loading to (1) clear stale DApp results up front, (2) serialize DbContext-based reads, and (3) load independent groups with group-level error reporting + retry.
- Added UI for group-level failures (error card + Retry button) and prevented launching stale DApp results after settings/index invalidation.
- Added a linked-source test project validating partial availability, pending/failing settings behavior, and retry recovery.
File summaries
| File | Description |
|---|---|
| tests/p2-10/TestBoundary.cs | Adds test-only boundary stubs to run linked-source GlobalSearchPage logic without MAUI workloads. |
| tests/p2-10/SearchAvailabilityTests.cs | New regression tests for group isolation, settings fail-closed behavior, and retry recovery. |
| tests/p2-10/SearchAvailability.Tests.csproj | Introduces the net10.0 test project and links the production GlobalSearchPage.xaml.cs. |
| OneGateApp/Pages/GlobalSearchPage.xaml.cs | Implements group-based loading, error aggregation, fail-closed DApp index clearing, and stale DApp tap rejection. |
| OneGateApp/Pages/GlobalSearchPage.xaml | Adds an error card with retry action and ensures empty state doesn’t display when errors exist. |
| OneGateApp.slnx | Includes the new p2-10 test project in the solution. |
Review details
- Files reviewed: 6/6 changed files
- Comments generated: 2
- 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
+108
to
+126
|
|
||
| async Task LoadSearchGroupAsync(Func<Task> load, string group) | ||
| { | ||
| try | ||
| { | ||
| await load(); | ||
| } | ||
| catch (Exception) | ||
| { | ||
| string message = $"{group}: {Strings.Unavailable}"; | ||
| SearchErrorText = string.IsNullOrEmpty(SearchErrorText) | ||
| ? message | ||
| : $"{SearchErrorText}{Environment.NewLine}{message}"; | ||
| } | ||
| finally | ||
| { | ||
| UpdateResults(); | ||
| } | ||
| } |
Comment on lines
+144
to
+155
| // CachedCollection has already loaded disk data even when refreshing | ||
| // the network fails. Keep those usable results alongside the error. | ||
| dappIndex = DApps | ||
| .Where(p => p.IsRegularApp && DAppCatalogPolicy.IsDiscoverable(p, developerModeEnabled)) | ||
| .Select(p => new GlobalSearchIndex<DApp>( | ||
| p, | ||
| recentDAppIds.IndexOf(p.Id), | ||
| p.NameLocalizer.Localize(), | ||
| p.DescriptionLocalizer?.Localize(), | ||
| p.Url, | ||
| p.Tags is null ? null : string.Join(' ', p.Tags.Select(DApp.LocalizeTag)))) | ||
| .ToArray(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fix audit P2-10: keep usable search groups available when another data source is slow or fails.
Validation before commit
89333059895d1e7ad950b82805175ce37a3ca56fa71ef691a40ff65dd9e3d75b. No signing or chain broadcasts. Screenshots and QA fixture stay outside the repository; no upload is claimed.Integration
Independently validated on master
623603d634f07eaead14745da87920a356159be0. Coordinate with P2-12's preference filtering and P2-11 / #109: preserve fail-closed policy, partial error/retry behavior, and immediate-Enter current-query handling. Adapt linked-source test boundaries to the combined page and rerun all three suites/native flows. Preserve the solution-project union. No combined 25-PR validation is claimed.