Runtime conformance
A Runtime demonstrates conformance by running the shared conformance suite. The suite is one package, @pyn-backend/platform-runtime-compliance in src/alpyne/runtime/compliance, that every Runtime runs against its own initialize function. A companion package, @pyn-backend/platform-reactor-compliance in src/alpyne/reactor/compliance, covers the reactor.
Runtime suites
Section titled “Runtime suites”platformRuntimeCompliance(initialize, options) runs these suites against the Runtime initialize returns:
archive: archiving, unarchiving and default exclusion from selection.item children,item parent: hierarchy navigation, child keys, keyed lookup and keyed upsert.dataTypes,properties: Property types, interpretation and Property-level Grants.event: appending Events, lineage and idempotency of Event executions.event.immediate: inline Listener execution, Event persistence in the execution and exclusion from the reactor.eventSelector: selecting Events by PRN, Item, lineage, trace, time range and access.extension: per-parent Property extensions on extensible Templates.filters,sort,pagination: selector predicates, ordering, pages and cursors, and access filtering against counts.hierarchy join,join: joining selections across the hierarchy and across Relations.hooks:onCreateandonSeedApp Hooks with and without a source Workspace.item,template,union: Item lifecycle, Template membership, Union membership and selection.relation: Relation cardinalities,set,add,remove,clearandsetIfNotExists.role: App Roles and Template Roles,assertRole,checkRole, assignment, revocation and Grants on operations and Items.schedule: scheduled Events, including the state filter.search: full-text search indexes.seed,workspaces: Workspace creation and seeding.transaction: rollback of Item creation, Relation writes and Item updates when the execution throws.concurrency: two overlapping write executions, with independent Property writes on one Item, isolation of uncommitted children and Relation clears against concurrent commits.relation transactional:addIfNotExistsandsetIfNotExistsunder concurrent writes for each cardinality.stateMachine: default and initial states, transitions, and transition conflicts with and without retry.
The last three suites require two overlapping transactions. A harness whose database offers a single connection passes concurrency: false, relationTransactional: false and stateMachine: false to leave them out.
Harnesses
Section titled “Harnesses”| Harness | Runtime | Suites |
|---|---|---|
src/alpyne/runtime/test/index.test.ts |
Test Runtime | Every suite. |
src/alpyne/runtime/postgresql/index.spec.ts |
PostgreSQL against the repository’s PostgreSQL test database | Every suite. |
src/alpyne/runtime/postgresql/index.test.ts |
PostgreSQL against PGlite | Every suite except concurrency, relation transactional and stateMachine. |
src/alpyne/runtime/sqlite/index.test.ts |
SQLite | Every suite except concurrency, relation transactional and stateMachine. |
The reactor compliance package runs against the PostgreSQL reactor (src/alpyne/reactor/postgresql/index.test.ts and index.spec.ts), the SQLite reactor (src/alpyne/reactor/sqlite/index.test.ts) and the test reactor (src/alpyne/reactor/test/index.test.ts). It covers:
- subscriber matching and delivery of one Event to every matching subscriber;
- batching by Event PRN and Workspace;
- completion when a subscriber errors, with no redelivery to the subscriber that threw;
- exclusion of Events more than a day old and of paused Workspaces.
Target scenarios
Section titled “Target scenarios”Each scenario states an obligation from Unit of Work and what a conforming Runtime demonstrates when the scenario runs against it. Where the contract permits stronger grouping, a scenario asserts the shared invariant, not an incidental outcome.
| ID | Scenario | A conforming Runtime demonstrates |
|---|---|---|
| C01 | Access an Item of another Workspace; write through a read context; write through a read-only privileged context. | No cross-Workspace access. Every write through a read context fails. |
| C02 | Retain a writable Item reference after the attempt commits, fails, is canceled or is retried. | Every operation through the expired reference is rejected. |
| C03 | Read ctx.now across awaits, inline Listeners and a retry. |
One value throughout an attempt. A fresh value on the retried attempt. |
| C04 | Update an Item, then read it again; have an inline Listener update it, then read again. | The returned reference and a fresh lookup expose the write. A reference obtained before the write need not change. |
| C05 | Two executions read one version of an Item, then both write; interleave a state, key or archive change. | The write against the replaced version conflicts and changes nothing. |
| C06 | Race a transition, a conditional Relation write and a conditional child creation. | Each precondition is tested and applied atomically. The losing operation reports its documented conflict or false result. |
| C07 | Commit from another execution while an attempt reads. | No uncommitted data is visible. The attempt’s view stays consistent. |
| C08 | Write A, write B, publish, then throw. | None of the attempt’s writes or Events commit. |
| C09 | Publish inside an attempt, then commit or fail. | No Listener runs before commit. A failed attempt leaves no Event. |
| C10 | Chain inline Events A to B to C; then declare a cycle; then exceed the depth bound. | The chain completes with correct parent and root lineage. The cycle and the over-depth publish are rejected. |
| C11 | An inline Listener writes and throws while a sibling remains; separately, the caller throws after successful inline work. | The Listener error reaches the caller and stops the remaining inline Listeners. Durable effects follow the execution’s commit outcome. |
| C12 | Conflict after an earlier write in the same attempt; exhaust maximumTransientRetries. |
The whole attempt is discarded and retried. Attempts are bounded, and the final error is the conflict. |
| C13 | Run two executions with the same Event Identifier and idempotencyScope; fail one after it starts; retry after a rollback. |
Exactly one commits. A failed attempt claims nothing. The duplicate is rejected without partial effects. |
| C14 | Complete a Mutation, then inspect Listener effects and Metric projections. | Completion of the Mutation implies neither. Both appear after the reactor and projector run. |
| C15 | Publish a Template Event, then process it with the reactor. | Listeners run once, under a system context, followed by parent Listeners up the hierarchy. |
| C16 | Publish an Event with immediate, then run the reactor. |
The reactor never claims the Event. |
Reporting a run
Section titled “Reporting a run”A conformance report names the Runtime and its version, the harness, the suites run and the suites left out, the environment, and the outcome of every scenario. A guarantee added to a Runtime is accompanied by a regression test in the shared suite and by the matching rule in the specification.
Related
Section titled “Related”- Test an app runs the conformance suites for each Runtime from an application repository.
- Scope and conformance defines what conformance means.
- Runtime implementations describes the three Runtimes the suites run against.
- Unit of Work states the rules the target scenarios exercise.

