← Back to Pull requests

feat(transfers): Add ability to rename transfers from the drawer #5329

Open
unknown opened this pull request with 650 lines diff across 8 files
View on GitHub
unknown unknown commented on Nov 18, 2026 17:37 UTC
Author

Problem

A transfer's name cannot be currently changed. If the transfer is created manually, it just says "Transfer from"/"Payment to". But if it comes from a transaction, it gets the name of the original transaction, while the other leg says "Transfer from"/"Payment to", or the matching transaction.

What this changes

The transfer drawer now shows each leg's own name and lets a user with write access to
both endpoints rename them inline:

  • The header shows Transfer#display_name: the shared label when both legs are named

  • identically (the user or importer spoke of the transfer as one thing), otherwise a
    contextual type ("Credit card payment", "Loan payment", "Investment contribution",
    "Payment", "Transfer") so neither leg's name is passed off as the name for both.
  • Each leg's name sits inline next to its From/To row as a pencil-reveal text field that

  • looks like the row's value, not a boxed form input. Blurring submits via the existing
    auto-submit controller; the turbo-stream response replaces both entry rows and the
    drawer's name, so the list and the drawer stay in sync without a reload.
  • Transfer#rename_entries! renames both legs atomically, strips whitespace, and returns

  • false when either name is blank — the controller turns that into an alert and changes
    nothing. Only changed legs are written, and each renamed leg locks just its name via
    lock_saved_attributes! so a later provider sync cannot overwrite the user's label,
    without freezing unrelated provider enrichment.
  • Both names travel together: a request carrying only one name is treated as invalid

  • rather than silently leaving the other leg unchanged, and the permission check reuses
    the same require_account_permission! flow as every other transfer mutation. The
    rename fields are hidden for viewers without write access to both endpoints, so
    read-only sharers never see a CTA the controller would reject.

    Design system

    The inline field is a new primitive, DS::InlineEdit, with a component preview: an
    input styled as the row's value text with a pencil affordance on hover/focus, usable
    inside any summary row (currently DS::DetailRow's value slot). The caller supplies the
    accessible name, since the visible label usually lives in a sibling <dt>.

    Validation

  • bin/rails test test/controllers/transfers_controller_test.rb test/models/transfer_test.rb

  • — 120 runs, 433 assertions, 0 failures, 0 errors
  • bin/rails test test/components/DS/inline_edit_test.rb — 3 runs, 7 assertions, 0 failures

  • bin/rails test test/system/transfers_test.rb — 3 runs, 14 assertions, 0 failures

  • rubocop / erb_lint on all changed Ruby and ERB files — no offenses
  • The system test drives the real flow: open the drawer from the transaction list, fill
    both name fields, blur to auto-submit, and assert both the drawer's name and the
    transaction row update.

    Notes

  • No migration, no new valuation kind, no new dependency. Existing drawer markup moved

  • into transfers/_overview unchanged apart from the added name rows; the fee and
    status behaviors are untouched.

    Screenshots

    <img width="652" height="760" alt="image" src="https://github.com/user-attachments/assets/8253536d-77a9-4fbb-9ea6-bc8f7a8b8fe9" />
    ``

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

    Summary by cubic


    Adds inline renaming of both transfer legs from the transfer drawer, so transfers created manually or from transactions can get meaningful labels.

  • The drawer header shows the shared name when both legs match, otherwise a localized contextual label based on the destination account type.

  • Users with write access to both accounts get a pencil-reveal inline field next to each leg's From/To row; blurring auto-submits and the Turbo Stream response updates both rows and the drawer name. Read-only viewers see each leg's name without the rename control.

  • Transfer#rename_entries! renames both legs atomically, strips whitespace, and raises ActiveRecord::RecordInvalid on blank names so the controller surfaces an alert; changed legs lock their names so provider syncs don't overwrite user labels.

  • Adds the DS::InlineEdit design-system primitive for inline-editable text values in DS::DetailRow` summary rows.
  • <sup>Written for commit 29c5e17ef93ff843900d31731d4754671a1b3aa1. Summary will update on new commits.</sup>

    <a href="https://cubic.dev/pr/we-promise/sure/pull/5329?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>

    <!-- 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 inline editing for transfer transaction names when both accounts are writable. Changes appear in the transfer view and transaction list.
    Transfer displays use a shared name when both transactions match, or a contextual, translated label when they differ.
    Transfer overviews show source and destination account details, including applicable fees and totals.
    Bug Fixes
    Blank names are rejected without changing either transaction. Updates that omit names leave existing names unchanged.
    * Transaction names for accounts a viewer cannot access are not exposed in the transfer overview.
    <!-- end of auto-generated comment: release notes by coderabbit.ai -->

    Diff: 650 lines (+487 / -163) across 8 files Reviewer: gariasf Review duration: 25435m
    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 #5329"
    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%