Skip to content

Version Packages - #11

Merged
gingerhendrix merged 1 commit into
mainfrom
tegami/version-packages
Nov 22, 2026
Merged

gingerhendrix merged 1 commit into
mainfrom
tegami/version-packages

Conversation

@github-actions

@github-actions github-actions Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

Summary

All bumped packages.

Package From To
@streamsy/projection 0.12.0 0.13.0
@streamsy/core 0.12.0 0.13.0
@streamsy/serve 0.12.0 0.13.0
@streamsy/storage 0.12.0 0.13.0
@streamsy/views 0.12.0 0.13.0
durable-response 0.0.1 0.0.2
command-stream 0.0.10 0.0.11
durable-response-atom 0.0.1 0.0.2
durable-response-aisdk 0.0.1 0.0.2
durable-response-foldkit 0.0.1 0.0.2
durable-response-tanstack 0.0.1 0.0.2
hex-domination 0.0.1 0.0.2
timer-stream 0.0.10 0.0.11

Changelogs

non-retryable-handler-errors.md

Show Bumped Packages (1)
Package Bump
npm:@streamsy/projection minor

Stop a binding on a permanent handler error

Mark a typed handler error as permanent with readonly [NonRetryable] = true, using NonRetryable from @streamsy/projection. When an attached binding fails with that error, the runner stops the binding at once. It does not step the retry schedule or call onExhausted. registry.failed reports the binding as stopped with exhausted: false and failure reason non-retryable-handler. Other handler errors and defects still retry under the declaration's retry policy. Binding retry

import { Schema } from "effect";
import { NonRetryable } from "@streamsy/projection";

class UnknownAccount extends Schema.TaggedError<UnknownAccount>()("UnknownAccount", {
  account: Schema.String,
}) {
  readonly [NonRetryable] = true;
}

projection-generations.md

Show Bumped Packages (1)
Package Bump
npm:@streamsy/projection minor

Rebuild a projection into a new generation

You can now change a projection's handler and replay its inputs into fresh output streams, while readers stay on the old streams until you move them. The steps are:

  1. Wrap the projection's outputs with Projection.perGeneration, so each generation writes to its own streams.
  2. Raise generation and attach. The runner replays the existing bindings in the background.
  3. Wait with Projection.caughtUp, then move readers to the new streams.
  4. Call Projection.retire to close or remove the old generation.

The next four sections describe each step. Rebuild a projection is the full guide, with an in-place procedure and a side-by-side procedure.

Put the generation in an output's address

Wrap a projection output, or the wake class in accepted, with Projection.perGeneration(route, param). The named route parameter takes the declaration's generation. The binding's params fill the other parameters.

class Doubled extends Streamsy.json<Doubled>()("Derived/Doubled", "doubled/:user/g/:rev", {
  params: { user: Schema.String, rev: Schema.FiniteFromString },
  schema: Schema.Finite,
}) {}

const doubled = Projection.emit({
  id: "doubled",
  generation: 2,
  params: { user: Schema.String },
  inputs: { input: Input },
  outputs: { doubled: Projection.perGeneration(Doubled, "rev") },
  commit: Commit.transaction,
  emit: ({ item }) => ({ doubled: [item * 2] }),
});

// The projection writes to doubled/u1/g/2. A reader pins an address the same way.
const pinned = Doubled.at({ user: "u1", rev: 2 });

Commit.transaction and Commit.producer create a wrapped stream on its first write and check that it starts empty. A failed check fails the unit with the non-retryable reason invalid-output. Pass { shared: true } as the third argument to skip the check for a stream that several writers share. Call Projection.createOutputs(bound) when readers need the streams before the first unit commits.

Projection.isPerGeneration recognizes a wrapped output, and Projection.generationBinding reads its route, generation parameter, shared flag and routeBy names. Generation-addressed outputs

Replay existing bindings when you attach a new generation

When you raise generation and attach the declaration, Projection.attach and ProjectionWakeup.attach list the live checkpoints for the projection id. Each binding with no checkpoint at the declared generation gets its generation-addressed outputs created and is queued for replay. A projection with no params queues its {} binding.

Pass bindings to either attach form to choose the replayed bindings yourself. It is an Effect that returns decoded params. Use it when you run a new projection id beside the old one, on MySQL, or when bindings that never committed a unit must replay.

Projection.attach(totalsV2, { durable: true, bindings: Projection.bindings(totalsV1) });

Projection.bindings(declaration, { generation }) lists the decoded params of the bindings with live checkpoints for a projection id. Without generation it lists every generation. It fails with InvalidBinding when stored params no longer decode, and with unsupported-composition on MySQL and on checkpoint stores that cannot list.

When startup cannot list bindings, or the bindings Effect fails, attach logs the cause and skips startup replay. Live commits and triggers still run. Choose the binding inventory

Check replay progress

Capture Projection.tails(binding) once, then wait with Projection.caughtUp(binding, tails) until the binding's checkpoint reaches those input offsets and closes. Producers can keep writing while you wait. caughtUp has no timeout, so add your own.

Projection.lag(binding, tails) returns the committed and target offset of each input and a caughtUp flag. Tails is a Schema, so you can store the captured value and check it later. Check replay progress

Retire the old generation

Call Projection.retire(declaration, params, { generation }) to fence the generation's checkpoint and remove its exclusively owned generation-addressed outputs. Pass streams: "close" to keep their data and let readers reach the end. The returned Retired value reports a RetiredOutput for each output. A later run of the retired generation fails with the non-retryable reason retired-generation. Retire a generation

Two more calls remove what a retired binding leaves in SQL:

  • Commit.transactionWithCleanup(cleanup) runs your cleanup in the same transaction as Projection.forget or Projection.retire. Run the cleanup SQL with the supplied client, so a failure rolls back the lifecycle call and the cleanup together. Commit reference
  • StateTable.clear(table) deletes a retired stream's cached rows and applied offset. Clear a retired stream's rows

Route one binding's output to many streams

Pass routeBy to Projection.perGeneration(route, generationParam, { routeBy: ["workspace", "date"] }) when one binding writes to several stream addresses. Each name in routeBy must be a distinct route parameter. The handler supplies those values, the generation fills the generation parameter, and the binding's params fill the rest. A routed output cannot be shared. Projection.perGeneration

Declare routed outputs in Projection.process with Commit.transaction or Commit.transactionWithCleanup. In process, outputs[name] is a RoutedHandle. Its open(routeParams) returns the stream address and creates the stream on first use, which must find the stream empty and open. The stream creation, the appends and the checkpoint commit in one transaction.

Projection.retire closes or removes the streams that a routed output opened and reports them in Retired.routed, an array of RetiredOutput for each output name. Projection.forget clears the binding's record of those streams. On MySQL, which cannot list owner records, routed retirement fails with unsupported-composition.

Check these changes when you upgrade

  • Triggers rescan once. Trigger cursors are now kept for each generation, so a new generation reads its trigger streams from the start. The stored cursors have no generation, so the first pass of each attached projection with triggers after the upgrade also reads them from the start. Expect that pass to schedule every member named in the retained trigger history once.
  • New fault reason. ProjectionFault.reason gains retired-generation. Add it to exhaustive switches over reason.
  • Custom checkpoint stores. CheckpointStoreApi gains two optional members, list and routes. CheckpointStore.layer and CheckpointStore.layerMemory implement both. A custom store without them keeps working, but attach skips startup replay, Projection.bindings fails, and opening a routed output fails with unsupported-composition. For a store built with CheckpointStore.fromStore, implement EncodedStore.list(prefix) to get both. CheckpointStoreApi

owner-records-list.md

Show Bumped Packages (2)
Package Bump
npm:@streamsy/core minor
npm:@streamsy/storage minor

List owner records by key prefix

Breaking change: the OwnerRecords service from @streamsy/core/internal now requires list(prefix). It returns the owner's [key, encoded] entries whose keys start with the prefix. @streamsy/projection uses it to find the bindings to replay when you rebuild a projection.

The memory storage and the SQLite and PostgreSQL storage in @streamsy/storage implement list. MySQL storage fails it with a StorageFault whose operation is OWNER_RECORDS_LIST_UNSUPPORTED, because MySQL may have shortened long keys.

You need to act only if you provide OwnerRecords from your own storage host. Add list, or fail with that operation when your store cannot list. Memory storage internal services

release-views.md

Show Bumped Packages (1)
Package Bump
npm:@streamsy/views minor

Maintain incremental SQL views with @streamsy/views

@streamsy/views is now published. Install it with bun add @streamsy/views @streamsy/projection @streamsy/core effect.

Build relations over Streamsy.state collections with View.from, then join, filter, select, group with View.count, View.sum, View.min and View.max, and take a bounded top. View.circuit compiles the relations into one projection. Each unit updates only the affected keys in SQLite operator tables, appends the changed rows to generation-addressed State output streams, and commits the input checkpoint in the same transaction. Wrap the output with Projection.perGeneration and create the tables with View.migrate.

Views supports SQLite only: Bun SQLite and Cloudflare Durable Object SQLite. View.migrate fails on Postgres and MySQL.

The package is pre-1.0. When you change a circuit's plan, raise its generation so the binding rebuilds into a fresh namespace and output stream. A circuit whose stored plan hash differs fails with PlanChanged. A later release that changes the operator-table layout will mark it as a breaking change, and you raise generation on every affected circuit when you upgrade. Views

Publish

The following packages will be published if merged:

Package Version Registry
@streamsy/projection 0.13.0 npm
@streamsy/core 0.13.0 npm
@streamsy/serve 0.13.0 npm
@streamsy/storage 0.13.0 npm
@streamsy/views 0.13.0 npm

@github-actions
github-actions Bot force-pushed the tegami/version-packages branch 5 times, most recently from a7657a6 to 641ba97 Compare November 21, 2026 22:07
@github-actions
github-actions Bot force-pushed the tegami/version-packages branch from 641ba97 to 6357a96 Compare November 22, 2026 00:52
@gingerhendrix
gingerhendrix merged commit 4a9603a into main Nov 22, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant