← Back to Pull requests

Let users choose the mobile bottom bar's entries #6026

Open
unknown opened this pull request with 650 lines diff across 8 files
View on GitHub
unknown unknown commented on Dec 01, 2026 12:52 UTC
Author

Part of #6022

Stacked on #6025 (the bar scrolls). Review that PR first; this one adds a single commit on top of it.

Fork pre-flight: jaysbeekay/sure#1047 (same branch, same commit)

Problem

On a phone the bottom bar shows every main nav entry. With PR 1 it scrolls once they don't fit, but a user who never opens Bills or Reports still can't free the room for the entries they do use.

Behaviour

  • Settings > Appearance has a new Bottom bar section with a checkbox per entry the user can currently see. Home is always shown: its checkbox is checked and disabled. Entries the user can't see (Bills with recurring detection off; Bills and Portfolio without preview) aren't offered.

  • Unticking an entry takes it off the phone bar only. The desktop sidebar is unaffected.

  • Hiding Assistant removes chat from the phone, since the sidebar never shows it. The section's subtitle says so and that it can be turned back on there.

  • The section is not shown in intro mode, matching the profile page's intro guard; intro mode's bar has no keys to choose from.

  • The choice is per user, stored in users.preferences["bottom_bar_hidden"]. User#update_bottom_bar(hidden:, shown:) writes it under with_locked_preferences, keeps only known entry keys, and never hides home. When nothing is hidden, the key is removed.

  • Entries the form didn't offer keep their state. A user who hid Portfolio and then turned preview off and on again still has it hidden.

  • Each main nav entry has a stable key: (home, transactions, bills, reports, plan, portfolio, assistant). Plan and the pre-preview Budgets entry share plan. The list moves from the layout to ApplicationHelper#main_nav_items, so the settings page offers exactly the entries the layout renders.

  • The layout takes the desktop list first, then drops the hidden keys from the phone list. Intro mode's two entries have no key and are never filtered.

  • The form follows the existing "Start expanded by default" checkboxes. Each offered entry posts a hidden 0, then 1 from its checkbox when ticked. Disabled Home posts nothing. The appearance update saves the bar after its own locked block, which would otherwise write its copy of the preferences over it.

  • Uses the existing checkbox classes and settings_section. No new CSS, and no new JavaScript (it uses the existing auto-submit-form).
  • Not in this PR: reordering entries, and applying the choice to the desktop sidebar. Both are left out of v1 in the issue.

    Validation

  • test/models/user_test.rb, 7 new tests: empty by default; unknown keys dropped; home ignored; shown and hidden applied while unoffered entries keep their state; the key cleared when nothing is hidden; section_order, collapsed_sections and preview_features_enabled unchanged by an update; a preference saved by another request after this user was loaded survives the update.

  • test/controllers/settings/appearances_controller_test.rb, 8 new tests:

  • - The section offers a checkbox per visible entry, Assistant included. Home is checked, disabled and has no hidden field. Bills and Portfolio are absent without preview.
    - The section is not offered in intro mode.
    - Saving hides the unchecked entries.
    - Saving with every entry checked clears the preference.
    - Everything unchecked except Home, plus a forged home=0, leaves Home alone on the bar.
    - A form without the bar fields leaves the hidden entries alone.
    - A hidden entry leaves the bottom bar but stays in the sidebar. The sidebar links are read only from the desktop nav (data-testid="desktop-nav"), so another list on the page linking the same pages cannot satisfy the check.
    - An entry that is unavailable anyway (Bills with recurring off; Portfolio without preview) stays off the bar whatever the preference says.
  • test/views/layouts/shared/nav_item_view_test.rb: the partial accepts key: and renders the same markup.

  • Before the change, every new test failed: model and controller tests on undefined method 'update_bottom_bar', the partial test on unknown local: :key. With the model in place but no layout filter, the layout test failed on Expected ["/", "/transactions", "/bills", "/reports", "/plan", "/portfolio", "/chats"] to not include "/reports".

  • Mutations, each run on a copy and each turning a test red:

  • - Filter applied to the desktop list too: Expected ["/", "/transactions", "/plan", "/portfolio"] to include "/reports".
    - Home guard dropped: Expected: ["bills"] Actual: ["home", "bills"], and the Home-alone controller test.
    - Unknown-key filter dropped: the unknown-keys model test.
    - with_locked_preferences replaced by a plain update! from the loaded copy: the concurrent-request test (Expected false to be truthy).
  • Full bin/rails test on dac108517: 19562 runs, 1 failure, 8 errors. The failure is the known flaky lock-wait check in account_statement_import_concurrency_test.rb, which passed when rerun; the 8 errors are ReleaseNotesWorkflowTest, from the local test environment, the same as on PR 1.

  • System tests: mobile_bottom_nav_scroll, mobile_bottom_nav_clearance, settings, settings/preferences, sidebar_narrow, sidebar_widths, sidebar_animation_rows, portfolios, bills_mobile, release_highlights. 67 runs, 0 failures.

  • rubocop, erb_lint and Brakeman: clean. No JS changed.
  • Screenshots

    Preview user with the assistant enabled. In "After", Bills and Reports are hidden. "Before" is PR 1 with no setting.

    | | Before | After |
    |---|---|---|
    | Settings > Appearance, 390 px | !before appearance 390 | !after appearance 390 |
    | Settings > Appearance, 1440 px | !before appearance 1440 | !after appearance 1440 |
    | Bottom bar, 390 px | !before bar 390 (seven entries, scrolls) | !after bar 390 (five entries, no scrolling) |
    | Desktop sidebar, 1440 px | !before sidebar 1440 | !after sidebar 1440 (unchanged, Bills and Reports still there) |

    <!-- This is an auto-generated description by cubic. -->
    ---

    Summary by cubic


    Lets users choose which entries the mobile bottom bar shows. Settings > Appearance now has a Bottom bar section with a checkbox per entry the user can currently see; the bar previously showed every main nav entry and scrolled when they didn't fit.

  • Home is always shown, its checkbox is disabled, and the desktop sidebar is unaffected. The section's subtitle covers hiding any page on smaller screens, including Assistant removing chat, and that hidden pages can be shown again in the same section.

  • The choice is per user, stored in users.preferences["bottom_bar_hidden"] by User#update_bottom_bar under with_locked_preferences, which drops unknown keys, never hides home, and clears the key when nothing is hidden.

  • Entries the user can't currently see (Bills and Portfolio without preview) aren't offered and keep their hidden state.

  • The main nav list moved to ApplicationHelper#main_nav_items with a stable key: per entry; the layout drops hidden keys from the phone list only. Intro mode's two-entry bar has no keys and is never filtered, so the section isn't shown there.

  • The controller reads the form's choices through strong params, permitting User::BOTTOM_BAR_KEYS, and a form without the bar fields leaves the preference alone.
  • <sup>Written for commit 1f22487405297ecd58d0c0adf4b649680173989d. Summary will update on new commits.</sup>

    <a href="https://cubic.dev/pr/we-promise/sure/pull/6026?utm_source=github" target="_blank" rel="noopener noreferrer" data-no-image-dialog="true"><picture><source media="(prefers-color-scheme: dark)" srcset="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://www.cubic.dev/buttons/review-in-cubic-light.svg"><img alt="View guided diff" src="https://www.cubic.dev/buttons/review-in-cubic-light.svg"></picture></a> <a href="https://www.cubic.dev/action/auto-fix/pr/we-promise/sure/6026?returnTo=https%3A%2F%2Fgithub.com%2Fwe-promise%2Fsure%2Fpull%2F6026&source=description" target="_blank" rel="noopener noreferrer" data-no-image-dialog="true"><picture><source media="(prefers-color-scheme: dark)" srcset="https://www.cubic.dev/buttons/turn-on-auto-fix-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://www.cubic.dev/buttons/turn-on-auto-fix-light.svg"><img alt="Turn on auto-fix" src="https://www.cubic.dev/buttons/turn-on-auto-fix-light.svg"></picture></a>

    <!-- End of auto-generated description by cubic. -->

    <!-- This is an auto-generated comment: release notes by coderabbit.ai -->
    <!-- coderabbit-ai-generated:v1 -->

    Summary by CodeRabbit

    New Features
    Added settings to choose which pages appear in the mobile bottom bar. Home stays visible, and these choices do not affect desktop navigation.
    Added Assistant to mobile navigation when available. Pages available only in preview appear in the bottom-bar settings only when accessible.
    Bug Fixes
    Preserved existing bottom-bar preferences when saving settings without bottom-bar fields.
    Ensured unavailable pages remain off the bottom bar and Home cannot be hidden.
    <!-- end of auto-generated comment: release notes by coderabbit.ai -->

    Diff: 650 lines (+487 / -163) across 8 files Reviewer: gariasf Review duration: 7001m
    All Vouch review confidence checks passed
    Residual risk 0.28 = Change Risk (0.52) × (1 − Review Confidence (0.47)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.52 · 650 lines diff across 8 files
    0.52
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.02 · 1 substantive comment(s)
    0.02
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    46%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.388
    Shallow Review Depth shallow_review_depth
    0.344
    Real PR Conversation Timeline
    1 comments
    "Review active on #6026"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 46.7% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 52% (MEDIUM) · Higher = larger blast radius
    52%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 46.7% · Lower = rushed or shallow review
    46.7%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 27.7% · Safe to merge
    27.7%