Skip to content
Playground(another site)

v0.154.0

Released on 10 July 2026 as v0.154.0, with the increments from v0.143.0 to v0.154.0. See Upgrading for what to change when you move to it.

VersionHighlights
v0.154.0Declared error embeddings — ? auto-converts a cross-context error (grammar + checker + emitter + tooling; ADR 0178, closes #543). Every cross-context chain paid a .mapErr(toLocalError) tax to lift a called context’s error into the caller’s — the single largest ergonomic tax in the language’s flagship pattern. A sum type may now declare embeddings: `type OrderError = …
v0.153.0? lifts an Option into an HttpResult handler — None → 404 (checker + emitter; ADR 0177, addresses #543). The KV-read → decode → respond pattern was a two-deep match pyramid because ? reached only Result values, never the Option a storage read yields. Now, inside a handler whose return peels to HttpResult[T] (a bare HttpResult[T] function or Effect[HttpResult[T]]), option? lifts: Some(v) yields v, and None early-returns NotFound (404) — the canonical “absent resource” status — collapsing the outer half of the pyramid to one postfix ?. Emitted as the existing check-and-early-return shape (if (o.tag === "None") return HttpResult.NotFound;), reusing the Option/HttpResult runtime with no new construct; a commons body that names HttpResult now imports it (a latent single-file gap this exposes). Option? outside an HttpResult handler is rejected with the new bynk.types.question_option_outside_http (use .okOr(err) to make a Result elsewhere); a Result under ? is unchanged. This is the Option→HttpResult half of the review finding’s ?-extension; the Result→HttpResult direction (mapping a declared domain error to a status, via embeds) is a separate later slice, so #543 stays open. No grammar or runtime change.
v0.152.0The Effect[Result[T, E]] combinators — mapOk / mapErr / flatMapOk / flatMapErr (checker + emitter + tooling; ADR 0176, addresses #543). Effect[Result[T, E]] is the universal shape of a cross-context call, but recovery and success/error reshaping had no direct surface — every transform was a <- peel followed by a match, and the designed combinators (design doc §2.8.3) had never shipped. The four compiler-synthesised methods now transform the shape in place: e.mapOk(f: T -> U) -> Effect[Result[U, E]] and e.mapErr(f: E -> F) -> Effect[Result[T, F]] map the two sides of the split; e.flatMapOk(f: T -> Effect[Result[U, E]]) chains a further effectful-fallible step on success (single error type E, as ?); e.flatMapErr(f: E -> Effect[Result[T, F]]) attempts an effectful recovery on error (its recovery must produce the receiver’s T). They are syntactic sugar — the desugaring (mapOk ≡ map(r => r.map(f)), etc.) is the semantics — emitted inline as an async IIFE that awaits the receiver Promise<Result<…>> and rebuilds the transformed Result, tsc --strict-clean with no runtime import. Named methods (not implicit .map lifting) resolve the “which .map?” ambiguity on Effect[Result]; unlike the eager List iterators they produce an Effect rather than run one, so they are not effectful-context-confined. Only an Effect wrapping a Result carries them; other Effect-of-X shapes are unchanged. No new diagnostic (method_not_found/argument_mismatch/method_arity reused), no grammar or runtime change; completion/signature-help via the kernel registry (ADR 0156). The ?-into-Effect[HttpResult] lifts and declared error embeddings from the same review finding remain later slices.
v0.151.0Oidc — OIDC/JWKS authentication for actors (grammar + checker + emitter + runtime; ADR 0175, closes #553). The auth-scheme set was closed to None|Internal|Bearer|Signature with no route to OIDC — real systems hit that wall immediately. The set now opens with a compiler-generated Oidc scheme: actor User { auth = Oidc(issuer = "…", audience = "…", jwks = "…"), identity = UserId } on a from http route emits, before the body runs, a fail-closed boundary that extracts Authorization: Bearer <jwt>, verifies the RS256/ES256 signature against the provider’s published JWKS (fetched and cached, refetched on a kid miss for rotation — rate-limited by a cooldown so an attacker-chosen kid cannot amplify into fetches), enforces iss/aud/exp/nbf (with a small clock-skew leeway), and mints the identity from the sub claim — 401 on any failure. Chosen as a widening of the closed scheme enum (ADR 0080), not a user-supplied Verifier[T] capability: a user verifier reintroduces the hand-written-crypto footgun ADR 0085 removed, whereas OIDC is a standard the compiler can own totally, keeping the “an actor emits no TypeScript” invariant. Unlike Bearer/Signature, an Oidc trust declaration names no secret — its root is the provider’s public keys — and it demonstrates the reconsidered stance on secrets-in-contracts: public trust parameters belong in the contract, secrets do not. alg: none and symmetric HS* are rejected (algorithm-confusion). HTTP-only and single-actor this slice (not a sum member, not a refinement base); OIDC discovery and a user Verifier[T] are deferred. The docs also state explicitly that the model covers who is at the boundary, not whose an object is — object-level authorisation is handler code, by design. New diagnostics oidc_missing_issuer/oidc_missing_audience/oidc_missing_jwks/oidc_identity_not_string_constructible/oidc_not_in_sum; new runtime verifyOidcJwt with a standing bypass-class regression guard.
v0.150.0List.traverseTry / parTraverseTry — the short-circuit collect iterators (checker + emitter + tooling; ADR 0174). The last empty cell in the effectful-iteration matrix: discard (forEach/parTraverse) and gather-all (traverseAll/parTraverseAll) shipped, but not the everyday “apply a fallible f, stop at the first Err, return the successes” form — callers had to traverseAll then hand-scan the List[Result], running every element even after a failure. traverseTry/parTraverseTry(f: T -> Effect[Result[U, E]]) -> Effect[Result[List[U], E]] are the fault-propagating counterpart to the fault-gathering traverseAll: traverseTry awaits each element in order and returns immediately on the first Err (later elements never run); parTraverseTry issues all at once, awaits, then returns the first Err in input order (in-flight calls aren’t cancelled). Shipped as new distinct names, not a return-type overload on traverse/parTraverse — the design-notes overload vision would need return-type overload dispatch (a new type-system mechanism) plus a breaking migration of traverse off the stdlib; distinct names are additive and non-breaking (Try evokes the ? short-circuit). Same check_try_fn_arg inference and argument_mismatch gate as traverseAll, effectful-context-confined, no new diagnostic; emitted inline (return Err(...) on the first, else Ok(collected)), tsc --strict-clean. Both also reach a store Map[K, Connection] via the ADR 0173 broadcast (borrow path — send OK, close → consume_on_borrow). Completion/signature-help via the kernel registry; no grammar or runtime change (ADR 0156).
v0.149.0Map.values() and broadcast collect-all (checker + emitter + tooling; ADR 0173, closes #570). Two separable gaps the #569 review surfaced. (1) Map.values() -> List[V] — the keys() sibling, lowered [...(m).values()] over the in-memory ReadonlyMap; a value map never holds a Connection, so no held interaction. (2) Broadcast collect-all — the ADR 0172 iterators traverseAll/parTraverseAll were List-only and absent from is_query_op, so they could not reach a store Map[K, Connection] (only forEach/parTraverse could). Wiring both into the query broadcast lets conns.traverseAll((c) => …) lift the store map to Query[Connection] and route through the same proven held-borrow path — each connection is borrowed into the closure (send allowed, close/transfer rejected as bynk.held.consume_on_borrow), the map keeps ownership, and the closure returns Effect[Result[U, E]] so every outcome is gathered into Effect[List[Result[U, E]]]. This resolves #570’s coverage gap: the held-borrow path for the collect-all iterators is now reachable and fixtured (negative/332_broadcast_collect_all_consume, positive/338_ws_broadcast_collect_all) — via the Map broadcast, not a constructed List[Held]. (3) An owned List[HeldResource] is documented as an intentional non-goal: #570’s originally-recommended borrow-scoped Map.values() -> List[Connection] would need a new soundness-critical “chain-only borrow” linearity rule, and the broadcast route reaches the same capability through existing machinery, so it’s declined. No new diagnostic, no grammar or runtime change (ADR 0156).
v0.148.0List.traverseAll / List.parTraverseAll — the collect-all iterators (checker + emitter + tooling; ADR 0172). The effectful List iterators covered discard (forEach/parTraverse) and short-circuiting sequential collect (the stdlib traverse), but not the fault-gathering case: run a fallible f over each element and keep every outcome (form validation that reports all errors, bulk processing where partial success matters, compensation tracking). traverseAll(f: T -> Effect[Result[U, E]]) -> Effect[List[Result[U, E]]] runs f over each element in order; parTraverseAll runs them concurrently — neither short-circuits, gathering every Ok/Err into the result list in input order. This is sound and cheap precisely because a Bynk Result Err is a value, not a fault: f resolves to a tagged Ok/Err, never a rejection, so a sequential loop and Promise.all both collect every outcome for free (no allSettled, no fault interception). The function’s return type is inferred (via the same check_kernel_fn_arg unification map uses for U) and required to be Effect[Result[U, E]] — a non-Result effect is bynk.types.argument_mismatch (no new diagnostic); both are effectful-context-confined like forEach. Emitted inline — traverseAll as the foldEff push-collect into a typed Result<U, E>[], parTraverseAll as the parTraverse Promise.all keeping the resolved array — tsc --strict-clean, no runtime import, no churn to forEach/parTraverse/foldEff. Kernel methods per ADR 0116’s direction; the short-circuiting collect overload remains a named later slice. Completion/signature-help via the kernel registry; no grammar or runtime change (ADR 0156).
v0.147.0List.parTraverse — the concurrent sibling of List.forEach (checker + emitter + tooling; ADR 0171). ADR 0170 shipped the sequential List.forEach and deferred the parallel form; an eager List had no way to fan out N independent effects at once — a batch (notify every subscriber, fire N probes) ran serially through forEach, paying the sum of the latencies, while Query/storage already carried a concurrent parTraverse (ADR 0135). List.parTraverse(f: T -> Effect[()]) -> Effect[()] runs f over every element concurrently and awaits them together, so a slow element does not head-of-line-block the rest (the side-effect interleaving order is unspecified; the call completes only when all elements have). It has the same type as forEach — the checker arm is merged (`FOR_EACH
v0.146.0The do statement, implicit unit, and List.forEach (grammar/AST + checker + emitter + formatter + tooling; ADR 0170, closes #542). Everyday effect code carried avoidable ceremony the design review counted across the examples: an effect used only for its side effect had to be let _ <- e (~30×), a unit body closed with Effect.pure(()), a conditional effect owed else Effect.pure(()), and running an effect over a List degenerated to a unit-accumulator foldEff — uptime-monitor could not loop over its targets and copy-pasted the fetch/store block per target. Four additive changes, all over shapes that already compile plus one missing terminal: (1) do e — a keyword effect statement, the binder-free let _ <- e for a unit effect; it must be Effect[()] (a valued reply keeps the explicit let _ <- e, so discarding a real value stays visible). (2) Implicit unit tail — a block may close with no tail (the parser synthesises (), auto-lifted to Effect[()]), so an effectful unit body may simply end; an empty {} is now legal (unit). (3) Else-less if — if c { e } defaults a missing else to (), legal only for a unit then-branch (bynk.types.if_without_else_requires_unit); a valued if still owes its else. (4) List.forEach(f: T -> Effect[()]) -> Effect[()] — the Query.forEach terminal over an eager list, sequential, effectful-context-confined like foldEff, emitted inline (no runtime import, no foldEff churn). New diagnostics bynk.effect.do_in_pure_context / do_on_non_effect / do_requires_unit and bynk.types.if_without_else_requires_unit; do is a reserved keyword. sessions and uptime-monitor are rewritten to the new forms. Tooling: List.forEach completion/signature-help via the kernel registry, a do keyword token in the tree-sitter grammar (parser.c + grammar.json regenerated, v0.146 corpus entries added); hover unchanged (ADR 0156). Closes #542.
v0.145.0Editor surface catches up to nested payload patterns + match-arm guards (tooling; ADR 0169/ADR 0156, closes #565). The two editor-surface halves deferred from v0.144 — the tree-sitter CLI could not be installed in that environment, and nested-variant completion was a named fast-follow. (1) tree-sitter. grammar.js now describes the post-0169 shapes: a match_arm carries an optional if guard (pattern ("if" expression)? "=>" …), and a variant payload is a full sub-pattern (recursion), so Some(Ok(x)) / Err(PollClosed) parse as nested variant_pattern nodes and _ as a wildcard_pattern — the flat positional_binding node is retired (a bare lowercase name is a payload-less variant_pattern, highlighted @variable by capitalisation, an uppercase-led one @constant). parser.c + grammar.json regenerated, a v0.145 corpus entry added for a nested pattern and a guarded arm, and the bynk-grammar production reference re-blessed. (2) LSP. A pre-existing base gap: scrutinee_variant_completions required a user-declared Ty::Named and bailed on Result/Option, so match-arm / is completion never fired for a Result/Option scrutinee — it now offers Ok/Err and Some/None (variants_for_ty). Built on that, nested-variant completion: inside OuterVariant(‸ within a match arm, the editor resolves the payload field type (Result/Option/HttpResult generic args, or a user-sum decl’s field walked from source — the same shape as bynk-emit’s payload_field_ty) and offers that type’s variants — Ok/Err inside Some(‸) on an Option[Result[…]]. Hover, semantic tokens, and signature help are unchanged (ADR 0169). No language/compiler change. Closes #565.
v0.144.0Nested payload patterns + match-arm guards (grammar/AST + checker + emitter + formatter; ADR 0169, closes #541). Patterns were shallow — a variant payload bound only a name, never a nested pattern, and a match arm had no guard — so the two everyday shapes that follow from errors-as-values could not be expressed: error causes could not discriminate (Err(PollClosed) / Err(UnknownChoice) collided with bynk.types.duplicate_variant_arm, because coverage was a flat set of outer variant names), and an Option[Result[…]] forced a double-match stack. A payload binding is now a full sub-pattern, so payloads nest — Some(Ok(x)), Err(PollClosed) — and an arm may carry a trailing if guard over its bindings (Ok(r) if r.status == 200 => …). Coverage became bounded structural: Some(Ok(_)) / Some(Err(_)) / None is provably exhaustive with no wildcard, a missing nested variant reports non_exhaustive_match with a nested witness, duplicate_variant_arm keys on pattern shape, and a guarded arm never satisfies exhaustiveness. A lowercase-led identifier in pattern position is a binding, an uppercase-led one a variant (the universal capitalisation convention) — so Err(Declined) now discriminates the nested variant where it previously bound the payload to an oddly-cased name. Nested/guarded matches lower to an if / else-if chain (a switch on .tag expresses neither a nested test nor a guard); flat, unguarded matches emit the unchanged switch, so no existing output churns, and per-arm source-map anchoring (ADR 0103) is preserved. New diagnostic bynk.types.guard_not_bool. No runtime change. Refined where patterns (#472), or-patterns (#474), and record patterns remain planned, extending this increment’s recursive Pattern node and if-chain path. The if guard already highlights as a keyword; the tree-sitter grammar parser.c regeneration and nested-variant completion are named follow-ups (ADR 0156). Closes #541.
v0.143.0Refined types inherit their base type’s read-only kernel methods (checker + emitter; ADR 0168, closes #561, resolves finding #537). A refined String dropped every string method — fn shout(n: Name) -> String { n.toUpper() } failed with bynk.types.method_not_found — so examples reached for a plain String where a refined type belonged, or laundered a value back through "\(name)" interpolation. This punished exactly the users who adopted the flagship feature. A refined receiver now resolves its base type’s read-only kernel methods (the String, numeric, Duration, Instant, and Bytes kernels) as a fallback after its own declared methods, and the result is base-typed: n.toUpper() type-checks and returns String, never Name — the same widening a refined value already undergoes in arithmetic, comparison, assignment, and ordering keys, so it needs no new mental model. Declared methods win (the kernel is a strict fallback, never a shadow). Opaque types are unaffected — they deliberately do not widen, so a kernel call on an opaque receiver stays method_not_found. Bool has no kernel, so a Bool-based refinement inherits nothing. No new syntax; the emitted TypeScript for an inherited call is byte-identical to a plain base receiver’s (a refined value erases to its branded base). Completion and signature help now offer the inherited kernel on a refined receiver (ADR 0063 methods_for; hover/semantic-tokens unchanged, ADR 0156).