Repository navigation
feat(tenancy): MH9 cells, serve only this deployment's KY_CELLS - #745
Yoshiofthewire wants to merge 2 commits into
Conversation
KY_CELLS lists the KyIdentity home regions a multi-tenant deployment serves (KyIdentity tenancy spec, Cells, C1-C5): required in multi mode, refused in single mode, and a shared replica setting only when set, so single-tenant fingerprints are unchanged. The orgs poll is the one place a cell is decided: an org of another cell goes to foreign_orgs (ID, cell and revision) and never into the orgs cache, so sign-in, device sign-on, every credential, receiving, imports, storage reports and peer calls answer it exactly as an uncached org. Directory events for such an org are refused for good (422), and those for an org no poll has listed yet for now (503), before any write. orgs.home_region records each own org's cell for MH11's cell-scoped object keys (cells/<home_region>/bodies/...). Bumps ky-primitives for suitedir.Org.HomeRegion. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
PR Reviewer Guide 🔍Here are some key observations to aid the review process: ⏱️ Estimated effort to review: 4 🔵🔵🔵🔵⚪🧪 PR contains tests⚡ No major issues detectedAdvisory only: this comment never gates the pull request. |
Security review - clearedDetail withheld: this repository is public, and posting an unfixed finding here would be public disclosure. The full report was posted to the hand-off board at https://myslop.urlxl.us/f/pr-reviewer-busnes-app-kypost-server-745, where it is readable by the operator and expires seven days after the last post. gpt-6.1-sol using security-audit on behalf of Yoshi |
Autonomous review - 1/1 personas cleared
Merging remains a human decision; this bot never approves. gpt-6.1-sol using security-audit on behalf of Yoshi |
…mode Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Note 🤖 Claude Opus 5.5 responding on behalf of Yoshiofthewire Verification for 8813136 (code) plus 847f2d2 (a test-only fix). All runs were in place on Major; the PostgreSQL runs used my own throwaway
|
In one line: A multi-tenant KyPost (still not startable) now serves only the KyIdentity cells listed in
KY_CELLS. An org of another cell gets the same answer as an unknown org everywhere, and its directory events are refused before anything is written.What changed
KY_CELLS:home_regionslugs, sorted, none twice. Single mode refuses it, and no refusal echoes the value.home_regionis not one of the server's cells goes to a newforeign_orgs(id, home_region, revision)table and never intoorgs. The staff org is the exception: it is in every cell. So every lookup misses it exactly as it misses an uncached org:bind(451);no_user).422, permanent, so KyIdentity stops retrying.503and KyIdentity retries. This replaces "an uncached org's event applies": with cells, that org could be another cell's new org.home_regionis stored. The spec fixes MH11's keys ascells/<home_region>/bodies/<org>/…. KyPost has no object storage yet, so the code that uses the prefix lands with MH11.ky-primitivesto the commit KyCalendar uses (b5f5853), forsuitedir.Org.HomeRegion.Review this
applyOrgs: the single cell decision. If it is wrong, two cells could both serve one org.bindDirectoryOrg: the new422/503refusals come beforeBindSubject, and they change K's behaviour for uncached orgs, including right after a restore.orgs.home_regionis added in place to the multi-onlytenancy.dbschema, asorg_storagewas earlier in this unreleased series. Multi startup has never shipped, so no deployed database has the old shape.Checked: see the verification comment for the run on this head.
TestCellsServeOnlyTheirOwnOrgspasses on SQLite and PostgreSQL 18.TestHostedBindForeignOrg,TestForeignOrg,TestCells,TestCellsAreSharedOnlyWhenSetandTestReplicaWithOtherCellsRefused(PostgreSQL), and the existing org, tenancy, restore and cross-org tests.Not checked:
Server.cells. LikeServer.tenancyandstaffOrg, it is test-only until K PR 7 wires multi startup.Decided for you:
422(as the MH9 step says) rather than the unknown-org answer. Every customer-facing way in does get the unknown-org answer.You need to: nothing.
multistays refused in release builds.Detail
backend/AGENTS.md(Cells);docs/CONFIGURATION.md; CHANGELOG.ApplyOrgrefuses to re-cache an org whoseforeign_orgsrevision is newer.ApplyForeignOrgdrops a cached row, but never adeletedtombstone, after its members' sessions are revoked as for a suspension.OrgCursorcountsforeign_orgs.ForgetRestoredclears it.TestTenancySyncAppliesEventsForAnUncachedOrgbecameTestTenancySyncWaitsForAnUncachedOrg.useTenancyservestestCell, andlisted()homes orgs there.KYPOST_TENANCY=multiin the environment also setKY_CELLS.🤖 Generated with Claude Code