Repository navigation
Releases
pemba 0.3.0
Fewer Postgres round trips on deep hierarchies, and a FastAPI helper. No migration is needed
from 0.2.0: public APIs keep working and storage formats are unchanged. A custom ReadStore
keeps compiling, because the new trait methods are provided.
Changed
- Postgres reads make fewer round trips. A request opens its snapshot in one message, and a
check fetches what each level of a hierarchy may read in one statement. Answers, errors,
limits and traces are unchanged (docs/T10.1-READ-AHEAD.md). A check 30 folders deep goes
from 99 round trips to 33 and from 13.3 ms to 6.7 ms (p50), andlookup_resourcesover
10,000 documents from 506 to 8 and from 72 ms to 16 ms (benches/RESULTS.md). - Inside a read snapshot, Postgres statements use generic plans, set with
SET LOCAL, so they
are not replanned on every call. The first open-ended read below head returns to the
server's default, for one more round trip. - Not every Postgres scenario got much faster. Over three benchmark runs against the baseline,
shallow checks stayed about level (median p50:direct_hit-2.2%,direct_hit_below_head
+1.3%,wide_groups_10k_below_head-3.2%) and writes did not change. No scenario was slower in
all three runs, at p50 or p99, but a single run can be:wide_groups_10k_below_headranged from
+30.5% to -20.6% at p50, andwrite_batch_1000, whose code did not change, from +9.6% to -9.0%
(benches/RESULTS.md).
Added
pemba.contrib.fastapi.Authz, a permission check for FastAPI routes, with the new extra
pip install pemba[fastapi]. A deny gets a configurable 4xx (403 by default). A transient
store failure gets a 503 with a fixed detail, and any other engine error a 500. An id the
engine refuses gets a 422, anat_leastbound ahead of the store a 409, and a request with
no subject a 401, whose headers you can set withunauthenticated_headers. See
docs/guides/fastapi.md.ReadStore::batch_read_limitandReadStore::read_batch, provided methods a store may
implement to batch reads, withBatchReadandBatchAnswer.
pemba 0.2.0
An additive async Python release; synchronous APIs and storage formats are unchanged.
Added
- T5.13 async Postgres foreign writes: await
Engine.write_asyncwith psycopg
AsyncConnection, asyncpg, or SQLAlchemyAsyncSession/AsyncConnectionover
either driver. The shared synchronous Rust algorithm uses the approved loop/thread
bridge; caller-owned transactions still require caller commit/rollback. Cancellation
drains in-flight work before raising, then the caller must roll back. pemba.aio.check,lookup_resources,lookup_subjectsandresolveread helpers.
They preserve synchronous results and errors throughasyncio.to_thread.
Reproducible per-statement bridge measurements are recorded inbenches/RESULTS.md;
no sans-IO redesign or performance threshold is introduced.
pemba 0.1.0
The first stable API release: embedded Rust/CLI and Python authorization with memory,
SQLite and synchronous Postgres stores. No supported async/Node/WASM distribution
or storage-format change is introduced by stabilization.
Breaking
- Rust public API audit (T3.9/T7.2): extensible request/filter, response/statistics,
store result and fixture report structs are now#[non_exhaustive]. Migrate request
literals toCheckRequest::new,CheckItem::new,WriteRequest::new(orDefault),
and the existing lookup/read/filter constructors, then assign optional public fields.
Match outputs with..; custom stores use the newReverseFilter,RelationCount,
StoredSchema,GcStatsandDeleteResultconstructors. Fixture producers use
Failure::newandReport::default. Seedocs/PUBLIC_API_AUDIT.mdfor every decision.
Existing config defaults/setters, stable tuple/revision value types and storage formats
are unchanged. - Upgrading from alpha.1/alpha.2: foreign writes return
PendingRevision, not a
committedRevision. The caller owns commit/rollback. Commit successfully, then
call Rustengine.resolve(&pending)or Pythonpending.revision()and useAtLeast
/at_least=for subsequent reads. SQLite already knows the number but cannot detect
rollback; Postgres reports pending/rolled-back states. Engine reads do not see the
app transaction's uncommitted writes. See the alpha.3 migration below and
docs/guides/transactional-tutorial.md. - Upgrading from alpha.3: Python
int(pending)and index conversion were removed in
alpha.4 and remain unavailable. Resolve after commit or pass the token toat_least=.
Added
- Rust
Engine::check_str(resource, permission, subject, consistency) -> Result<bool, Error>:
canonical parsing, then the existing typed check. The specifiedError::Parseis now
implemented with codePARSE; other check errors propagate unchanged. Python preserves
built-inValueErrorfor malformed arguments; its stubs/signatures are unchanged. - OQ-044 is complete: only
check_stris implemented. Use typed write/delete APIs and
pemba_schema::compileinstead of the removed promises of Rustwrite_str,delete_str
and staticEngine::validate_schema. Python schema validation remains available. - Installation, schema, consistency, transaction, troubleshooting and developer guides;
runnable Rust/Python SQLite/Postgres app-row-plus-permission commit/rollback tutorial;
stable/development documentation trees in the existing Pages assembly. Security
reporting policy, safe issue forms, triage process and scoped roadmap are prepared;
launch activation and final announcement text remain human gates.
Fixed
- Playground deployment: tags dispatch deployment through main so GitHub Pages does
not silently retain the pre-release artifact. Distinct Pages artifact names make
reruns unambiguous. Deployment now verifies public page and asset bytes, including
every versioned directory and its WASM, instead of trusting the deployment status.
pemba 0.1.0-alpha.4
The first release with the browser playground.
Breaking
- Python: removed the deprecated
PendingRevision.__int__and__index__
conversions announced in alpha.3.int(pending)andoperator.index(pending)
now raiseTypeError. Migration: callpending.revision()after commit when
you need the revision number, or passpendingdirectly asat_least=.
Added
- Browser playground at https://joshua-fields.github.io/pemba/: the real
engine compiled to WebAssembly, running locally in a Web Worker. Edit schemas
with syntax highlighting and inline diagnostics, run checks and both lookups,
run fixture assertions, and inspect a collapsible explain tree or copy its text. - Playground examples for document sharing, GitHub-like permissions and agent
authorisation; versioned share links and fixture YAML import/export. A version
mismatch banner links to the original release when available. - Immutable
playground-<version>.tar.gzassets attached to GitHub Releases.
Pages serves the newest playground release at the root, each release at
/v/<version>/, and development builds at/next/, with version and commit
shown in the footer. Tag builds create or update the GitHub Release using
these changelog notes before attaching the playground. - Playground CI checks the release WASM against native transcripts for all
fixtures and 1,000 generated cases, checks generated cases against the reference
evaluator, and runs frontend unit and browser tests with a 700 KB gzip budget. pemba_fixtures::parse_strsplits fixture YAML into its schema, its relationships
text and its assertion sections, without running anything (the playground's import;
docs/07-testing.md§3).FixtureErrorgainsMalformed.
Changed
pemba-core,pemba-schema,pemba-store-memoryandpemba-fixturesbuild and run on
wasm32-unknown-unknown, for the browser playground (ADR-016). It is not a supported
WASM package. On wasm32 only,pemba-coretakesInstantfromweb-time, because
std'sInstant::nowtraps there. Other targets gain no dependency.
Fixed
- The scheduled Postgres property-test workflow parses correctly after quoting
its test command.
0.1.0-alpha.3: Postgres store
[0.1.0-alpha.3] - 2026-10-28
The first release with the Postgres store.
Breaking
- A write inside your own transaction returns a
PendingRevisioninstead of a
Revision(ADR-015): Pythonengine.write(..., conn=)and RustEngine::write_in.
Native writes still returnRevision. On SQLite it is resolved at once.
Migration: pass it asat_least=pending, or callpending.revision()after commit
(Python); in Rust,tx.commit()?thenengine.resolve(&pending)?.
int(pending)andoperator.index(pending)keep working for one release with a
DeprecationWarning; comparisons and arithmetic do not. Rust has no transition aid. - For store implementers only:
pemba_core::write::delete_matchingreturnsDeletedand
pemba_core::write::write_schemareturnsSchemaWritten, which carry anApplied
(a revision, or a batch a commit trigger maps to one). Migration for stores that
allocate revisions inside the write:.into_result()and.into_stored(source, hash).
SqlDialectgainsschema_lock, defaulting to none. PendingRevision::resolved()is no longer aconst fn.WritableStoregains
resolve_batch, with a default for stores that number writes inside them.
Added
- Postgres store (
pemba-store-postgres, Postgres 15+): relationships in a schema of
your database, revisions assigned at commit so concurrent writers stay in commit order,
writes that join your transaction (Engine::write_inwithPgTxn), GC that compacts
and prunes, TLS through rustls. Wheels include it. See the README's Postgres section;
benchmarks inbenches/RESULTS.md. PendingRevision(Rust and Python) andEngine::resolve. Python'sat_least=
accepts aPendingRevision.- Error codes
REVISION_PENDINGandWRITE_ROLLED_BACK, fromEngine::resolveon a
store that assigns revisions at commit (Python:RevisionPendingand
WriteRolledBack, bothConsistencyErrors). - Python:
Engine.postgres(dsn, *, schema=None, pool_size=8, auto_migrate=False), whose
calls release the GIL;write(conn=)on it joins a psycopg 3 or psycopg2 transaction,
a SQLAlchemySession/Connection, ordjango.db.connection, and works from async
code throughAsyncSession.run_sync.pemba.PembaWarning.Engine::store()in Rust. - Postgres: a prepared-statement cache per pooled connection (up to 256 statements,
least recently used evicted and closed on the server). It is emptied on reconnect,
after a schema write, and on every connection when the server reports a stale plan
after DDL. It is not used inside your own transaction. - Postgres: batched writes. A write sends one statement per kind of operation (creates,
touches, deletes), however many tuples it holds. If a create hits an existing tuple, the
write is undone to pemba's savepoint and rerun one operation at a time, so
AlreadyExistsnames the same tuple as before and your transaction stays usable. For
store implementers:SqlDialectgainsbulk_rows, defaulting to none (one statement
per operation, as before; SQLite keeps that). pemba check --color <auto|always|never>.auto, the default, is the previous
behaviour: colour only on a terminal, and not whenNO_COLORis set.alwayscolours
even a pipe and overridesNO_COLOR(forless -R);neverturns colour off.
Changed
--explainandCheckTrace::render(): when an exclusion denies because its subtracted
side removed a granted base, both sides are now on the granting path, so the tree shows
where the permission was granted and where it was removed. The base line is no longer
marked(not needed).--explaincolour (CheckTrace::render_ansi()): evaluated nodes off the granting path,
falseones included, are drawn in the terminal's normal colour instead of dimmed. Only
skipped nodes and memo references are dimmed.(not needed)is printed in colour too,
so the coloured text is the plain text plus styling.--explaincolour: a line on the granting path is coloured as a whole, not just its
✓/✗mark: green where it granted, red where it denied (so the root of a denial is
red), still bold. Thedenied:header is red.--color neveroutput is unchanged.- Test-only: the
cycle_passestests readcheck_bulkstats from one global, always-on
span recorder filtered to the calling thread, instead of a per-call scoped subscriber,
the same capture as thelookuptests (#42, #43). - The README is written for newcomers: no internal task or decision numbers, the
specification linked once under "Design documents", and a diagram comparing a separate
authorisation service (two databases, dual writes) with pemba (one transaction).
Performance
- On Postgres, latency is round trips. A direct check costs about 5 round trips. Each
level of hierarchy it walks adds about 3, so a document 30 folders deep costs 99. A
write costs 10 whatever its size. On a Linux CI runner where one round trip took about
150 µs, p50 was 0.76 ms for a direct check (1.58 ms without the statement cache),
16 ms for 30 folders (47 ms) and 19 ms for a 1,000-tuple write (407 ms). Full figures,
with round trips for every scenario:benches/RESULTS.md. Fewer round trips for deep
hierarchies is planned.
Fixed
- Postgres: paging
read_relationshipsat an older revision no longer sorts every tuple
of the type for each page. The first 500-tuple page over 100,000 tuples went from
106 ms to under 1 ms, because the planner had misjudged how many rows the
older-revision filter keeps. Answers are unchanged.
pemba 0.1.0-alpha.1
The first public release of pemba: an embedded, Zanzibar-style authorization engine in Rust with Python bindings. It runs inside your process and keeps relationships in your own SQLite database, so a permission write can join your application's transaction and commit or roll back with your data. check, lookup_resources, lookup_subjects, the memory and SQLite stores, transactional writes and the Python bindings are implemented and tested.
This is an alpha. Expect breaking changes before 0.1.0. The 0.1 release gate is not signed off yet.
Install
pip install --pre pemba # Python 3.11 or newer (abi3 wheels for Linux, macOS, Windows)
cargo add pemba@0.1.0-alpha.1 # Rust library
cargo install pemba-cli@0.1.0-alpha.1 # `pemba` command-line toolOnly pre-releases exist, so pip needs --pre and cargo needs the explicit version.
Testing
- 523,138 questions differential-tested against SpiceDB 1.56.2, with 0 unexplained mismatches. Every difference is documented with a repro in
KNOWN_DIFFERENCES.md. - Mutation testing on the evaluator and schema validator: 202 mutants, 0 survivors (
docs/MUTANTS.md). - Property tests against a reference evaluator, and three fuzz targets run for 10 minutes each.
Read more
Building pemba: An Embedded Zanzibar-Style Authorization Engine in Rust, on why the engine runs in-process and the two bugs that shaped its design.