Add PATCH /api/v1/accounts/:id #6148
All Vouch review confidence checks passed
Residual risk 0.26 = Change Risk (0.48) × (1 − Review Confidence (0.47)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.48 · 534 lines diff across 6 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.02 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
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.376
Shallow Review Depth
shallow_review_depth
0.344
Real PR Conversation Timeline
1 comments
"Review active on #6148"
general
weight: 0.35
jjmata
Problem
The accounts API is read-only (
index/show). A client can list accounts but cannot change an account's name, institution or icon; that has to be done in the web UI.Change
Adds
PATCH /api/v1/accounts/:id, which edits what the account form edits, except balance, currency and type, whose changes restate the account's history:name,institution_name,institution_domain,exclude_from_reportslogo, as amultipart/form-dataupload inaccount[logo]It behaves like the account form: a new institution domain queues the icon fetch unless a logo is uploaded in the same request, an uploaded logo takes over from Brandfetch, and the edited fields are locked so a provider sync does not overwrite them.
Requires the
read_writescope and full access to the account (owner orfull_controlshare). An account the caller cannot see is a 404, one shared read-only is a 403, and a validation error saves nothing. A null or blankexclude_from_reportsis a 422. A missing or non-objectaccountparam, or one with no editable fields, is a 400.No migration.
Related: #5834 adds
POST /api/v1/accounts. This PR covers updating only and does not depend on it, but both edit the accounts API controller and routes, so whichever merges second may need a rebase.Validation
test/controllers/api/v1/accounts_controller_test.rb; documentation-only rswag spec added anddocs/api/openapi.yamlregenerated.bin/rails test: 20,313 runs, 0 failures, 0 errors, 9 skips.test/support/verify_api_endpoint_consistency.rbclean.🤖 Generated with Claude Code
<!-- This is an auto-generated description by cubic. -->
---
Summary by cubic
Adds
PATCH /api/v1/accounts/:idso the API can edit account details that previously required the app UI.name,institution_name,institution_domain,exclude_from_reports, andlogo(as a multipart/form-data upload inaccount[logo]); balance, currency, and type are intentionally not editable through this endpoint.read_writescope and full access (owner orfull_controlshare); accounts the caller cannot see return 404, read-only shares return 403, and validation errors save nothing.exclude_from_reportsreturns 422 (now validated onAccount), and anaccountparam that is not an object or contains no editable fields returns 400.<sup>Written for commit 4b7cce61620c026ea6222585cf24356640ffc188. Summary will update on new commits.</sup>
<a href="https://cubic.dev/pr/we-promise/sure/pull/6148?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
Update account names, institution details, report exclusion settings, and logos through the API.
Updates require write access and full account access. Accounts the caller cannot access return not found; invalid changes return validation errors.
Changed fields are protected from later provider-sync updates. Logo uploads are validated before being saved.
Documentation
Added API documentation for account updates, editable fields, access requirements, and response codes.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->