Repository navigation
Conversation
start creates the management partner and its staff organisation and attaches the first domain to it, so the seeded admin has cluster reach once tenancy enforcement is on. Placeholder rows are created owned by that organisation. Builds and clones migrations from the models tenancy branch until models #332 merges.
Picks up pg-orm 2.5.3, which models now requires. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The spec migrator cloned models master, so specs ran without the tenancy columns the seeding code writes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
stakach
force-pushed
the
PPT-526-tenancy
branch
from
November 6, 2026 04:04
d3ddb20 to
a0a409d
Compare
On a cluster that predates tenancy the backfill migration runs before `start` and gives the first domain an organisation of its own, so the seeding never attached it to the staff organisation and its admins would have no cluster reach once enforcement is on. While that organisation is still as the backfill created it (no partner, no other domain, the backfill's description), move everything it owns and the grants scoped to it into the staff organisation and remove it, in one transaction. Organisations an operator has changed are left alone. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Clean-install half of multi-tenancy (under PPT-526). Pairs with PlaceOS/models#332 and PlaceOS/rest-api#451. Draft until the set has been through a clean install on the test cluster.
What this does
startcreates the management partner ("PlaceOS",management = true) and its staff organisation (partner_staff = true), and attaches the first domain to that organisation. With enforcement on, the seeded admin therefore has cluster reach from the first boot rather than reaching nothing.create:placeholderstask does the same when a staff organisation exists.shard.override.yml, and the image clones that branch for its migrations, so a clean install from this image applies the tenancy schema.On a cluster that predates tenancy, the backfill migration (which runs before
start) has already given the first domain an organisation of its own. While that organisation is still exactly as the backfill created it (no partner, no other domain, the backfill's description),startmoves everything it owns, and any grants scoped to it, into the staff organisation and removes it, in one transaction. An organisation an operator has changed is left alone.Both seeding steps are idempotent in the same way as the existing ones: existing rows are reused, never changed, except that an unowned first domain is attached.
Verification
Rebased onto master (2026-11-05), tracking models
PPT-526-partner-clientatb502009(pg-orm 2.5.3). The spec migrator now also clones that branch, so specs run against the tenancy schema.spec/entities_spec.cr: fresh install, idempotent re-run, backfilled estate moved, operator-changed and multi-domain organisations left alone. 13 examples, 0 failures.Before merging, once models #332 is on master: revert the branch pins in
Dockerfile,spec/migration/Dockerfileandshard.override.yml.crystal build --no-codegenclean forstartandsam.The tenancy fixture in rest-api#451 (
spec/spec_helpers/tenancy.cr) builds the same shape this seeds, and its specs show a staff-organisation admin resolving to cluster reach.Plan: https://gist.github.com/camreeves/3fabfff92bcdef77a1dcb4b8d8ebfe7b