0011 — The instance's owner is whichever organisation home points at
Status: accepted · Date: 2026-09-27
Context
0010 says an instance belongs to one owner,
and that the owner is a person or an organisation chosen at initial setup. Nothing in
the code said which. The root URL guessed: it forwarded a signed-in visitor to their own
profile and everybody else to sole_owner_handle — the handle of the only user, when
there is exactly one. That works for one person and cannot describe "this Steid is
Acme's", which is the customer 0010 names.
Three facts constrain the answer. Every handle is already an Organization row, a
person's included, so there is nothing to invent. orgs.kind was proposed by
0003 and dropped by 0004,
which makes "is this personal" an open question rather than a column. And
instance_owner — the predicate the backup surface uses — deliberately answers false
for everybody the moment a second user exists, so it cannot be what gates a change to
the front door.
Decision
The instance's owner is whichever organisation home points at, and home is an
instance-level setting: one nullable home_org_id in a single-row instance_settings
table, chosen in the setup wizard and changeable at /{handle}/settings.
Four things follow, and are part of the decision:
- Unset falls back to the sole owner, so every existing instance keeps the front door it had and the migration changes nothing until somebody picks.
- Several organisations per instance are allowed, and any signed-in user may create one. That is not multi-tenancy: they share one database, one owner and one set of people. Exactly one of them is home.
- Personal versus organisation is derived, not stored — an organisation is personal
exactly when some user's
personal_org_idpoints at it. - The root lands on home for everyone, signed in or not, and
orgsandorganizationsare reserved handles.
Setting home requires owning the organisation being pointed at.
Alternatives considered
- A
home_org_idcolumn onorgs. — Null on every row but one, so "which is home" becomes a scan, and nothing stops two rows claiming it. - A
kindcolumn onorgs(personal|shared), as 0003 wanted. — A second source of truth for somethingusers.personal_org_idalready says. It can disagree with the foreign key; a derived answer cannot. - Gate
set_homeoninstance_owner. — That predicate answersfalsefor everybody once a second user exists, which would make the front door unsettable on exactly the instances that most need to set it. - Keep the root sending signed-in visitors to their own page. — Right for one person, wrong for a company: a member landing on themselves rather than on their employer's repositories is the front door pointing somewhere private.
- Make the owner a user rather than an organisation. — Then "Acme Inc" needs a fake person to be, and every URL below it is that person's. The handle namespace is already shared; the owner may as well be the thing that holds repositories.
Consequences
- Makes easy: saying what an instance is for, in one row and one sentence; a
provisioned machine arriving already pointed at its customer's organisation
(
STEID_OWNER_ORG); moving the front door without renaming anybody. - Makes hard: anything that wants two front doors. There is one root and one home.
- Opens: nothing lists the organisations a person belongs to, so a second one is
easy to create and hard to find until milestone 7's members work lands. There is no
way to unset home, only to move it. And
set_home's rule is a placeholder for the instance-level role that does not exist yet — when it arrives, this is one of the bodies that changes, besideinstance_owner. - Reservable-too-late risk, taken now:
orgsandorganizationswere reserved while nobody held them, which 0004 says is the only moment it is free. - Reversible cheaply while unreleased: the table is additive and the fallback means deleting the feature restores the old behaviour exactly. Once instances have chosen a home, reversing it moves their front door.