Skip to content

Use the current query when confirming search - #109

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

Use the current query when confirming search#109
Jim8y wants to merge 1 commit into
neoorder:masterfrom
Jim8y:fix/audit-p2-11

Conversation

@Jim8y

@Jim8y Jim8y commented Sep 5, 2026

Copy link
Copy Markdown
Contributor

Problem

Pressing Search before the debounce completed could open the previous query's sole result instead of searching the text currently in the field.

Change

Invalidate the pending debounce and synchronously recompute the results before applying the existing single-result navigation behavior.

This independent PR addresses audit P2-11 only, based on master 623603d.

Validation

  • 4 regression tests passed; three failed with the original implementation.
  • iOS 26.5 iPhone 17 simulator and Android API 36 arm64 emulator: each exercised the actual GlobalSearchPage/SearchBar handlers and passed four native checks. Immediately confirming after changing an old sole match to zero or multiple matches did not launch the stale result; the delayed callback preserved the new results.
  • Search data was a controlled in-memory index to isolate the UI race. No wallet operation or external navigation was performed.
  • Removed the fixture, fully rebuilt, installed and smoke-launched the normal product on both platforms with zero build warnings/errors.

Screenshots and simulator-only fixtures remain outside the repository.

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

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.

🟢 Approval recommended

The change is small and targeted, and the PR adds regression tests that directly cover the reported stale-query confirmation behavior.

Pull request overview

This PR fixes a UI race in GlobalSearchPage where confirming search before the debounce completed could act on stale results, by invalidating any pending debounce and recomputing results synchronously before applying the existing “single result” navigation behavior.

Changes:

  • Update OnSearchButtonPressed to increment searchVersion and call UpdateResults() immediately, preventing delayed callbacks from applying stale results.
  • Add a focused regression test project (tests/p2-11) that links the production GlobalSearchPage.xaml.cs and substitutes UI/persistence/network boundaries with lightweight stubs.
  • Add an xUnit theory covering confirm behavior when the query transitions from a prior single match to zero, one, or multiple matches.
File summaries
File Description
tests/p2-11/TestBoundary.cs Adds minimal boundary stubs and a test-only partial for GlobalSearchPage to execute production logic without MAUI workloads.
tests/p2-11/SearchConfirmationTests.cs Adds regression coverage ensuring confirmation uses current query/results even with a pending debounce.
tests/p2-11/SearchConfirmation.Tests.csproj Introduces a dedicated net10.0 test project that links the production page source for behavioral coverage.
OneGateApp/Pages/GlobalSearchPage.xaml.cs Fixes stale-confirm behavior by invalidating pending debounce and recomputing results before single-result navigation.
OneGateApp.slnx Includes the new test project in the solution.
Review details
  • Files reviewed: 5/5 changed files
  • Comments generated: 0
  • Review effort level: Lite

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

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