Skip to content

Latest commit

 

History

History
1791 lines (1429 loc) · 65.6 KB

MULTITENANCY.md

File metadata and controls

1791 lines (1429 loc) · 65.6 KB

Prisma Streams — Shared-Cell Multitenancy Implementation Plan

Status: FROZEN CONTRACT (Stage 0, committed 2026-08-15; revision 11, 2026-10-15 — see Revision log) Author: Søren Bramer Schmidt (implementation plan, delivered 2026-08-15) Target: Many projects in each Prisma Streams cell Migration posture: Clean layout switch; no mixed-layout operation

Repo anchors: the current single-tenant layout constant lives in src/registry.rs (LAYOUT_VERSION); stream-name canonicalization in src/product.rs (canonical_name). The conversion inventory for Stages 2–4 is maintained in docs/MULTITENANCY-MAP.md. The tenancy decision record is in docs/READINESS.md. Changes to THIS document after Stage 0 require an explicit contract-revision commit — it is the arbiter when implementation questions arise.

Operational companion: the Control Plane / Auth / gateway / Console integration contract lives in docs/CONTROL-PLANE-INTEGRATION.md (proposed r1) — §3 credentials, §7.1 feeds, §8 gateway, §12 transfer, and the Stage 1/5 checklists below defer to it for platform-side mechanics.

Revision log

  • r1 (2026-08-15): added the route-child-v1 domain for split-child placement (the conversion map found scaler split-child routes uncovered by the original five domains); froze the ProjectId/WorkspaceId/cell-id grammar; replaced ambiguous empty-prefix-set semantics with the explicit StreamGrant type.
  • r2 (2026-08-16, commit fe9f6a37): §10.4.1 _audit_events semantics (journal scope, verified-identity rule, at-least-once delivery, keyless availability). This log entry was recorded late, with r3 — the revision itself landed as its own contract-revision commit.
  • r3 (2026-08-18): §14.3 raw-surface trust boundary — the raw Durable Streams surface is INTERNAL-ONLY for shared-cell GA (fleet identity under enforce; no public raw carve-out; product-only forks). Closes the raw-surface principal follow-up recorded in §6.1. §14.1 marked the workload-JWT path live with the static token as a bridge; §14.2 recorded the implemented operator bearer gate.
  • r4 (2026-08-19, second review round): §14.1 operation-scoped workload authority IMPLEMENTED inbound and outbound (eight typed operations; empty/unknown claims grant nothing; FLEET_AUTH_MODE static|workload with static refused under the release posture); §4.5 omission tombstones + version-pins-bytes fingerprints on both feeds; §7.1/§15 capability freshness parity (stale policy fails capability waits CLOSED); §17.3 max_streams, queued_append_bytes, and capability-wait subscription accounting enforced.
  • r5 (2026-08-19, round 3): §4.5 extended — per-feed GENERATION DIGESTS (the same generation always carries the same canonical digest, all three feeds) and the JWKS lifecycle (a kid names one algorithm and one key forever; omission retires it permanently; rotation is an old+new overlap generation). §14.1: the delegated target-bound mutation capability is FORMALLY DEFERRED past shared-cell GA with the recorded threat-model rationale — an explicit decision, revisitable, not an omission.
  • r6 (2026-10-02, the owner's decision of that day): §14.1's operation vocabulary names the ten operations the cell enforces, adding segment-close (the segment-close relay, live since 2026-08-22, which r4's list of eight omitted) and seal-fence (the fleet-internal seal fence relay of 433b60e5 and 82a14a8f, edge records #88 and #89). The platform contract (contracts/streams-platform/v1/workload-token-claims.schema.json) and the reference emulator name both since 89011daa (edge record #90).
  • r7 (2026-10-07, shared-cells H6; accepted by the owner on 2026-10-08, docs/reviews/2026-09-hardening/README.md row "Shared cells Q8"): §4.5 and §14.1 — the keys feed pins every kid to ONE token audience (aud: prisma-streams-data or prisma-streams-internal, required; contracts/streams-platform/v1/keys.schema.json). A token verifies only under a kid pinned to its verifier's audience, so the customer issuer's key can no longer mint a workload token for the internal surface, nor a fleet key a customer token. A kid keeps its audience for life. §15 (shared-cells M5): under enforce, a watch request that carries a capability must verify it; a stream key observes only beside a verified principal.
  • r8 (2026-10-11, the owner's public-beta decisions; docs/reviews/2026-09-hardening/README.md row "Public beta (decided 2026-10-11)"): Stage 8 and §20 — the external security review is not required for the public beta. Asked "Whether the external security review is required or waived", the owner answered "not required". An amendment, not a deletion: Stage 8's item and §20's criterion stay as written for shared-cell GA, and each carries a note; nothing else in the contract changes.
  • r9 (2026-10-13, the stored-bytes quota; decided by the owner on 2026-10-12 in the public-beta calls X3 and S1, and ratified at landing under his X2, edge change #156): §17.3 — the policy feed's quotas carries max_stored_bytes, the stored bytes a project may own (contracts/streams-platform/v1/container-policies.schema.json stays v1: the field is additive and optional). A 0 or absent value takes the cell's CONTAINER_STORED_BYTES_DEFAULT at any k (default 0, no limit; the shipped profiles set 0 too since edge change #244, storage unlimited; they set 10 GiB before). Unknown quota keys still refuse the whole feed, so a binary before r9 refuses one carrying the field: deploy the binary first, then bundles that carry it. A project at its quota is refused new appends 429 stored_bytes_limit (edge change #158).
  • r10 (2026-10-15, the free tier's burst; decided by the owner in the round-5 public-beta calls, call 1, docs/reviews/2026-09-hardening/README.md row "Public-beta calls, round 6 (decided 2026-10-15)"; edge change #162): §17.3 — a project's request bucket holds max(requests_per_sec, 50) tokens and refills at requests_per_sec, so below 50 a second a project is admitted 50 requests at once and then its rate; at 50 or more nothing changes. The store budget keeps one second's rate, and the debt a concurrent burst of registry writes leaves grows with the burst (at 10 a second about 54 s after 50 creates). The policy contract is unchanged: requests_per_sec is still the rate, and its description names the burst.
  • r11 (2026-10-15, the first create after a boot; decided by the owner in the round-5 public-beta calls, call 2, the same README row; edge change #143 as amended): §17.3 — a create's stream-count seed walk (the catalog walk a project with a max_streams quota makes on its first create since the instance booted) is charged to no project once it completes, the one exception to "a verified request pays for the registry store work its own task makes". So every served create weighs its own work, 11 for a fresh one, however many names the project has held; a walk that fails stays charged. The cell pays the completed walks, once per project per boot.

1. Locked architectural decisions

1.1 Stable and mutable identity

The stable data identity is:

project_id
+ stream_name
+ stream_epoch

The mutable authorization identity is:

project_id (the container, edge #253)
+ generation

Consequences:

  • project_id appears in registry paths, route hashes, storage hashes, segment identities, cursors, consumer state, usage rows, and internal RPC targets.
  • The workspace appears in no storage identity, no feed and no token: it is the Control Plane's owner link (edge #253). Moving a container between workspaces is not supported (owner decision, 2026-11-08).
  • "Account" is reserved for external login identity and is not used as the Streams tenant type.

1.2 One access token authorizes exactly one project

Every Streams access token authorizes exactly one project.

Do not say "a user receives one token per project." Users, CI systems, and service accounts may hold several credentials, but each resulting access token has one project_id.

Human sessions, Management API tokens, and general workspace integration tokens are never accepted directly by the Streams data plane.

1.3 Fixed project-to-cell placement

A project has one active cell_id.

Workspace transfer does not move the project between cells. Project-to-cell migration is a separate future protocol and is not part of the first shared-cell GA.

1.4 Same-project references for GA

These remain project-local:

  • forks;
  • consumer DLQs;
  • workflow-style parent/child references;
  • watch capabilities;
  • catalog cursors;
  • stream usage lookups.

Cross-project references are rejected before any lifecycle intent or durable debt is created.

1.5 Clean layout generation

Introduce a new layout version and fresh namespaces.

pub const LAYOUT_VERSION: u32 = 4;

Do not add a compatibility reader for the current project-global/name-global layout. Preview data that must survive is exported and reimported with an explicit project_id.


2. Core identity types

Create src/tenant.rs.

use std::sync::Arc;

#[derive(Clone, Debug, Eq, PartialEq, Hash)]
pub struct WorkspaceId(Arc<str>);

#[derive(Clone, Debug, Eq, PartialEq, Hash)]
pub struct ProjectId(Arc<str>);

#[derive(Clone, Debug, Eq, PartialEq, Hash)]
pub struct TenantStreamRef {
    pub project_id: ProjectId,
    pub name: Arc<str>,
}

WorkspaceId exists in authorization, policy, audit, and billing. It does not belong in TenantStreamRef.

Use validated constructors:

workspace ID: 1–128 bytes
project ID:   1–128 bytes
cell ID:      1–128 bytes
stream name:  existing canonical stream-name rules

Frozen grammar (r1) for workspace, project, and cell ids — a strict ASCII allowlist until a shared Control Plane parser exists, at which point the shared parser supersedes it (it may only tighten, never widen, this grammar):

id      = 1*128( ALPHA / DIGIT / "_" / "-" )

Unicode whitespace, bidi controls, zero-width characters, and every byte outside the allowlist are rejected at construction.

2.1 Canonical binary encoding

Do not concatenate identities with delimiters.

fn append_component(out: &mut Vec<u8>, value: &[u8]) {
    out.extend_from_slice(&(value.len() as u32).to_be_bytes());
    out.extend_from_slice(value);
}

Domain-separate all hashes:

route-v1
route-child-v1
storage-v1
segment-v1
catalog-cursor-v1
watch-capability-v1

Hash inputs:

route hash:
  route-v1 + project_id + stream_name

storage hash:
  storage-v1 + project_id + stream_name + stream_epoch

segment identity:
  segment-v1 + project_id + stream_name + stream_epoch + segment_id

split-child route hash (r1; scaler-minted placement of a child segment):
  route-child-v1 + project_id + stream_name + child_segment_id + salt

Workspace transfer must not change any of these values.


3. Durable Streams credentials

Add a Control Plane model:

StreamsCredential

Recommended fields:

id
project_id
workspace_id_at_creation       // audit only, not authoritative ownership
display_name
secret_hash or public_key
scope
stream_prefixes
grant_version
status
expires_at
created_by_user_id
created_at
updated_at
last_used_at
value_hint

Suggested statuses:

active
disabled
revoked
expired

3.1 Credential management

Creation, rotation, listing, and revocation belong in the Management API and Console.

The Control Plane actor must:

  1. be authenticated through the existing Control Plane model;
  2. have access to the project's current workspace;
  3. have permission to manage Streams credentials.

Recommended initial role policy:

workspace admin:      allowed
workspace developer:  allowed
workspace viewer:     denied
workspace accountant: denied

This policy should be explicit and independently changeable from Streams data-plane scopes.

3.2 Secret presentation

A credential secret is shown once.

Suggested format:

prisma_streams_<credential-id>.<secret>

Store only:

  • credential metadata;
  • a secure secret hash or public key;
  • a short value hint.

Do not store recoverable plaintext secrets.

3.3 Token exchange

The durable credential is exchanged with Prisma Auth for a short-lived Streams access token.

POST /v1/token/streams
Authorization: StreamsCredential <durable-secret>

The exchange service:

  1. resolves the credential;
  2. verifies its secret;
  3. verifies that the credential is active;
  4. loads the current project policy;
  5. verifies the project's current workspace ownership;
  6. mints a 10–15 minute access token;
  7. updates last_used_at asynchronously.

The Streams cell never receives the durable credential secret.


4. Versioning model

Use three distinct versions.

4.1 policy_version

Changes whenever project placement, status, quota, or policy data changes.

It is used for:

  • cache ordering;
  • observability;
  • stale-policy detection.

A token does not authorize against an older policy. The cell always applies the newest locally cached quota and status.

4.2 generation

Changes when the Control Plane invalidates every token of the container at once.

A request requires:

token.generation
==
cached_project.generation

This invalidates every older-generation access token as soon as the new policy reaches the cell.

4.3 grant_version

Stored on StreamsCredential.

It changes whenever:

  • scopes change;
  • prefixes change;
  • credential status changes;
  • credential is rotated or revoked.

A request requires:

token.grant_version
==
cached_credential.grant_version
and
cached_credential.status == active

Do not authorize with:

token.policy_version <= cached.policy_version

That would allow an older token to retain a permission removed by a newer policy.

4.4 Revocation identity

Revocation primarily targets:

credential_id

jti remains useful for audit and exceptional single-token revocation, but the system should not require publishing every short-lived token issuance.


4.5 Omission tombstones and version fingerprints (revision r4)

The feeds publish FULL snapshots. Two publisher defects are refused at the cell (r4, implemented in publish_policies/publish_grants; ALL checks run before ANY mutation):

  • Omission is a tombstone. An entry present in the current snapshot but absent from the incoming one is tombstoned at its last observed version. Reintroducing it requires a STRICTLY newer version (credentials: grant_version; projects: either of the version pair). A replayed pre-omission snapshot cannot resurrect a removed credential or project.
  • A version pins bytes. Each (id, version) carries a semantic fingerprint; an EQUAL version with different content — scopes widened at the same grant_version, Suspended -> Active at the same policy version — is refused. Identical replay stays accepted (feeds are at-least-once).

Generation digests (r5). Each feed's generation pins its CANONICAL DIGEST: publishing the same feed_version with different content — including an entry ADDED under an already-published generation, which per-ID checks cannot see — is refused. Identical replay stays accepted.

JWKS lifecycle (r5, audience r7; implemented in publish_jwks). A kid names ONE algorithm, ONE public key and ONE audience forever (the fingerprint of its material and audience is captured at parse, so re-pinning a kid is refused like rebinding it); once omitted from a full snapshot a kid is RETIRED and never returns at any later generation; rotation publishes an overlap generation carrying old and new keys, and the old key is removed only after the maximum token lifetime plus propagation margin (docs/CONTROL-PLANE-INTEGRATION.md §7.5).

The retained table is PROCESS-LOCAL and bounded (65,536/kind FIFO): the durable security guarantee is the Control-Plane feed contract itself; this mechanism is defense in depth against a misbehaving publisher within one process lifetime, and a restart deliberately resets it.


5. Access-token contract

Use an OAuth-compatible string scope claim.

Illustrative token:

{
  "iss": "https://auth.prisma.io",
  "aud": "prisma-streams-data",
  "sub": "service-account-or-user-id",
  "credential_id": "strcred_123",
  "container_id": "proj_456",
  "cell_id": "fra-cell-07",
  "generation": 12,
  "grant_version": 7,
  "scope": "streams.records.read streams.records.append streams.metadata.read",
  "stream_prefixes": ["customers/acme"],
  "jti": "tok_...",
  "iat": 1786600000,
  "nbf": 1786600000,
  "exp": 1786600900
}

Recommended constraints:

default token lifetime:   10–15 minutes
maximum token lifetime:   24 hours
clock skew:               30 seconds
maximum token size:       8 KiB
kid required:             yes
algorithm allowlist:      explicit

The issuer intersects requested scopes and prefixes with the durable credential grant. The client cannot self-assert broader access.


6. Scope contract

Avoid broad scopes such as STREAM_MANAGE and CONSUMER_USE.

Use explicit scopes:

streams.metadata.read
streams.records.read
streams.records.append
streams.create
streams.lifecycle.manage
streams.consumers.pull
streams.consumers.settle
streams.consumers.configure
streams.forks.create
streams.dlq.configure
streams.watches.manage
streams.catalog.read
streams.usage.read

6.1 Route and method matrix

Operation Required scope
Read stream metadata streams.metadata.read
Read/scan/SSE records streams.records.read
Append/appendMany streams.records.append
Create/recreate stream streams.create
Seal/delete/update lifecycle streams.lifecycle.manage
Seal with a final record streams.lifecycle.manage and streams.records.append
Consumer pull streams.consumers.pull
Consumer settle streams.consumers.settle
Create/update/delete consumer streams.consumers.configure
Create fork streams.forks.create
Configure DLQ streams.dlq.configure
Create watch (create body) streams.watches.manage
List project streams streams.catalog.read
Read stream usage streams.usage.read
Read project usage totals streams.usage.read and an unrestricted stream grant

The gate authorizes the scope of the product operation a request names (ProductOperation, src/product/operation.rs), and the product entry dispatches exactly those operations. A request that names none, such as an unknown collection operation or a method a resource does not serve, demands no scope. It is still authenticated and prefix-checked (§9 steps 2-3) and is then refused by route: 404 unknown_route or 405 method_not_allowed, never 403 missing_scope. With no scope to check it also passes project admission, the POST memory backstop, the reserved-name guard (403 reserved_stream for a _-prefixed name) and, for POST and PUT, body buffering (§9 steps 5-6) before that refusal. The product surface serves no HEAD on records and no watch delete: until item 73 (D1) a credential without streams.records.read or streams.watches.manage got 403 missing_scope for them from a fallback matrix; it now gets 405. Non-GET watch waits never demanded a scope, so any authenticated credential of the project already reached admission and body buffering through them before item 73.

Fork creation must authorize:

read access to source
+
create access to destination
+
streams.forks.create

DLQ configuration must authorize the source consumer and destination stream independently.

Stage 5c (body-visible scopes) — status. The request gate sees only route + method + query, so scopes that depend on the request BODY are enforced where the body is parsed. The gate now returns the verified RequestPrincipal and the entry threads it to handlers:

  • watch creation → streams.watches.manage — ENFORCED in product_create (watch definitions ride the PUT create body; streams.create alone no longer attaches them);
  • DLQ configuration → streams.dlq.configure — ENFORCED in product_consumer_put beside consumers.configure;
  • fork creation → streams.forks.create + read on the source — RESOLVED by r3 (§14.3): fork creation exists only on the raw surface, and the raw surface is internal-only under enforce, so fork creation is not a customer operation at shared-cell GA. The compound rule stays RESERVED for a future product-surface fork exposure — the only path by which forks may become customer-facing.

The watch-observation route now returns ONE refusal (watch_unauthorized) for every no-valid-capability shape — missing stream, deleted stream, forged/expired capability — so the token-free §15 route is not a stream-existence oracle; existence-revealing answers (creating, unknown watch) come only after the capability or key verifies. Stage 5d (review item 1) LANDED: the verified principal's project selects the tenant-qualified storage identity on the whole product surface — handlers, the shared append/read cores, seal machinery (TenantStreamRef-keyed), catalog, usage, descriptors born into the request's project — and the principal.project == cell tenant bridge is DELETED. Off/shadow requests and §15 capability carriers address the deployment tenant (single-tenant posture; the capability wire gains the project in review item 3). Raw Durable Streams routes still address the deployment tenant — under enforce behind FLEET identity per §14.3 (r3): the raw surface is internal-only and the raw-surface principal question is CLOSED. CONTAINER_ID must be explicitly non-default in shadow/enforce.

6.2 Prefix grants

Prefix grants are normalized when the credential is created.

Limits should include:

maximum prefix count
maximum prefix length
canonical component separators
no empty or overlapping redundant prefixes

Grant semantics (r1): a credential's stream grant is an explicit type, never an overloaded empty set —

enum StreamGrant {
    All,
    Prefixes(Arc<[CanonicalPrefix]>),
}

In the access token, an ABSENT stream_prefixes claim means StreamGrant::All (every stream in the project, subject to scopes). An empty stream_prefixes array is INVALID and the token is rejected: "no streams" is expressed by not issuing the credential, and an empty array is far more likely to be an issuer bug than an intent.

Prefix matching is component-aware:

grant: customers/acme

matches:
  customers/acme
  customers/acme/orders

does not match:
  customers/acme-other

7. Data-plane authentication

Create src/auth.rs.

pub struct RequestPrincipal {
    pub project_id: ProjectId,
    pub cell_id: Arc<str>,
    pub credential_id: Arc<str>,
    pub subject: Arc<str>,
    pub ownership_version: u64,
    pub grant_version: u64,
    pub scopes: ScopeSet,
    pub stream_prefixes: Arc<[CanonicalPrefix]>,
    pub token_id: Arc<str>,
    pub issued_at: i64,
    pub expires_at: i64,
}

7.1 Local verification only

pub struct AuthService {
    issuer: String,
    audience: String,
    cell_id: String,
    jwks: ArcSwap<JwksSnapshot>,
    projects: ArcSwap<ProjectPolicySnapshot>,
    credentials: ArcSwap<CredentialGrantSnapshot>,
    last_jwks_refresh: AtomicI64,
    last_policy_refresh: AtomicI64,
}

No request performs a synchronous Control Plane lookup.

Background refresh:

JWKS:              every 5 minutes
project policy:    streaming or every 30–60 seconds
credential grants: streaming or every 30–60 seconds
unknown kid:       asynchronous rate-limited refresh

A request fails closed when:

  • JWT signature or claims are invalid;
  • generation differs;
  • grant_version differs;
  • credential is inactive;
  • project is suspended/deleting/deleted;
  • policy or credential data is unavailable beyond the accepted staleness window.

8. Gateway verification and routing

The gateway must verify the JWT before using any token claim for:

  • destination-cell selection;
  • quota partitioning;
  • rate-limit buckets;
  • internal target URLs.

Correct gateway sequence:

verify signature and standard claims
→ read verified project_id
→ resolve current project placement
→ apply workspace/project quota
→ route to assigned cell

The cell repeats token and policy validation.

8.1 Wrong-cell behavior

A valid token sent to the wrong cell is not an authentication failure.

Preferred behavior:

gateway reroutes internally

Fallback cell response:

421 Misdirected Request
Prisma-Error-Code: wrong_cell

or a retryable 503 wrong_cell.

Do not return 401; that would cause clients to refresh a perfectly valid credential.


9. Request pipeline

The cell request path is:

1. Parse the exact route and method.
2. Authenticate the customer, internal, operator, or watch capability.
3. Authorize scope and canonical prefix.
4. Load current project and credential policy from local memory.
5. Apply workspace/project concurrency backstops.
6. Enforce request body limits.
7. Construct TenantStreamRef(project_id, name).
8. Load the tenant-qualified descriptor.
9. Validate customer-held stream key where required.
10. Resolve routing key and exact physical segment.
11. Resolve ownership; non-owner returns replay.
12. Apply stream, shard, and cell safety limits.
13. Execute.
14. Meter and audit against project/workspace identity.

Authentication must occur before:

  • body buffering or draining;
  • tarpit work;
  • object-store access;
  • registry lookup;
  • existence-revealing responses.

Handlers receive:

Extension(principal): Extension<RequestPrincipal>

and operate on TenantStreamRef, not bare names.


10. Tenant-qualified storage layout

10.1 Registry

Use:

registry/v5/containers/
  <project-id-hex>/
  streams/
  <name-hex>.json

Registry cache keys become:

TenantStreamRef

Registry APIs accept project-qualified identities:

get(&TenantStreamRef)
create(StreamDesc)
update(&TenantStreamRef, ...)
mutate_incarnation(&TenantStreamRef, ...)
list_page(&ProjectId, after, limit)
reconciliation_page(after, limit)   // cell-wide, terminals included; billing closure only

After decoding, verify:

descriptor.project_id == registry path project
descriptor.name == registry path name

Mismatch means corruption.

10.2 Descriptor

Make project_id mandatory:

pub project_id: ProjectId;

Do not persist mutable workspace_id in the immutable stream descriptor.

Remove all deployment-global tenant fallbacks.

10.3 Catalog and cursors

Project catalog scans only:

registry/v5/containers/<project>/streams/

Catalog cursors bind:

project_id
last_name
cursor_version

A cursor reused in another project returns invalid_cursor.

10.4 System resources

System streams live outside customer projects:

system/v1/cells/<cell-id>/

This includes:

_usage
_ops_events
_ops_metrics
_audit_events

Only internal workload identity may construct or access these resources.

10.4.1 _audit_events semantics (revision, Stage 7)

  • Scope. The journal records enforce-mode denials of the caller: token verification failures (401), verified-but-denied authorization (403 — scope, prefix, suspension, key mismatch, capability refusals, cross-project usage probes), quota refusals (§17.3), and reserved-name refusals. It deliberately excludes wrong_cell (421 is placement per §8.1 — the credential is fine) and the cell's own feed-staleness 503s (§7.1) — neither is a denial of the caller, and journaling them would let placement churn or a feed outage evict real security events from the bounded queue.
  • Identity. project_id on an event is filled only from a verified principal. An unverified token's claims never reach the journal as identity; unauthenticated denials journal without a project.
  • Unverified denials (shared-cells M6, phase B step 14(a); edge change #142, ratified 2026-10-13 under the owner's round-3 call 5). A denial with no verified principal never journals as its own event: each is counted by code and status, and every drain attempt queues one aggregate event per (code, status) before its batch: no project_id, the drain's time, count, the number of denials it stands for (the field is absent on every other event), and as a sample the route (bounded as any event's) and method of the first of those denials since the previous attempt. The sample is exact when count is 1; under a flood it is whichever request came first, so the attacker chooses it. A drain whose _audit_events append fails requeues its batch, aggregates included. An anonymous flood thus holds no place of the queue but its aggregates: while appends succeed, verified denials keep at least 4,096 - k places (k pairs, typically one); while they fail, each attempt adds k aggregates, so one pair fills the queue in about 4,096 attempts (about 9 h at the default 8 s), not minutes. The counts hold one sample per pair. An aggregate the full queue cannot take is lost as count denials in audit_events_dropped_total and the next audit_gap marker.
  • Delivery. The journal is at-least-once: an ambiguous append (timeout/408 after commit, relay response lost) is retried, so the same event can land twice. Every event carries a unique event_id; consumers MUST deduplicate by it. Queue overflow is recorded by audit_gap marker events whose dropped field carries the exact loss.
  • Availability. The journal requires the system ledger key. A cell running enforce without one still refuses correctly but journals nothing; denials are counted in audit_events_dropped_total and the condition is warned at boot.

11. Project policy

Create src/project_policy.rs.

pub enum ProjectStatus {
    Active,
    Suspended,
    Deleting,
    Deleted,
}

pub struct ProjectPolicy {
    pub project_id: ProjectId,
    pub cell_id: Arc<str>,
    pub project_policy_version: u64, // feed field `policy_version`
    pub ownership_version: u64,      // feed field `generation`
    pub status: ProjectStatus,
    pub quotas: ProjectQuotas,
}

Credential grants are a separate cache:

pub struct CredentialGrant {
    pub credential_id: CredentialId,
    pub project_id: ProjectId,
    pub grant_version: u64,
    pub status: CredentialStatus,
    pub scopes: ScopeSet,
    pub prefixes: Arc<[CanonicalPrefix]>,
    pub expires_at: Option<i64>,
}

The data plane knows no workspace: neither credentials nor policies carry one (edge #253).


12. Moving a container between workspaces

Not supported (owner decision, 2026-11-08). Usage names the container alone and records no workspace (edge #253), so nothing in Streams needs a transfer protocol: the Control Plane keeps each container's workspace link and its history, and Console splits invoices by it. To invalidate every token of a container, the Control Plane increments its generation and publishes the policy. A container's registry paths, route hashes, storage hashes, stream epochs and segment identities never change.

13. Control Plane permissions versus Streams permissions

These are separate decisions.

Control Plane decision

May this actor create, rotate, or revoke a Streams credential for project P?

This uses:

  • live user or service identity;
  • live workspace membership;
  • live project-to-workspace relation;
  • Control Plane role.

Streams decision

What may credential C do inside project P?

This uses:

  • credential scope;
  • prefixes;
  • grant version;
  • project status;
  • project quotas.

Do not encode workspace roles such as admin or developer into Streams access tokens.


14. Internal and operator authentication

14.1 Fleet identity

Do not use a permanent shared FLEET_INTERNAL_TOKEN for GA.

Use short-lived workload JWTs or Compute workload identity:

{
  "aud": "prisma-streams-internal",
  "sub": "slot-or-instance-id",
  "cell_id": "fra-cell-07",
  "deployment_digest": "sha256:...",
  "operations": ["segment-read", "segment-scan"],
  "exp": 1786600300
}

For sensitive mutation operations, issue a short-lived delegated capability bound to:

method
project ID
stream name
stream epoch
segment identity
operation ID
expiry

Status (r4, vocabulary r6). The workload-JWT verifier is LIVE and its operations claim is ENFORCED per route. The operation vocabulary:

raw-read  raw-append  raw-lifecycle  segment-read  segment-close
seal-fence  segment-scan  queue-cursor  consumer-sweep  telemetry-append

Rules (implemented, fleet_operation_authorized): an EMPTY or UNKNOWN operations list grants nothing; every internal route demands one exact operation; the raw surface derives its operation from the method (PUT/DELETE -> raw-lifecycle, POST -> raw-append, GET/HEAD -> raw-read; /v1/segments -> segment-read; /v1/internal/segment-close -> segment-close; /v1/internal/seal-fence -> seal-fence). A workload token is never a cell-wide credential.

Trust roots (r7). Customer and workload tokens share one keys feed but never a key: the feed pins each kid to one audience, and verify_customer / verify_internal accept only kids pinned to their own (src/auth/signing_key.rs). Before r7 any kid in the feed verified both, so whoever held the customer signing key also held every project's internal lifecycle on the cell.

OUTBOUND, the cell presents workload identity itself: relays draw their bearer from a refreshing token source (WORKLOAD_TOKEN_FILE, platform-rotated, expiry-aware cache) and a peer 401 forces exactly one refresh-and-retry. FLEET_AUTH_MODE names the postures: static is the legacy bridge (full authority, boot WARNING, REFUSED under STREAMS_RELEASE_POSTURE=1); workload runs with no static token at all. The platform leg is minting the JWTs into the file; the cell no longer needs code changes to drop the static token.

Delegated target-bound capabilities: DEFERRED past shared-cell GA (r5, round-3 disposition). The rationale, recorded so this is a decision and not an omission: operation scoping already confines a workload token to one operation class; the token is cell-bound, short-lived (≤5 min), and minted per instance by the platform; and the operations in scope act on internal maintenance state whose blast radius is availability within one cell, not cross-project data disclosure (customer reads/writes always re-verify project identity at the descriptor). Target-bound capabilities (§14.1 shape: op + project + stream + epoch + segment + operation id + expiry) become REQUIRED when any internal operation can mutate customer-visible data across project boundaries, and land with the platform's delegated-capability issuer. Revisit at the external security review; Søren can veto this deferral.

14.2 Operator identity

Operator/debug access requires:

  • human or service identity;
  • explicit operator role;
  • short expiry;
  • complete audit.

Customer tokens cannot access /v1/debug/*, and operator credentials cannot read customer record payloads unless a separately audited break-glass role permits it.

Status (r3). The /v1/debug/* operator surface is bearer-gated in every auth mode (SR-5): the deployment bearer is required — with no bearer configured only Off mode leaves it open, the sole survivor of the retired allow-if-unset posture. Customer JWTs are never accepted on it. Role separation, short expiry, and complete audit remain platform-leg items; the payload remains restricted (no customer record payloads) regardless of who authenticates.

14.3 Raw-surface trust boundary (revision r3)

Decision (r3): the raw Durable Streams surface is INTERNAL-ONLY for shared-cell GA. The product surface (§6) is the only public customer surface. There is no public raw-compatibility carve-out — a deployment-global bearer surface would bypass the per-project principal, admission, and audit machinery and cannot be tenant-safe in a shared cell. If public raw compatibility ever becomes mandatory, it must get the full principal treatment, not a carve-out.

Mode matrix (implemented, raw_surface_authorized):

  • Off — deployment bearer; with no bearer configured the surface is open. Single-tenant posture, unchanged. Allow-if-unset survives ONLY here.
  • Shadow — the configured deployment bearer is REQUIRED. Customer JWTs are tallied by the shadow observation counters but do not authorize raw routes.
  • Enforce — fleet identity only: the static internal token (bridge, §14.1) or a workload JWT. Customer tokens and the deployment bearer are never accepted. Raw routes always address the deployment tenant; the raw adapters are the ONLY sanctioned scope for AppState::sref (the identity-preservation rule's single carve-out).

Consequences:

  • Forks are internal-only at GA — fork creation exists only on the raw surface (§6.1). Any future customer-facing fork MUST land on the product surface under the reserved compound rule (streams.forks.create + read on the source): product-only forks. The raw surface never gains a customer principal.
  • /v1/segments and the raw read/entry adapters sit behind the same gate: fleet identity under enforce.
  • The platform leg must serve the raw surface to internal callers only (private listener / workload-identity mesh); public exposure of the raw listener is a release blocker. The cell-side gate is defense in depth, not a substitute for network separation.

15. Watch capabilities

Treat watch capabilities as bearer credentials.

Preferred browser/client API:

Authorization: Prisma-Watch <capability>

Use fetch-based streaming rather than URL credentials where possible.

If EventSource compatibility requires a URL capability, use a short-lived query parameter—not a path component—with:

maximum lifetime: 5 minutes
Cache-Control: no-store
Referrer-Policy: no-referrer
strict log/trace redaction
exact audience and HTTP-method binding
project, stream epoch, watch, and expiry binding

A watch capability includes the stable project_id; it does not depend on the current workspace.

Freshness (r4). Capability authorization carries the SAME policy freshness contract as customer JWTs (§7.1): a policy snapshot older than the staleness window fails the wait CLOSED with a retryable 503 (policy_stale) — never service on a stale Active. Capability waits also occupy the project's live-subscription pool for their whole duration (§17.3): watches have no side door around the ceiling.

Carrier proof (r7, shared-cells M5). A request that carries a capability skips the token gate, so under enforce the capability itself must verify. A stream key proves record access only: it observes beside a verified principal, never in place of a capability that failed (a garbage capability plus a learned key used to observe with no token, past revocation). Off and shadow modes were unchanged by r7; since phase B step 15 (below) a capability that does not verify is refused there too, the key beside it notwithstanding.

Anonymous lookups (shared-cells M2, phase B step 15). A capability names its project before anything verifies it, so the claim spends nothing another tenant needs. Under enforce, a claim naming a project a fresh feed does not place on this cell is refused before any read. Otherwise the capability is checked against the descriptor the cell already holds, without claiming, touching or filling a cache slot; only when nothing current is held does one store lookup run, which publishes nothing and spends the claimed project's budget (20 a second, 40 at most) and the server's (100 a second, 200 at most). A spent budget answers a retryable 429 watch_lookup_busy with Retry-After: 1 that names no project (owner decision P2 of 2026-10-12), so honest watchers reconnecting together after a restart wait and retry instead of failing for good. Only a carrier that verified reads through the descriptor cache, and its proof and wait use what that read returns. A stale feed spends the server's budget only, and the verified carrier then fails closed as above. Off and shadow modes take the same path with the server's budget only: there the claim is checked before the key, so a capability that does not verify is refused even beside the stream key, which alone still observes.


16. Internal RPC targets

Every internal operation carries:

pub struct InternalStreamTarget {
    pub project_id: ProjectId,
    pub stream_name: String,
    pub stream_epoch: String,
    pub segment_id: u32,
    pub segment_identity: [u8; 16],
}

The receiver:

  1. verifies workload identity;
  2. verifies delegated operation capability where required;
  3. loads the project-qualified registry object;
  4. verifies project, epoch, segment, and segment identity;
  5. performs the operation.

Apply this to:

  • segment reads;
  • scans;
  • consumer cursor probes;
  • consumer deletion fan-out;
  • lifecycle cleanup;
  • telemetry operations.

Workspace ID is not part of the physical target.


17. Quotas and noisy-neighbor isolation

17.1 Quota levels

cell safety
workspace quota
project quota
project concurrency
stream quota
shard maintenance

17.2 Gateway quotas

After verifying the token, consistently assign each project to one quota-router partition.

Enforce:

workspace request rate
workspace ingest/read volume
project request rate
project append bytes and records
project read bytes
queue operations
subscriptions

The gateway uses the current project policy, not unverified claims.

17.3 Server backstops

Each instance maintains bounded project admission:

ProjectAdmission {
    inflight_requests,
    buffered_body_bytes,
    queued_append_bytes,
    live_subscriptions,
}

Acquire project capacity before reading the request body.

Reject only the offending project:

429 container_rate_limit
429 container_concurrency_limit
503 container_tracker_capacity

Never merge unrelated projects into one overflow token bucket.

Request rate (edge change #162; the owner's round-5 call 1 of 2026-10-15). Each verified request takes one token of its project's request bucket, which starts full, refills at requests_per_sec and holds max(requests_per_sec, 50) tokens (REQUEST_BURST_FLOOR, src/quota.rs): below 50 a second a project is admitted 50 requests at once and then its rate (at the free tier's 10, 50 and then 10 a second), and at 50 or more one second's rate. An SDK app's delivered append costs 1, plus 2 for each consumer group (its pull and its settle), plus 1 for each long-poll subscriber, all within about 60 ms, so one second's burst (10) refused SDK consumer apps at about a tenth of the published rate. The other buckets (append bytes and records, read bytes, the store budget below) hold one second's rate.

Enforced ceilings (r4). Beyond the rate/volume buckets, three declared quotas are live:

  • max_streams — reserved race-safely at CREATE (losers of a concurrent burst refuse typed); the count seeds lazily from the catalog (alive non-child descriptors); soft-deleted fork-retained sources still count and release only at their terminal hard delete.
  • queued_append_bytes — the request body is charged to the project BEFORE the committer sees it and released when the append DECIDES.
  • max_live_subscriptions — SSE subscriptions AND capability watch waits draw from the same pool.

Weights (layout 6A package 1; edge change #196). A policy's quotas may carry request_weight and byte_weight (0 or absent: 1). On a cell shared k ways a project's ceiling on the request axes (requests_per_sec, max_inflight_requests, max_live_subscriptions, max_streams) is ⌊bound × request_weight ÷ k⌋ and on the byte rates (append_bytes_per_sec, read_bytes_per_sec) ⌊bound × byte_weight ÷ k⌋; queued_append_bytes stays ⌊bound ÷ k⌋, a committer burst buffer a heavy project's share would take past the shard's line. The cell holds each weight to 1..k-1 (a higher value is held and warned in the log), so the unit-weight projects keep at least one k-th of every bound, and the admission tool (deploy/cell-admin, edge change #199) packs projects so the weights above 1 on each axis sum to at most k - 1; k is the cell's weight budget, unit = one default project, and weight 1 everywhere is the equal share. A dedicated cell ignores weights.

Stored bytes (r9; edge change #156). max_stored_bytes bounds the stored bytes a project may own: its live segments' stored page bytes after compression, page headers included (the unit of a stream's usage ownedStoredBytesNow, edge change #125). It has no shared bound, so it is not divided by k: a 0 or absent value takes the cell's CONTAINER_STORED_BYTES_DEFAULT at any k (default 0, no limit; the shipped profiles set 0 too since the owner's decision of 2026-11-03, edge change #244, storage unlimited, which replaced the 10 GiB of answer S1 of 2026-10-12), and a value the feed sets stands, above the default too. CellCeiling::effective resolves it when a policy snapshot is published. A product append whose project stores at least its quota is refused 429 stored_bytes_limit, not retryable, with the quota and the figure in its details (edge change #158): the first check of the append's queued-bytes charge, so a refusal charges nothing. The figure is the one the usage rollup publishes into admission's table after each ledger page and at install (quota::stored); it trails the store by a drain round and a rollup step, so a project can store past its quota by what it writes in that lag plus one body, and an instance whose rollup has published no figure for a project refuses it nothing. Deleting streams or a larger quota clears it. Project usage states the figure (ownedStoredBytesNow). Deleted bytes stop counting once their segments' closes reach the rollup, before the bucket reclaims them (the owner's answer S2 (a) of 2026-10-12).

Store work (shared-cells A10 cost, public-beta phase B step 14(b); edge change #143, ratified at landing under X2 (2026-10-12)). A verified request also pays for the registry store work its own task makes, once it is served (or its handler is dropped): a GET or HEAD the provider bills (a body or a 404) weighs 1, a PUT, a listing (once, however many provider pages it reads) or a COPY 10 (the class-A price ratio), a 304, a refusal or a failure nothing. SlateDB objects and the store work of other tasks (the committer, sweeps) are charged to no request. One piece of a request's own work is charged to no project either (r11, the owner's round-5 call 2): a create's stream-count seed walk that completes, the walk of the project's catalog (a LIST, 10, a page and a GET, 1, for every descriptor under its prefix, tombstones included) that a project with a max_streams quota makes on its first create since the instance booted; a walk that fails a page stays charged to its create. The weight is debited from the project's store budget, a second bucket at its requests_per_sec with one second's burst (no burst floor) and no floor on its debt (a cap would bound the debt by one request's work instead of the rate). While the store budget is in debt, the project's creates (recreates and forks included), deletes and seals answer 429 container_rate_limit with the whole seconds until it is not; every other request only pays into it, and the request bucket still charges every request exactly 1. A PUT or COPY is weighed by how it ended, once it answers, as a GET is. A refused route is admitted while the budget is not in debt, so from a full budget a sequential client gets floor(rate / weight) + 1 back to back, and concurrent requests all pass the gate before any is debited (up to the request bucket's burst, max(requests_per_sec, 50), at once, leaving about (11 x burst - rate) / rate seconds of debt for creates: 54 s at the free tier's 10 a second, 27 s at 20, 10 s at 50 and above; #162). A project's registry spend is thus bounded by the budget's rate for the refused routes, plus the descriptor GETs that the other routes pay but are never refused for (a few a request at most, within its request rate), plus one burst (the store work of max(requests_per_sec, 50) concurrent requests); the completed seed walks are the cell's, once per project per boot (concurrent first creates share one walk). A fresh create weighs 11 (a 404 and a PUT), a project's first since the instance booted too (r11): at the beta's free tier of 10 requests a second a project creates one stream and then one every 1.1 s, at 20 two back to back and then one every 0.55 s, at the k = 8 ceiling of 176 seventeen and then sixteen a second. The catalog (GET /v1/streams) pays and is refused alike (phase B item B6, in edge change #143): a listing weighs the descriptors it scans plus 10 (its LIST and a GET a descriptor, at least N + 10 for N streams listed), so at 10 a second a full budget that lists 100 streams is left about 100 in debt and the project's next listing, create, delete or seal is refused for about 10 s (Retry-After: 10; at 20, 90 in debt for 4.5 s); its appends and reads are not. The SDK waits at most about 15 s (three retries, Retry-After capped at 5 s), so a longer debt reaches its callers as 429. Owner question Q1 was decided on 2026-10-12 (P1): (b′), a budget at the request rate, now; (b), its own published store_ops_per_sec, when a partner needs a store rate separate from the request rate. A listing also reserves what its page may hold, its descriptors counted decoded (its page, at most 4 MiB, and the descriptors it fetches ahead, about 5.3 MiB in all), in the project's read bytes and the instance's read memory, as a page read does (capacity review C8, phase B item B6; edge change #145, ratified at landing under X2 (2026-10-12)); while it reads, that reservation counts in the project's write latch like any held page.

17.4 Fairness

Start with:

  • gateway project quotas;
  • server project concurrency;
  • per-stream limits;
  • existing cell safety.

Add weighted deficit round-robin inside shard committers only if noisy-neighbor testing proves that projects within limits can still starve each other.

Fair shedding over the RSS line (public-beta Layer B, lead decision of 2026-10-20; edge change #184; src/admission/fair_shed.rs). On a cell shared k ways each verified request is counted at project admission, admitted or refused by its project's quotas, in its project's and the cell's offered requests of the last 5-10 s (one window in the project's tracker entry, one for the instance; no scan, no new map). Over the RSS shed line a project carrying more than 1/k of them is refused 429 container_memory_pressure on every request, while an append of any other project passes the RSS gate up to the line x 9/8 (562 MB at the default 500, inside the platform's ~750 MB kill line; x 5/4 before #184's amendment). Past that hard line, or when no project is over its share (a flood spread over many projects), every append is shed as before. A dedicated cell (k = 1) is unchanged. The in-flight write cap (ADMIT_MAX_INFLIGHT) applies the same verdict (edge change #185): at the cap a blamed project's requests are refused 429 rate_limited, the gate's own code, and a spared append passes up to the cap x 5/4.


18. Implementation stages

Stage 0 — Freeze the contract

  • Commit docs/MULTITENANCY.md.
  • Lock project-stable/workspace-mutable identity.
  • Lock credential and token claims.
  • Lock scope matrix.
  • Lock transfer semantics.
  • Lock same-project-only references.
  • Lock layout 4 and clean switch.
  • Raw-surface principal decision. (r3, §14.3: internal-only for shared-cell GA; product-only forks.)

Exit: no unresolved identity, permission, or transfer decisions.

Stage 1 — Control Plane credential model

  • Add StreamsCredential.
  • Add create/list/rotate/revoke endpoints.
  • Add role authorization.
  • Add one-time secret return.
  • Add token exchange.
  • Add grant_version.
  • Add transfer-time credential revocation.

Exit: automation can obtain short-lived project tokens without contacting a Streams cell.

Stage 2 — Local token verification

  • Add tenant.rs.
  • Add auth.rs.
  • Implement JWKS verification. (Alg-pinned kids from the keys feed; since r7 each key also names the one audience it signs for.)
  • Add project and credential caches. (The published policy and grant snapshots, refreshed by the auth refresher.)
  • Implement exact ownership/grant version checks.
  • Add separate customer/internal/operator audiences. (Customer and internal tokens by the keys feed's aud pin (§14.1 r7); the operator surface by the deployment bearer.)
  • Authenticate before body work.

Exit: every public request yields a verified project principal without remote lookup.

Stage 3 — Layout 4 identity switch

  • Make descriptor project_id mandatory.
  • Change registry paths and caches.
  • Tenant-qualify route/storage/segment hashes.
  • Change catalog prefix and cursors. (prefix + list APIs done; the opaque product-cursor project binding lands with Stage 4's handler conversion)
  • Change consumer, producer, watch, and fork identities. (all key through storage/segment hashes — converted transitively; fork refs stay project-local names under the same-project rule)
  • Create fresh system namespaces. (desc_path system/v1/cells root + reserved system project; billing's system streams move onto it in Stage 7)
  • Add CI grep checks for name-only identity derivation. (scripts/multitenancy-audit.sh, in the release gate)

Exit: two projects can independently own an identically named stream.

Stage 4 — Public and internal surface conversion

  • Convert raw and product handlers to TenantStreamRef. (Stage 3 switch: every handler resolves through state.sref() / registry refs; bare-name overloads deleted.)
  • Scope catalog and usage. (Catalog pages are project-prefixed since Stage 3; the project-usage route authorizes against the typed AppState.tenant — the parallel project_id: String field is deleted.)
  • Convert internal RPC targets. (Stage 4a: streams-internal-container on the wire; receivers rebuild registry identity from the header and verify it against the descriptor.)
  • Implement same-project fork/DLQ checks. (Review item 4: the DLQ compound rule is complete — source consumer authorization at the gate, streams.dlq.configure + the credential's PREFIX grant over the DESTINATION at config time. Fork's compound rule is RESERVED for a product-surface fork exposure; the raw surface is internal-only, §14.3 r3.) (Stored references — ForkRef.source, dead_letter_stream — resolve exclusively through StreamDesc::ref_in_project, so a cross-project reference is unrepresentable rather than checked; isolation test drives a same-named same-fork-id foreign look-alike.)
  • Replace watch URL secret design. (Stage 4b: §15 short-lived fully-bound capabilities, Prisma-Watch / cap=; sig= retired; cross-language vector pinned.)
  • Update SDK. (Watch capability + project option with 4b; tokenProvider — lazy, single-flight, refresh-once-on-401 — plus typed WrongCellError (421/header fallback, never a refresh) and producer state scoped by project + endpoint; behavior pinned by sdk/scripts/auth-behavior.mjs.)

Exit: the complete cross-project isolation matrix passes. (Covered at the testable-today layers: identity — same name, two projects share no path/hash/byte; stored references — fork release + DLQ binding against same-named foreign look-alikes; internal RPC — foreign-project target refuses; watch capabilities — forged/expired/ cross-carrier negatives; auth §19 unit matrix. The live end-to-end matrix under per-request principals lands with Stage 5 wiring and is certified at Stage 8.)

Stage 5 — Policy, transfer, and placement

  • [~] Publish project-policy snapshots/deltas. (Data-plane side done: strict file-backed sources + independent-failure refresher publish into the arc-swap slots; the Control Plane feed implements the same KeySource/PolicySource/GrantSource traits when Stage 1 lands. Shadow mode observes every product bearer through the full customer pipeline — /v1/debug/auth reports counters + feed freshness. Enforce boots once the deployment names an explicit CONTAINER_ID and the three STREAMS_AUTH_*_FILE feeds; the Stage-5b route-scope matrix is live.)
  • [~] Publish credential-grant snapshots/deltas. (Same: data-plane done via STREAMS_AUTH_GRANTS_FILE; platform feed pending.)
  • Implement suspension. (Data-plane: a non-Active ProjectStatus in the policy feed fails closed at authorization — 403 container_not_active in enforce, counted in shadow. The transfer/ deletion sagas that DRIVE status changes remain platform-side below.)
  • Implement transfer protocol.
  • Implement project deletion saga.
  • Implement verified gateway placement.

Exit: transfer changes workspace billing and authorization without changing stream storage identity. (Enforce-mode gate — §6.1 matrix, §6.2 prefix, §7.1/§8.1 response classes — is live and tested; transfer/ deletion sagas and the Control-Plane feed remain platform-side.)

Stage 6 — Quotas

  • Implement gateway quota affinity.
  • Add workspace/project rate limits.
  • Add server-side project concurrency. (6a: src/quota.rs — per-project request-rate bucket (429 container_rate_limit + Retry-After) and inflight ceiling (429 container_concurrency_limit), acquired in the product wrapper after the enforce gate and BEFORE body buffering, quotas read from the CURRENT policy snapshot.)
  • Remove overflow coupling. (Projects never share a bucket; a full tracker refuses to TRACK new projects rather than merging.)
  • Bound project trackers. (32,768-project cap, MAX_TRACKED_PROJECTS in src/quota.rs; 16,384 from the workload-cert round until it was raised — the cap holds the certified TENANT POPULATION, not just its active window: a 10,000-tenant rotation at 20 first-seen projects/s demands 20/s x 300s = 6,000 un-evictable entries, which the old 4,096 cap shed at 19%; over the cap, NEW projects get 503 container_tracker_capacity, tracked ones are untouched.)
  • Run noisy-neighbor campaigns. (Mechanism level DONE, unblocked by Stage 5d: two projects on one enforce cell, a hostile flood (tight quotas, 300 flat-out appends) runs CONCURRENTLY with a paced compliant load — the flood is mostly refused with project-scoped 429s, every compliant request succeeds, and compliant worst-case latency stays bounded. The at-scale binary campaign with real load and latency percentiles remains a field exercise for the release push. Bucket/tracker isolation is also pinned at the unit level. Volume dimensions are live: append bytes/records metered with exact parsed counts at the append site; read bytes debited POST-HOC at the render sites that serve decrypted records (records GET/long-poll, :scan and consumer :pull) by framed body bytes, refusal at entry while in debt, and a pull walk that leased nothing pays the coverage it read (C7 (a), edge change #175: a parked pull of a project in debt does not walk again); SSE subscriptions hold a max_live_subscriptions slot for the STREAM's lifetime via a guard riding the response body. queued_append_bytes and max_streams are ENFORCED since SR2-4/SR3-2 (§17.3 r4): charge before the committer / race-safe create reservation with fail-closed catalog seeding — the per-instance count is a safety backstop, and the exact project-wide owner is recorded as an open platform decision in docs/CONTROL-PLANE-INTEGRATION.md §9.)

Exit: one project cannot materially degrade a compliant neighbor.

Stage 7 — Billing and audit

  • Remove workspace/account fallbacks from billing identity. (Edge #253: usage names the container and records no workspace or account; a container missing from the policy feed under enforce still meters and counts unowned_meter_events_total. Containers do not move between workspaces (owner, 2026-11-08), and Console splits an invoice by its container → workspace link history, so the cell emits no ownership-change event and splits no stored byte-time.)
  • Authorize usage through the project principal.
  • Add _audit_events. (§10.4.1; fleet relay path included.)
  • Run same-name cross-project invoice tests. (Two foreign projects, exact ingest attribution, no workspace in usage, live-stream storage-gauge invariants.)
  • Run invoice reconciliation. (rollup reconcile_month + GET /v1/debug/usage-reconcile + corruption-detecting DST.)

Exit: every billable unit belongs to exactly one container.

Stage 8 — Shared-cell certification

  • Create at least 1,000 projects.
  • Reuse stream names across projects.
  • Run 32–64 active noisy projects.
  • Keep hundreds of projects idle.
  • Exercise splits, owner movement, suspension, revocation, and transfer.
  • Reconcile operations and billing.
  • Prove zero cross-project leakage.
  • Complete external security review. (Not required for the public beta: the owner's "not required" of 2026-10-11 (r8); §20 keeps it for GA.)

Exit: exact release-candidate binary passes the shared-cell GA battery.


19. Required tests

Identity

  • Same name in two projects yields different registry paths.
  • Same name yields different route and storage hashes.
  • Same producer ID and sequence are independent.
  • Same consumer name is independent.
  • Same routing key is independent.
  • Workspace transfer changes none of these identities.

Credential lifecycle

  • Credential secret is shown once.
  • Revoked credential cannot exchange a token.
  • Old grant_version token is refused.
  • Old generation token is refused.
  • Workspace transfer revokes existing credentials.
  • New workspace can create a replacement credential.
  • Durable credential secret is never accepted by the data plane.

Authorization

  • Missing/expired/not-yet-valid token.
  • Wrong issuer/audience/cell.
  • Missing scope.
  • Prefix escape attempts.
  • Suspended project.
  • Customer credential against debug/internal routes.
  • Internal identity against public product routes.
  • Operator identity without break-glass access.

Cross-project isolation

For projects A and B, both containing orders:

  • metadata;
  • append;
  • read;
  • scan;
  • SSE;
  • consumers;
  • seal/delete/recreate;
  • catalog;
  • usage;
  • cursors;
  • watches;
  • forks;
  • DLQs;
  • split/merge;
  • internal fan-out;
  • owner handoff.

A request authorized for A must mutate and reveal zero state belonging to B.

Transfer and billing

  • Route/storage hashes remain unchanged after transfer.
  • Old access token fails immediately after policy publication.
  • Old durable credential cannot mint a new token.
  • Ingest/read events after transfer use the new workspace.
  • Stored byte-time splits exactly at effective_at.
  • Old invoices retain pre-transfer charges.
  • Project dashboard includes its full history.
  • Workspace invoice includes only its ownership interval.

Noisy neighbor

  • Project A saturates append quota; B stays within SLO.
  • A saturates reads; B stays within SLO.
  • A consumes its SSE allowance; B can connect.
  • A reaches tracker capacity; B remains admitted.
  • A triggers shard maintenance pressure; calm projects continue unless a real cell-wide limit engages.

20. GA acceptance criteria

Shared-cell GA is ready only when:

No deployment-global customer bearer remains.
No deployment-global customer workspace/project identity remains.
Every registry and storage identity is project-qualified.
Workspace transfer requires no data rewrite.
Every token is exact-version checked against project and credential state.
The gateway verifies before routing and quota selection.
Customer, fleet, operator, and watch credentials have separate trust boundaries.
Same-name cross-project isolation passes on every surface.
Project and workspace quotas are active.
One noisy project cannot collapse another project's SLO.
Token rotation, revocation, suspension, and transfer pass.
Billing correctly splits ownership at project transfer.
The exact release binary passes the shared-cell field battery.
An external security review is complete.

Amendment (r8, 2026-10-11). The owner waived the last criterion, the external security review, for the public beta: asked whether the review is required or waived, he answered "not required" (docs/reviews/2026-09-hardening/README.md, "Owner decisions", row "Public beta (decided 2026-10-11)"). The amendment waives only the review, and only for the public beta; the criteria above stand as written for shared-cell GA, and the beta's own work list is docs/reviews/2026-09-hardening/NEXT-WORK.md, "Public beta (decided 2026-10-11)".

21. Fastest critical path

1. Control Plane StreamsCredential + token exchange
2. Data-plane principal middleware
3. Layout-4 project-qualified registry and hashes
4. Public/internal route conversion
5. Project policy, ownership version, and transfer
6. Gateway and server quota isolation
7. Cross-project security battery
8. Billing transfer attribution
9. Shared-cell field certification

Do not block this program on:

  • generic Compute autoscaling;
  • cross-project forks;
  • live cell migration;
  • multi-project access tokens;
  • the full deterministic simulator;
  • ReadIoMetrics.

Those can follow GA.