Establish the tenant GraphQL runtime boundary - #1654
Draft
yyyyaaa wants to merge 1 commit into
Draft
Conversation
This was referenced Aug 5, 2026
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.
Context
This is part 1 of 6 in the draft Graphile tenant-density stack. The goal is to serve more complete tenant GraphQL surfaces per GiB without weakening tenant isolation. Review and merge the stack from the bottom up:
This stack supersedes draft #1652 and deprecates the old #1330–#1335 production design. The useful plugin, cache, and harness work was retained, but the SQL-rewrite/blueprint-pooling design from #1333/#1334 was rejected: RLS filters rows after object routing, so it cannot prove that rewritten SQL, plugin SQL, metadata, functions, sequences, indexes, or prepared statements reached the correct tenant.
The replacement keeps one Graphile instance per exact physical tenant/API build contract. Density comes from reducing each dedicated instance's retained state and governing its lifecycle, not from sharing a canonical instance or rewriting SQL between tenants. BM25 remains enabled against physical schema-qualified indexes.
What this PR establishes
DISCARD ALL, clears node-postgres and Graphile prepared-statement bookkeeping, and destroys a client when reset fails.row_security, and a pinned allowlistedsearch_path.Security position
Hostnames and service keys are routing labels, never pool or build isolation keys. RLS remains defense in depth; this branch does not use RLS as proof of physical routing. Arbitrary caller plugins remain trusted process code and are denied by default in production later in the stack.
Validation
Why this remains a draft
This is a foundation, not a standalone production rollout. Runtime object/role admission, exact Graphile build identity, WebSocket admission, scoped introspection, and qualification evidence arrive later in the stack. The full candidate remains a production no-go until the atomic versioned route/security contract, production-schema policy proof, upstream Graphile review, complete tenant-density matrix, and long-duration churn soak are finished.