Repository navigation
Serve blob reads on the Postgres tier - #218
Merged
Merged
Conversation
`{"blob": {"read": true}}` (#106) is what lets a wasm32-areev-io module read
the attachment a trigger's connector already filed -- by address, read-only,
every read journaled as a blob_read Observation. On PostgreSQL the broker
answered 501: the read is lock-free because it goes to the .blobs sidecar
without opening the database, and that sidecar is an embedded-backend thing.
So on the tier the server product actually runs on, the whole class of
attachment-parsing capability tools was unavailable -- and the documented
alternative, letting the tool open the memory itself, means handing it a
credential to that memory, which is the thing a capability tool exists to
avoid.
read_blob_offline now serves a postgres://...?schema=... locator too: its own
short-lived connection, one schema-qualified SELECT against the in-schema
blobs table, closed on return. It still never opens the memory, so it cannot
contend with the run holding it -- and here there is no exclusive lock to
avoid in the first place, which makes this cheaper than the embedded case
rather than harder. Qualifying the table (#181) keeps it independent of
search_path, so it is safe behind a pooler. Blobs are never sealed on this
backend, because the blob key derives from the page cipher Postgres refuses,
so that branch cannot arise.
The broker's 501 is deleted rather than narrowed: its call site is unchanged,
because widening the function was the smaller change than adding a second one.
`areev blob get` carried the same restriction -- it skipped the lock-free path
for a DSN, a workaround for the limitation this removes. Lifted, so the two
blob-reading surfaces behave identically instead of diverging for a reason
that no longer holds.
Two things cleaned up on the way. The "is this a DSN?" test existed in four
copies (CLI, both bindings, and the one this change would have added); it now
lives once in the store, which owns the concept, and the other three call it.
And the row read uses try_get rather than get, so a column whose type ever
surprises us is an error the broker reports instead of a panic that takes the
serving thread with it.
Conformance gains a case that puts a blob in, holds the memory OPEN, and reads
it by address; it runs against both backends and is registered in one place.
The Backend trait gains `locator` for it -- a file path or a DSN, the seam any
case needs when the API under test takes an address rather than a handle.
83 postgres conformance cases and 69 embedded against a real pgvector:pg16,
2,702 workspace tests, 124 pytest, 72 node --test, clippy -D warnings clean
including --features postgres. The Postgres path was mutation-checked, and
`areev blob get` was driven end-to-end against a live schema while another
handle held the memory.
Docs moved with it: run.md's "Embedded backend only" warning, mcp-reference's
sidecar claim, and the store crate notes.
sathish-mg
approved these changes
Sep 9, 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.
Closes #202.
{"blob": {"read": true}}(#106) is what lets awasm32-areev-iomodule read the attachment a trigger's connector already filed — by address, read-only, every read journaled as ablob_readObservation. On PostgreSQL the broker answered 501, so on the tier the server product actually runs on, the whole class of attachment-parsing capability tools was unavailable.The documented alternative — the tool opens the memory itself — means handing it a credential to that memory, which is precisely what a capability tool exists to avoid.
The fix
read_blob_offlinenow serves apostgres://…?schema=…locator too: its own short-lived connection, one schema-qualifiedSELECTagainst the in-schemablobstable, closed on return. The broker's 501 is deleted rather than narrowed — widening the function was smaller than adding a second one, so its call site is unchanged.Three things made this simpler than the issue assumed:
search_path, so it is safe behind a pooler.areev blob getcarried the same restriction (&& !is_pg_url), a workaround for the limitation this removes. Lifted, so the two blob-reading surfaces stop diverging for a reason that no longer holds.Cleaned up on the way
The "is this a DSN?" test existed in four copies — CLI, both bindings, and the one this change would have added. It now lives once in the store, which owns the concept. And the row read uses
try_getrather thanget, so a column whose type ever surprises us is an error the broker reports rather than a panic that takes the serving thread with it.Testing
A conformance case puts a blob in, holds the memory open, and reads it by address — registered once, run against both backends. The
Backendtrait gainslocatorfor it (a file path or a DSN), the seam any case needs when the API under test takes an address rather than a handle.Mutation-checked: forcing the embedded path makes the Postgres run fail. Driven end-to-end too —
areev blob getagainst a live schema while another handle held the memory returned the bytes.2,702 workspace tests · 124 pytest · 72
node --test· clippy-D warningsclean including--features postgres·--lockedbuild · versions · repo stats.Docs
run.md's "mcp-reference.md's sidecar claim, and the store crate notes.