Link the parent breadcrumb on account and SSO provider pages
Closes #504
Update, 30 Oct. main now has upstream #3981 ("Fold the bill's page into its drawer"). BillsController#show always renders the drawer without the layout, so there is no bill page left to carry a trail. The merge of main at a94a7d3a takes main's side in bills_controller.rb and bills_controller_test.rb. It also removes bills_return_path and the breadcrumbs.bills key, because nothing else read them; the Bills index's default trail still reads "Bills" through controller_name.titleize. The ported CI image change and the bills test pin are already on main. This PR's diff is now only the account and SSO provider trails, four files, which match #522 / we-promise/sure#4373. The bills rows below describe the earlier head and no longer apply.
Fork/upstream pair. The account and SSO provider half of this change is ported to upstream main as fork pre-flight #522, which carries upstream PR we-promise/sure#4373 (on upstream issue we-promise/sure#4365). #522 is a port onto mirror/upstream-main, not the same branch or commit as this PR. The bills half stays fork-only: upstream renders bills#show as the index plus a drawer (we-promise/sure#3981), so it has no full bill page to put a trail on.
Before: a bill's page showed Home > Bills, and "Bills" was plain text, so there was no way back to the Bills list from the trail. An account's page (Home > Accounts) and the SSO provider admin forms (Home > SSO providers) had the same problem.
After: the trails read Home > Bills > <bill name>, Home > Accounts > <account name> and Home > SSO providers > Add SSO Provider / Edit SSO Provider, and the middle crumb is a link. The Bills crumb goes back to the tab and filters the bill was opened from (All, Calendar or Paycheck), or to the plain index when the bill wasn't opened from Bills.
How: these actions never set @breadcrumbs, so they took the default trail, whose last crumb is the section and is never a link. Each one now sets its own three-level trail.
Summary
Completes #504, including the owner's request to apply the fix to every breadcrumb with the same defect.
Scope and dependencies
- Issue: #504
- Parent PR/branch, if stacked: none
- Ported CI fixes, so this PR's CI can go green. Each becomes a no-op once
maincarries it:89cd90cdports upstream c1405be40 (we-promise/sure#4108), which pins a date-dependent bills test that fails onmainfrom about the 19th of each month.a531b3aeports #516'sci.ymlchange (Refs #511), which moves the service images off ECR Public, whose anonymous limit kept failingtest_systembefore any test ran.
- Intentionally out of scope:
Breadcrumbabledefaults and the shared partial. A generic "link the section to its index" default would link/holdings, which 404s without an account.- Drawer and dialog pages (transactions, holdings, rules, categories and others), which render over a page that keeps its own trail.
- Other locales. They fall back to
enthroughconfig.i18n.fallbacks.
Which pages. A throwaway test sweep, not committed, requested every directly reachable GET page as a family admin and as a super admin, and printed each trail. Only these full pages had an unlinked parent: bills#show, accounts#show, and admin/sso_providers#new and #edit. Goals, events, account statements and API keys already had the full trail.
Changes
BillsController#showsets the trail after the drawer early-return. The new private methodbills_return_pathreusesRecurringFeatureGuardable#safe_return_path(fallback: bills_path), keeps the result only when its path isbills_path, and returns only that path and its query, never a host.AccountsController#showsetsHome > [Accounts](/accounts) > name.Admin::SsoProvidersController#set_form_breadcrumbsis called fromnew,editand both failure re-renders.config/locales/breadcrumbs/en.ymlgainsbills: Bills.
Blast radius. @breadcrumbs is per action. The drawer render and the account frame partials render without the layout. safe_return_path is read, not changed. Siblings: Bills::SmartConfigurationsController#show and RecurringOccurrencesController#show are dialogs. AccountableResource#show has no route.
Evidence checklist
- Each issue in this PR has its own acceptance criteria and no unrelated issue work is included. (The two ported CI fixes above only unblock CI.)
- Contract rows touched by this change name existing tests.
- Any gate test has an observed failing mutation transcript attached.
- Fixtures used as evidence assert internal consistency.
- Financial calculations use
BigDecimaland documented rounding points. (No financial calculations.) - De-identification uses token-shape allowlists; no personal data is included.
- Files changed, decisions, tests/runtime, risks, and next unblocked issue are documented below.
Validation
At a94a7d3a: accounts_controller_test.rb, admin/sso_providers_controller_test.rb and bills_controller_test.rb give 276 runs, 0 failures, 0 errors. RuboCop reports no offences on the four changed files.
Tests. Each positive test failed before its fix. Each last-crumb assertion targets [data-breadcrumbs] > span:last-child, so an unlinked middle crumb can't satisfy it.
| Test | Before the fix |
|---|---|
bills: the Bills crumb links back to /bills, with the bill name last | 0 links |
bills: an absolute or relative referrer of /bills?view=all&q[bill_type]=subscription keeps that query | 0 links; the relative case still failed on the first, host-only version (Gatekeeper G1) |
bills: no referrer gives a 200 and /bills (G2) | 0 links |
bills: off-host, scheme-relative, javascript:, transactions-page and unparseable referrers give plain /bills | 0 links |
accounts: the Accounts crumb links /accounts, with the account name last | 0 links |
| accounts: the accounts list has no self-link, and "Accounts" is its last crumb | passed (a guard) |
| SSO providers: new and edit link the list, with the form title last | 0 links |
| SSO providers: a rejected create keeps the link and the "Add" title, and creates no provider | 0 links |
| SSO providers: a rejected update keeps the link and the "Edit" title | 0 links |
| SSO providers: the list has no self-link | passed (a guard) |
Mutations, each reverted after its run:
| Mutant | Caught by |
|---|---|
| drop the referrer host check | the off-host referrer case |
return plain bills_path | the tab case |
| compare hosts only (the first implementation) | the relative-referrer case |
drop the trail from the failed update path | the rejected-update case |
drop the trail from the failed create path | the rejected-create case (before this test, every test passed) |
give the failed update the :new title | the rejected-update case |
Commands and results:
bin/rails test, full suite on the controller changes (thene58bf208, re-authored since with the same tree): 12452 runs, 1 failure, 0 errors, 35 skips. The failure isProvider::OpenaiTest#test_extra_headers_stringifies_nested_values_Ruby-style, which only fails in this sandbox: it runs Ruby 3.3, and the test expects Ruby 3.4'sHash#inspect.bills_controller_test.rbat89cd90cd: 107 runs, 0 failures. The skipped-occurrence test fails without the ported pin and passes with it.- CI on
a531b3ae: every job green, includingtest_unit,test_systemandAnalyze (swift). - RuboCop: no offences on the changed files.
- Brakeman: 0 warnings.
- Upstream
AGENTS.md(read frommirror/upstream-main): the commit subjects are at most 72 characters and give their reasons; the tests are Minitest with fixtures; no ERB, components, styles or API endpoints change; the branch is current withmain.
Risks, blockers, and follow-up
- Only the trail contents change; no component or style changes.
- Upstream has the same defect for accounts and SSO providers; #522 / we-promise/sure#4373 carries that fix.
Screenshots
Same change as we-promise/sure#4373; these are that PR's before and after screenshots.
Captured by a system test against the test fixtures: before on main at 7917bc1e4, after on we-promise/sure#4373's branch.
| Page | Before | After |
|---|---|---|
| Account | Accounts, as the unlinked current page"> | Accounts > Checking Account"> |
| New SSO provider | SSO providers"> | SSO providers > Add SSO Provider"> |
| Edit SSO provider | SSO providers"> | SSO providers > Edit SSO Provider"> |
Summary by CodeRabbit
- New Features
- Added breadcrumb navigation to account details and SSO provider forms, with links back to their respective lists.
- Added a Bills breadcrumb to bill pages. It returns to the Bills list and preserves the selected view when reached from that list.
- Breadcrumbs now distinguish the current page from linked navigation items.
Accounts, as the unlinked current page">
Accounts > Checking Account">
SSO providers">
SSO providers > Add SSO Provider">
SSO providers">
SSO providers > Edit SSO Provider">