Skip to content

Fix mnemonic word deselection - #106

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

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

Conversation

@Jim8y

@Jim8y Jim8y commented Sep 5, 2026

Copy link
Copy Markdown
Contributor

Problem

Deselecting a mnemonic word removed one character instead of the selected word. Matching by text also could not distinguish repeated-word buttons.

Change

Track selected button instances in order and rebuild the phrase from the selected words. Removing or reselecting one occurrence no longer damages another occurrence or a substring.

This independent PR addresses audit P2-01 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: exercised the actual VerifyMnemonicPage controls and handlers. Both passed six checks for whole-word removal, middle-word removal, reselection, independent duplicate occurrences, the complete phrase, and the production validator.
  • Used a public synthetic test phrase; wallet creation was disabled in the external fixture. No real seed or funded wallet was accessed.
  • Removed the fixture and rebuilt/installed the normal product on both platforms; startup smoke passed with zero build warnings/errors.
  • Android screen protection remained enabled; the protected mnemonic screen was not used for the evidence screenshot. The visible result summary was captured instead.

Screenshots, native result JSON and simulator-only fixture code remain outside the repository.

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

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 fix is localized to the click handler, removes the confirmed faulty substring/duplicate-word behavior, and is backed by focused regression tests.

Pull request overview

Fixes mnemonic-word deselection in VerifyMnemonicPage by tracking selected button instances (not text) and rebuilding the phrase from the selected words, which correctly handles whole-word removal and repeated-word buttons.

Changes:

  • Replace text-based removal logic with instance-based selection tracking and phrase rebuild.
  • Add a dedicated regression test project (with lightweight MAUI stubs) covering deselection, middle-word removal, duplicates, and full selection order.
  • Register the new test project in the solution.
File summaries
File Description
OneGateApp/Pages/VerifyMnemonicPage.xaml.cs Switch selection state to an ordered List<Button> and rebuild the mnemonic phrase from selected instances.
tests/P2-01/MnemonicSelectionTests.cs Adds regression tests that reproduce the prior bug and validate correct behavior (including duplicate word instances).
tests/P2-01/PageStubs.cs Provides minimal MAUI/page/service stubs so the production click handler can be compiled and exercised in tests.
tests/P2-01/MnemonicSelection.Tests.csproj New xUnit test project wiring in the production VerifyMnemonicPage.xaml.cs plus test dependencies.
tests/P2-01/README.md Documents how to run the regression tests and what they cover.
OneGateApp.slnx Adds the new regression test project to the solution.
Review details
  • Files reviewed: 6/6 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