fix(verify): multiTenant boot requests the isolated tenancy posture — ADR-0105 D1 - #3596
Merged
Conversation
… ADR-0105 D1 Since #3559 a walled posture is an explicit operator request resolved from env when AuthPlugin registers the `tenancy` service; mounting the enterprise organizations plugin only ENTITLES it. bootStack's multiTenant opt-in predates that split and only mounted the plugin, so multi-org fixtures silently booted `single` — no Layer 0 wall, default-org write stamping — and every cross-tenant proof asserted against the wrong posture. First surfaced by cloud's security-enterprise multi-org integration test (the licensed path open-core CI cannot run), which fails 3/4 against any framework checkout at or past #3559. bootStack({multiTenant: true}) now sets OS_TENANCY_POSTURE=isolated for the boot — before AuthPlugin snapshots the requested posture — unless the caller already provided one; the request is restored on stop() and on a failed multi-tenant boot, so later single-tenant boots in the same worker are unaffected. The verify package also gains a `test` script: `turbo run test` never ran its suite before, so the new posture regression pin (and the existing derive tests) now actually gate. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
Contributor
📓 Docs Drift CheckThis PR changes 1 package(s): 2 hand-written doc(s) reference the affected code and may need an implementation-accuracy re-verification:
|
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.
Root cause
Since #3559 (ADR-0105 Phase 0/1), a walled tenancy posture is an explicit operator request — resolved from
OS_TENANCY_POSTURE/OS_MULTI_ORG_ENABLEDwhen AuthPlugin registers thetenancyservice — and mounting the enterprise organizations plugin only entitles it (#3570, D12).bootStack'smultiTenant: trueopt-in predates that split: it mounted the plugin but requested nothing, so multi-org fixtures silently bootsingle— no Layer 0 wall, D3 default-org write stamping — and every cross-tenant proof asserts against the wrong posture.First surfaced by cloud's
security-enterprisemulti-org integration test (the licensed path open-core CI cannot run): 3/4 assertions fail against any framework checkout at or past #3559 — writes get stamped into the ADR-0081 default org (org_<ts><rand>) instead of the caller's active org, and an org admin's scopedviewAllRecordsgrant sees[]. Cloud CI stays green only because its.objectstack-shapin predates #3559 — any pin bump past #3559 without this fix turns cloud CI red.Fix
bootStack({ multiTenant: true })now setsOS_TENANCY_POSTURE=isolated(the postureOS_MULTI_ORG_ENABLED=truehistorically meant) before AuthPlugin snapshots the requested posture:OS_TENANCY_POSTUREalways wins;stop()and on a failed multi-tenant boot, so later single-tenant boots in the same worker are unaffected.The verify package also gains a
testscript —turbo run testnever ran its suite before (the existingderive.test.tswas dead weight in CI) — so the new regression pin actually gates.Verification
packages/verify: 7/7 pass (3 new posture-contract cases with a fakedorg-scopingentitlement surface + 4 existing derive cases), rebased on latestmain(post-feat(spec)!: shrink ApiMethod enum to the six primitives (#3543, P2 of #3391) #3581) with the chain rebuilt.multi-org-tenant-isolation.integration.test.tsrun against this branch's verify (temp alias, live@objectstack/organizationswith its D12 posture declaration): 4/4 pass with no external env — previously 3/4 failed. The Layer 0 fail-closed UPDATE denial logs confirm the wall is real.pnpm --filter @objectstack/verify lintreports 7 pre-existing "Definition for rule '@typescript-eslint/no-explicit-any' was not found" errors on a pristine checkout too (package-level lint config gap, untouched here).🤖 Generated with Claude Code