symfonic.memory.backends.postgres_staged_identity¶
postgres_staged_identity ¶
Compose a staged writer and its publisher on exact, distinct database logins.
CORE-376 makes PostgreSQL refuse publication by the writer role, but only for a turn that actually runs as that role, against a database where the boundary is installed. This module is the composition seam that refuses anything else:
staged_writer_journalbuilds the staged journal for a turn process. On a connection from the very pool the journal will use, it requires thatsession_userandcurrent_userboth equal the writer role and thatrequire_boundary(writer, publisher)holds. It takes the publisher's role name, which is not a secret, and no publisher credential.StagedPublisherBindingcomposesPostgresStagedPublisherfor an activation process. It requires the publisher login and the boundary when composed and again before every activation and everyactivation_statusread, so a journal on the writer's pool, a dropped policy or a changed login refuses instead of publishing or reporting.
Scope. Composition attests one connection. Bound status and activation reads
attest their own snapshot transaction and hold boundary table locks through
the read; the publication transaction independently attests its proof. It cannot tell
whether both credentials were loaded into one process: process separation,
where the publisher DSN lives and how activation is triggered are deployment
decisions outside this library. install is never called here; the boundary
is an operator step run as the table owner.
StagedPublisherBinding ¶
A PostgresStagedPublisher that only activates on the publisher login.
Build it with await StagedPublisherBinding.compose(...); the reader of
committed local final receipts is bound there and nowhere else.
Source code in src/symfonic/memory/backends/postgres_staged_identity.py
activate
async
¶
Re-attest the login and the boundary, then activate one READY turn.
activation_status
async
¶
Re-attest, then read one turn of the bound scope; never publishes.
A raw journal snapshot reports whatever the rows say, including an ACTIVE forged after the boundary was dropped. This answers only while the publisher login and the boundary still hold, and only for the scope fixed at composition.
Source code in src/symfonic/memory/backends/postgres_staged_identity.py
require_login
async
¶
expected is both the session and the current role, behind the boundary.
Source code in src/symfonic/memory/backends/postgres_staged_identity.py
require_login_on
async
¶
Attest on the connection whose transaction will consume the result.
Source code in src/symfonic/memory/backends/postgres_staged_identity.py
staged_writer_journal
async
¶
The staged journal of a turn process, bound to the attested writer login.
No schema work is done: the writer may not run DDL, so the staged schema, the claim fence and the boundary must already exist.