Skip to content

UI adjustments & Fixes#119

Merged
cedelavergne-ledger merged 10 commits into
developfrom
cev/UI_adjustments
Jun 19, 2026
Merged

UI adjustments & Fixes#119
cedelavergne-ledger merged 10 commits into
developfrom
cev/UI_adjustments

Conversation

@cedelavergne-ledger

@cedelavergne-ledger cedelavergne-ledger commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

Description

  • wui: save backup with a dedicated step to keep the file dialog
  • wui: drop the storage-size row from the device card
  • Fix metadata offset truncation on restore
  • Add unit tests for metadata offset and capacity limits
  • Compile the test APDU handler only under TESTING
  • Clarify the backup/restore confirmation wording
  • Add ragger tests for the backup/restore confirmation screens
  • Add ragger test for showing a password on a later list page

Changes include

  • Bugfix (non-breaking change that solves an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (change that is not backwards-compatible and/or changes current functionality)
  • Tests
  • Documentation
  • Other (for changes that might not fit in any category)

Breaking changes

Please complete this section if any breaking changes have been made, otherwise delete it.

Additional comments

Please post additional comments in this section if you have them, otherwise delete it.

Reading the card consumes the click's transient user activation, so
showSaveFilePicker cannot be called from the continuation of the device
exchange (it throws "Must be handling a user gesture"); opening it before the
approval instead would create the chosen file on disk and leave it empty if the
device is rejected.

Use a two-step flow: back up first, then surface a "Save…" button that opens
the native save dialog from its own click. This keeps the file-name dialog
without the SecurityError and without creating an empty file on rejection;
falls back to an anchor download where the File System Access API is missing.
The "Storage 4096 bytes" line showed the total metadata capacity read from
GET_APP_CONFIG. It is a constant, so it adds noise to the device card.The controller still reads storage_size internally for buffer sizing;only the UI row and its React state are removed.
override_metadatas() took the destination offset as a uint8_t, but
load_metadatas() passes app_state.bytes_transferred (size_t, up to
MAX_METADATAS = 4096).Small backups happened to work because only the first chunk carries data;larger lists (> ~255 bytes of metadata) were corrupted.
Cover the boundary behaviour of the metadata store:

- override_metadatas at offset 300 lands at 300, not at 300 % 256 == 44
  (regression guard for the uint8_t-offset truncation fix), plus a write at
  the very end of the buffer.
- write_metadata refuses new entries once full (ERR_NO_MORE_SPACE_AVAILABLE),
  so the 4096-byte buffer cannot overflow.
The RUN_TEST dispatch was already guarded by #ifdef TESTING, but tests.c was
compiled unconditionally (APP_SOURCE_PATH globs all of src/) and dispatcher.c
included tests.h unconditionally. Guard the test handler's definitions and the
include with #ifdef TESTING so production builds (TESTING=0) contain no test
code at all, instead of relying on linker dead-code elimination. The #include
lines in tests.c stay outside the guard to avoid an empty translation unit.
Replace the device prompts "Transfer metadatas ?" / "Overwrite metadatas ?"
with "Backup" / "Restore" + "password list", aligned with the WebUI buttons,
and without the stray space before "?". Wallet screens keep the question mark;
the Nano variant drops it. The WebUI notices, FAQ and README that quote these
prompts are updated to match.
@codecov-commenter

codecov-commenter commented Jun 18, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 81.88%. Comparing base (837d2e5) to head (81128a6).

Additional details and impacted files
@@             Coverage Diff             @@
##           develop     #119      +/-   ##
===========================================
+ Coverage    73.96%   81.88%   +7.92%     
===========================================
  Files            7        7              
  Lines          361      381      +20     
  Branches        41       42       +1     
===========================================
+ Hits           267      312      +45     
+ Misses          88       53      -35     
- Partials         6       16      +10     
Flag Coverage Δ
unittests 81.88% <100.00%> (+7.92%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Also silence pylint's false no-member errors on the MetaScreen-generated
CustomTouchScreen members (surfaced now that the file is touched).
On touch devices the passwords list is paginated and NBGL forwards a
page-relative index, so password_callback() rebuilds the absolute index
from the page number. Add a regression test that seeds enough passwords
to span two pages, shows the first entry of page 2, and asserts the
revealed value matches the value derived independently for that nickname
(guarding against an off-by-page error in the recalculation). Marked
skip_nano since the Nano list shows one choice per page.
@github-actions

Copy link
Copy Markdown
Contributor

Code coverage report

Code Coverage

Per-file coverage
Package Line Rate Branch Rate Health
src 67% 63%
Summary 67% (113 / 168) 63% (45 / 71)

@cedelavergne-ledger
cedelavergne-ledger merged commit 2baef71 into develop Jun 19, 2026
71 checks passed
@cedelavergne-ledger
cedelavergne-ledger deleted the cev/UI_adjustments branch June 19, 2026 14:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants