Repository navigation
Replies: 2 comments
Full designArchitecture for recording who owns what share of an account and for counting the family's share in balance figures. Code references are to 1. ScopeDiscussion #1170 asks Sure to count "the percentage of an asset I actually own": a flat worth 100,000 owned half by me and half by my sister adds 50,000 to my net worth. The co-owners in that thread (siblings, a business partner, a spouse who does not use Sure) are usually outside the Sure family, so a single-user family must be able to record a split. The design counts the family's share in a closed list of balance figures (section 5). Every other figure keeps counting whole accounts and says so where it sits next to a family-share figure (section 6). A family that does not turn the feature on sees no change at all: same figures, SQL, cache keys and API responses. 2. Domain model
Rules:
Ownership is per account. A co-owner who holds one position or one item of an account and not the rest records that part as a separate account; 3. Ownership recordsSchemaA member row stores no name, so renaming a member needs no update. The schema enables only Invariants
The writer accepts percentages and stores fractions. A third is stored as 0.333334 + 0.333333 + 0.333333: the remainder goes to the largest share, ties broken by owner id. The writer
A split of one member at 100% is valid and distinct from no split: the household counts both at 1, and the member view (section 8) counts the first for that member and the second for nobody. Departure ruleWhen a member leaves the family, each share they hold goes to the account's administrator, merged into the administrator's row when one exists. On accounts the leaving member administered, it goes to the member who takes those accounts over, chosen as
The Other lifecycle
4. Gate
With the column false:
5. Perspective and the closed listPerspective# app/models/perspective.rb, a value object built like Period
class Perspective
def self.household(family)
def self.mine(user) # step 3
def self.from_param(key, viewer:) # "mine" -> mine(viewer), anything else -> household
def weighted? # false: callers emit main's SQL and keys
def account_weights # { account_id => BigDecimal }, only accounts not counted at 1
def cache_key # nil unless weighted?
def key # "household" | "mine"
end
The closed list
Chart builder. Under 6. Whole-account figures and their labelsEverything not in section 5 keeps counting whole accounts and takes no perspective. Liquidity figures in particular describe money a person can spend: either partner can spend all of a joint account, which is what the comment on available cash requires (
Under the net worth figure, one note: "Counts your family's share of 2 accounts owned with others. Other figures count full accounts." The note, the badge and the account line are one partial each, rendered only when 7. API, assistant and mobileAPI. With the gate on, Assistant. Mobile. 8. Per-member view (step 3)The closed list also accepts
9. Caches and queries
A family with the gate off runs no extra query. A family with the gate on runs one per request, over a few dozen rows. 10. InterfaceOwnership editor. Edit account renders the shared
The copy calls it the economic share, "what counts toward each owner's wealth", which need not match the name on the contract. Other members see the line read-only on the account page. Sharing dialog. Unchanged except for the refusal to unshare a member who holds a share. Badges. A balance sheet or sidebar row counted at less than the whole account shows the counted amount and a badge whose tooltip names the other owners and both amounts: "Owned with Ana · counting 50,000 of 100,000". 11. Tests
12. Delivery
13. Not in this proposalWeighting flows (income, spending, budgets) or liquidity (available cash, paycheck planner, cash-flow warning) by ownership, a line for money moving between owners, investment returns per owner, dated changes of shares, settling up between owners, and ownership per holding or item. 14. Decisions
|
|
This fits #1170 well: a flat shared with a sibling, recorded as an outside owner, with synced balances left untouched.
|
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
#1170 asks Sure to count only the part of an asset you own, for property and mortgages: a flat worth 100,000 that I own half with my sister should add 50,000 to my net worth. The thread also asked to keep it super-simple, with little UI, and to leave families that record no ownership untouched.
This proposal covers balances only. It records who owns what share of an account, and the household's net worth counts the family's share. Spending, budgets, goals and investment figures keep counting whole accounts.
Model
The members (61,000 + 5,000) plus the accounts with no split (8,000) add up to the household (74,000), and the household plus my sister's 50,000 adds up to the gross 124,000. Tests check both for every figure that counts shares.
The figures that count the family share
The list is closed. Only these figures read ownership:
GET /api/v1/balance_sheet.get_balance_sheetin the assistant, which MCP reuses.Splits among members never change the household's figures, because member shares add up to the family's 100%. Only an outside owner lowers them.
What keeps counting whole accounts
Income, spending, cash flow, budgets, available cash, goals, the paycheck planner, the cash-flow warning, holdings and investment performance stay as they are today: either partner can spend all of a joint account.
Where these sit next to a family-share figure, they say so. Under net worth: "Counts your family's share of 2 accounts owned with others. Other figures count full accounts." On a goal, the investments page or the paycheck planner, a split account carries "Full account · family share 50%". The account page shows the full balance and the line "Family share: 50%".
On screen
Gate
Ownership is a family setting, off by default, that a family administrator turns on. During preview it appears only to administrators who enabled preview features. The figures read the family setting, so a family has one household whoever is looking. With it off nothing changes anywhere: same figures, queries and cache keys on the web, same responses for the API and the mobile app. Turning it off keeps the recorded shares and restores today's figures.
Delivery
?perspective=mineon the web and/api/v1/balance_sheet, and as a second, labelled block inget_balance_sheet. In it, accounts with no split recorded show on their own line, counted for nobody.Not in this proposal
Weighting spending, income, budgets or available cash by ownership, a line for money moving between owners, investment returns per owner, dated changes of shares, settling up between owners, and ownership per holding or item.
Decisions
@jjmata @has-ctrl, I'd most like your view on these two. @rubenRP @Apaullo436, you asked for this in #1170: does it fit how you'd use it, for example a flat with siblings or a mortgage synced through SimpleFIN?
The full design, with references to the code, is in the next comment.
All reactions