Skip to content

refactor(core/delizia): remove Header-related helpers from Frame#6995

Merged
romanz merged 1 commit into
mainfrom
romanz/2605/drop-header-ts5
May 27, 2026
Merged

refactor(core/delizia): remove Header-related helpers from Frame#6995
romanz merged 1 commit into
mainfrom
romanz/2605/drop-header-ts5

Conversation

@romanz
Copy link
Copy Markdown
Contributor

@romanz romanz commented May 26, 2026

Needed to allow dropping empty header on Delizia (similar to af8bfeb, will be used in #6651).

Also reduces TREZOR_MODEL=T3T1 PYOPT=0 make build_firmware flash size by 4kB = 1645056 - 1640960.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 26, 2026

Review Change Stack

Walkthrough

This PR refactors the Delizia UI layout API: Frame::new now accepts a prepared Header and content; header convenience constructors/builders were moved from Frame into Header. All component modules and UI flows were updated to construct pages via Frame::new(Header::..., content) while preserving existing footer, swipe, and message-mapping behavior.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Suggested labels

flash reduction, T3W1

Suggested reviewers

  • obrusvit
  • M-pasta
  • M1nd3r
🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 17.86% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Description check ❓ Inconclusive The PR description provides clear context about the refactoring objective and build-size impact, but lacks sections recommended by the template for core developers. Consider adding PR setup sections (assignee, project, priority, team, sprint) and development status (Draft/Needs Review) per the template guidance for core developers.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically describes the main refactoring: removing Header-related helper functions from Frame in Delizia.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch romanz/2605/drop-header-ts5

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@romanz romanz added the T3T1 Trezor Safe 5 label May 26, 2026
@romanz romanz force-pushed the romanz/2605/drop-header-ts5 branch from 398eed3 to 81e58be Compare May 26, 2026 17:20
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 26, 2026

en main(all)

model device_test click_test persistence_test
T2T1 test(all) main(all) test(all) main(all) test(all) main(all)
T3B1 test(all) main(all) test(all) main(all) test(all) main(all)
T3T1 test(all) main(all) test(all) main(all) test(all) main(all)
T3W1 test(all) main(all) test(all) main(all) test(all) main(all)
Translations

cs main(all)

model device_test click_test
T2T1 test(all) main(all) test(all) main(all)
T3B1 test(all) main(all) test(all) main(all)
T3T1 test(all) main(all) test(all) main(all)
T3W1 test(all) main(all) test(all) main(all)

de main(all)

model device_test click_test
T2T1 test(all) main(all) test(all) main(all)
T3B1 test(all) main(all) test(all) main(all)
T3T1 test(all) main(all) test(all) main(all)
T3W1 test(all) main(all) test(all) main(all)

es main(all)

model device_test click_test
T2T1 test(all) main(all) test(all) main(all)
T3B1 test(all) main(all) test(all) main(all)
T3T1 test(all) main(all) test(all) main(all)
T3W1 test(all) main(all) test(all) main(all)

fr main(all)

model device_test click_test
T2T1 test(all) main(all) test(all) main(all)
T3B1 test(all) main(all) test(all) main(all)
T3T1 test(all) main(all) test(all) main(all)
T3W1 test(all) main(all) test(all) main(all)

pt main(all)

model device_test click_test
T2T1 test(all) main(all) test(all) main(all)
T3B1 test(all) main(all) test(all) main(all)
T3T1 test(all) main(all) test(all) main(all)
T3W1 test(all) main(all) test(all) main(all)

Latest CI run: 26520206850

@romanz romanz force-pushed the romanz/2605/drop-header-ts5 branch from 81e58be to 110c8e5 Compare May 26, 2026 19:04
@romanz romanz changed the title chore(core/delizia): drop warning header if title is empty refactor(core/delizia): remove Header-related helpers from Frame May 26, 2026
@romanz romanz self-assigned this May 26, 2026
@romanz romanz added this to Firmware May 26, 2026
@github-project-automation github-project-automation Bot moved this to 🔎 Needs review in Firmware May 26, 2026
@romanz romanz added the translations Put this label on a PR to run tests in all languages label May 26, 2026
@romanz romanz requested a review from jjanku May 26, 2026 19:26
@romanz romanz marked this pull request as ready for review May 26, 2026 19:26
@romanz romanz requested a review from obrusvit as a code owner May 26, 2026 19:26
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@core/embed/rust/src/ui/layout_delizia/component/frame.rs`:
- Around line 374-376: The title height calculation uses
header.place(bounds).height(), but Header::place only updates self.area in the
subtitle branch, so wrapped titles without subtitles report a stale/zero height;
update Header::place (or add a Header::measured_height method) to compute and
return the actual consumed height for both branches (subtitle and no-subtitle)
and ensure self.area is set when wrapping occurs, then have the frame code
derive title_height from that accurate value (still clamped with
.max(TITLE_HEIGHT)). This ensures wrapped titles update self.area and prevent
content overlap.

In `@core/embed/rust/src/ui/layout_delizia/flow/confirm_action.rs`:
- Around line 339-345: In new_confirm_action_uni avoid moving extra: change uses
of matches!(extra, ...) to matches!(&extra, ...) and switch the match to match
&extra using patterns Menu(_) and ExternalMenu (or Cancel) so you only borrow
extra; update the header construction that currently uses match extra to use
match &extra and call header.with_menu_button() / with_cancel_button() as
before, ensuring subsequent borrows like menu selection and create_confirm use
the same borrowed extra without having been moved.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 58cce924-f4c4-47a7-b63d-6e94dabe3797

📥 Commits

Reviewing files that changed from the base of the PR and between 6756ee7 and 110c8e5.

📒 Files selected for processing (22)
  • core/embed/rust/src/ui/layout_delizia/component/address_details.rs
  • core/embed/rust/src/ui/layout_delizia/component/coinjoin_progress.rs
  • core/embed/rust/src/ui/layout_delizia/component/frame.rs
  • core/embed/rust/src/ui/layout_delizia/component/header.rs
  • core/embed/rust/src/ui/layout_delizia/flow/confirm_action.rs
  • core/embed/rust/src/ui/layout_delizia/flow/confirm_fido.rs
  • core/embed/rust/src/ui/layout_delizia/flow/confirm_firmware_update.rs
  • core/embed/rust/src/ui/layout_delizia/flow/confirm_homescreen.rs
  • core/embed/rust/src/ui/layout_delizia/flow/confirm_reset.rs
  • core/embed/rust/src/ui/layout_delizia/flow/confirm_set_new_code.rs
  • core/embed/rust/src/ui/layout_delizia/flow/confirm_summary.rs
  • core/embed/rust/src/ui/layout_delizia/flow/continue_recovery_homepage.rs
  • core/embed/rust/src/ui/layout_delizia/flow/prompt_backup.rs
  • core/embed/rust/src/ui/layout_delizia/flow/receive.rs
  • core/embed/rust/src/ui/layout_delizia/flow/request_number.rs
  • core/embed/rust/src/ui/layout_delizia/flow/request_passphrase.rs
  • core/embed/rust/src/ui/layout_delizia/flow/set_brightness.rs
  • core/embed/rust/src/ui/layout_delizia/flow/show_danger.rs
  • core/embed/rust/src/ui/layout_delizia/flow/show_share_words.rs
  • core/embed/rust/src/ui/layout_delizia/flow/show_tutorial.rs
  • core/embed/rust/src/ui/layout_delizia/flow/util.rs
  • core/embed/rust/src/ui/layout_delizia/ui_firmware.rs

Comment thread core/embed/rust/src/ui/layout_delizia/component/frame.rs Outdated
Comment thread core/embed/rust/src/ui/layout_delizia/flow/confirm_action.rs
@romanz romanz marked this pull request as draft May 26, 2026 19:49
@romanz romanz force-pushed the romanz/2605/drop-header-ts5 branch from 110c8e5 to 1597414 Compare May 26, 2026 19:55
@romanz romanz marked this pull request as ready for review May 26, 2026 20:22
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

♻️ Duplicate comments (1)
core/embed/rust/src/ui/layout_delizia/flow/confirm_action.rs (1)

339-344: ⚠️ Potential issue | 🔴 Critical | ⚡ Quick win

Avoid moving extra before later borrows.

matches!(extra, ...) and match extra consume extra, but &extra is used later (Line 381/Line 400), which breaks ownership.

💡 Proposed fix
-    let has_external_menu = matches!(extra, ConfirmActionExtra::ExternalMenu);
-    let mut header = match extra {
-        ConfirmActionExtra::ExternalMenu => header.with_menu_button(),
-        ConfirmActionExtra::Menu(_) => header.with_menu_button(),
-        ConfirmActionExtra::Cancel => header.with_cancel_button(),
+    let has_external_menu = matches!(&extra, ConfirmActionExtra::ExternalMenu);
+    let mut header = match &extra {
+        ConfirmActionExtra::ExternalMenu => header.with_menu_button(),
+        ConfirmActionExtra::Menu(_) => header.with_menu_button(),
+        ConfirmActionExtra::Cancel => header.with_cancel_button(),
     };
#!/bin/bash
set -euo pipefail

file="core/embed/rust/src/ui/layout_delizia/flow/confirm_action.rs"

echo "== by-value use sites in new_confirm_action_uni =="
rg -n -C2 'matches!\(extra|match extra' "$file"

echo
echo "== later borrows of extra in same function =="
rg -n -C2 'match &extra|&extra' "$file"
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@core/embed/rust/src/ui/layout_delizia/flow/confirm_action.rs` around lines
339 - 344, The code currently consumes extra via matches!(extra, ...) and match
extra, which prevents later borrows (&extra) in the same function (e.g., in
new_confirm_action_uni). Change these by-value uses to borrow instead: use
matches!(&extra, ConfirmActionExtra::ExternalMenu) for has_external_menu and
match &extra { ConfirmActionExtra::ExternalMenu | ConfirmActionExtra::Menu(_) =>
header.with_menu_button(), ConfirmActionExtra::Cancel =>
header.with_cancel_button(), } so extra remains available for subsequent &extra
borrows.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Duplicate comments:
In `@core/embed/rust/src/ui/layout_delizia/flow/confirm_action.rs`:
- Around line 339-344: The code currently consumes extra via matches!(extra,
...) and match extra, which prevents later borrows (&extra) in the same function
(e.g., in new_confirm_action_uni). Change these by-value uses to borrow instead:
use matches!(&extra, ConfirmActionExtra::ExternalMenu) for has_external_menu and
match &extra { ConfirmActionExtra::ExternalMenu | ConfirmActionExtra::Menu(_) =>
header.with_menu_button(), ConfirmActionExtra::Cancel =>
header.with_cancel_button(), } so extra remains available for subsequent &extra
borrows.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 63fdbc92-1e8b-4dba-a08b-06e9e2870cfc

📥 Commits

Reviewing files that changed from the base of the PR and between 110c8e5 and 1597414.

📒 Files selected for processing (22)
  • core/embed/rust/src/ui/layout_delizia/component/address_details.rs
  • core/embed/rust/src/ui/layout_delizia/component/coinjoin_progress.rs
  • core/embed/rust/src/ui/layout_delizia/component/frame.rs
  • core/embed/rust/src/ui/layout_delizia/component/header.rs
  • core/embed/rust/src/ui/layout_delizia/flow/confirm_action.rs
  • core/embed/rust/src/ui/layout_delizia/flow/confirm_fido.rs
  • core/embed/rust/src/ui/layout_delizia/flow/confirm_firmware_update.rs
  • core/embed/rust/src/ui/layout_delizia/flow/confirm_homescreen.rs
  • core/embed/rust/src/ui/layout_delizia/flow/confirm_reset.rs
  • core/embed/rust/src/ui/layout_delizia/flow/confirm_set_new_code.rs
  • core/embed/rust/src/ui/layout_delizia/flow/confirm_summary.rs
  • core/embed/rust/src/ui/layout_delizia/flow/continue_recovery_homepage.rs
  • core/embed/rust/src/ui/layout_delizia/flow/prompt_backup.rs
  • core/embed/rust/src/ui/layout_delizia/flow/receive.rs
  • core/embed/rust/src/ui/layout_delizia/flow/request_number.rs
  • core/embed/rust/src/ui/layout_delizia/flow/request_passphrase.rs
  • core/embed/rust/src/ui/layout_delizia/flow/set_brightness.rs
  • core/embed/rust/src/ui/layout_delizia/flow/show_danger.rs
  • core/embed/rust/src/ui/layout_delizia/flow/show_share_words.rs
  • core/embed/rust/src/ui/layout_delizia/flow/show_tutorial.rs
  • core/embed/rust/src/ui/layout_delizia/flow/util.rs
  • core/embed/rust/src/ui/layout_delizia/ui_firmware.rs

Copy link
Copy Markdown
Contributor

@jjanku jjanku left a comment

Choose a reason for hiding this comment

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

Overall, it makes sense and looks good to me 👍

Comment thread core/embed/rust/src/ui/layout_delizia/component/header.rs
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
core/embed/rust/src/ui/layout_delizia/component/frame.rs (1)

112-126: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Keep has_menu synchronized with the provided Header.

After moving menu-button builders off Frame, new() still hard-codes has_menu to false. In ui_debug, that means a frame can render a menu via Header while tracing as menu-less unless every caller also remembers .with_external_menu(). Please derive this flag from header here, or keep the old Frame bridge until the migration is finished.

Also applies to: 130-136

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@core/embed/rust/src/ui/layout_delizia/component/frame.rs` around lines 112 -
126, The ui_debug flags has_menu and has_flow_menu are hard-coded to false in
Frame::new which can desync debug tracing from the actual Header state; update
Frame::new (and the other Frame constructors around the later block) to derive
these flags from the passed Header (e.g., use Header's menu/flow-menu accessor
such as header.has_menu() or similar API) so has_menu and has_flow_menu reflect
whether the Header provides an external menu instead of always setting them to
false.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In `@core/embed/rust/src/ui/layout_delizia/component/frame.rs`:
- Around line 112-126: The ui_debug flags has_menu and has_flow_menu are
hard-coded to false in Frame::new which can desync debug tracing from the actual
Header state; update Frame::new (and the other Frame constructors around the
later block) to derive these flags from the passed Header (e.g., use Header's
menu/flow-menu accessor such as header.has_menu() or similar API) so has_menu
and has_flow_menu reflect whether the Header provides an external menu instead
of always setting them to false.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 5038cd4e-a257-4ff4-844e-6f916d94b262

📥 Commits

Reviewing files that changed from the base of the PR and between 1597414 and ce271fe.

📒 Files selected for processing (1)
  • core/embed/rust/src/ui/layout_delizia/component/frame.rs

@romanz romanz force-pushed the romanz/2605/drop-header-ts5 branch from ce271fe to e78a3fe Compare May 27, 2026 15:13
@romanz romanz merged commit 9c42d45 into main May 27, 2026
170 checks passed
@romanz romanz deleted the romanz/2605/drop-header-ts5 branch May 27, 2026 15:54
@trezor-bot trezor-bot Bot moved this from 🔎 Needs review to 🤝 Needs QA in Firmware May 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

T3T1 Trezor Safe 5 translations Put this label on a PR to run tests in all languages

Projects

Status: 🤝 Needs QA

Development

Successfully merging this pull request may close these issues.

2 participants