Merge upstream/main into main (A1 catch-up sync)
Depends on #173, which must merge first. This branch already carries it, so the diff below includes #173's commits until that lands. See Why the order matters.
What this is
Phase A1 of the delivery plan in #118: the first sync of upstream/main into fork main.
Measured on 2026-09-18:
| Merge-base | 2026-09-05 |
| Upstream ahead | 118 commits, at 9.4 commits/day |
Times fork main has merged upstream in 60 days | 0 |
| Conflicts | 40 |
Conflicts accrue at roughly one file per three upstream commits, so this only gets more expensive. #118 now carries a weekly-sync duty to keep it at 1–2 files a week instead.
Why the order matters
Merging upstream before #173 leaves Portfolio::RealizedGains#converted reading trade.currency, while upstream's merged we-promise/sure#3616 returns a gain already in the basis currency. A EUR disposal against a USD basis is then converted twice and reports 375 where 250 is right.
Git raises no conflict for it — the two files are simply incompatible. That is the hazard #118's new single-copy rule exists for: mergeability is not equivalence. #173 fixes exactly this, so it lands first and this merge is computed against it.
How the 40 were resolved
Loans — kept the fork's implementation entire, source and tests. Upstream carries our own we-promise/sure#3473, merged 2026-09-15 and reviewed down from ~8,900 to ~1,500 lines; the fork's lineage stopped on 2026-09-08 and never took it back. The fork's copy has 27 methods upstream lacks and its views call five of them, so adopting upstream's breaks the loan pages outright. Recorded in #184, to reconcile before the next loans PR goes upstream — deliberately not resolved here. Six upstream-only loan files are dropped for consistency (nothing references them), and upstream's duplicate 20260908145118_add_variable_rate_tracking_to_loans goes with them: the fork's 20260831160656 adds the identical columns and the colliding class name makes db:migrate refuse outright.
Portfolio seam — composed both sides. trade.rb, reports_controller.rb and their tests take #173's versions (same lineage as #3616, plus the fork-only unavailable-reason, the card positivity guard and the third-leg batching). chartable.rb keeps the fork's loan-only helpers with upstream's normalize_linked_investment_series(view:). The normalizer keeps flatten_first_trend over upstream's active_points. investment_statement.rb takes the fork's file whole — a strict superset at 921 lines against 398, and a hunk-by-hunk resolution produced an inconsistent hybrid that silently dropped a .select upstream had removed.
Converged on upstream where upstream had taken the idea further:
UI/account/chart.rb— upstream generalised all-time charting to every account type, which is what the fork's own comment said belonged upstream.reports_controller.rb— upstream'scategory_filter_value(#3186) spliced into the fork's controller, and its two category-link tests adopted; the fork's asserted the pre-#3186 URLs.20260908090000_increase_coinbase_balance_precision— upstream's is a later revision of the same migration (precision 34 against 30,[8.1]against[7.2]) and arrives with a test. Databases that already ran the fork's version needdb:migrate:redo VERSION=20260908090000.test/system/property_test.rb— upstream's retry fixes the flake currently red on we-promise/sure#3608.users.yml— upstream's, which gives its second admin an explicitcreated_atso the fixtures no longer tie.AccountTest's tie-break test now builds its own tie rather than depending on fixtures that deliberately avoid one.
Schema — not hand-merged. All 435 migrations run from scratch and the file regenerated: 2,984 lines against the fork's 2,843 and upstream's 2,885, carrying loan_amortizations, asset_class and upstream's precision: 34.
Verification
- 957 runs, 7,400 assertions, 0 failures across
test/models/portfolio,investment_statement,trade,account,balance,loan,userand the holdings, reports, portfolios and pages controllers. bin/rubocop: 2,768 files, no offenses.- Full suite deferred to CI: the devcontainer app container died with the host disk and Redis is not published to the host.
Follow-ups, recorded rather than fixed here
- #184 — the loans divergence.
Account#chart_periodand its 8 tests are now unused byUI::Account::Chart, which takes upstream's general version. Left in place: a sync PR should sync, not refactor.