8000 Release 0.2.1: no printing, YAML leases and listen, OpenAPI validation, spec fixes by arminhammer · Pull Request #42 · arminhammer/jackdaw · GitHub
[go: up one dir, main page]

Skip to content

Release 0.2.1: no printing, YAML leases and listen, OpenAPI validation, spec fixes - #42

Merged
arminhammer merged 14 commits into
mainfrom
post-0.2-followups
Nov 2, 2026
Merged

arminhammer merged 14 commits into
mainfrom
post-0.2-followups

Conversation

@arminhammer
@arminhammer arminhammer commented Nov 1, 2026 •
Copy link
Copy Markdown
Owner

This PR works through most of the open items in the library-refactor notes left after 0.2.0. Changelog entries are under Unreleased in CHANGELOG.md.

The library no longer prints

  • Before: a YAML run script's stdout and stderr went straight to the host process's terminal, through TaskOutputStreamer, whatever the application did. The --debug trace was also printed with println!.
  • Now: both are tracing events on the jackdaw::yaml target. Each event has an event field and JSON values as text. The events chapter of the guide documents the format.
    • The task-by-task trace is at DEBUG, because it carries inputs and outputs.
    • Script lines and listener startup are at INFO.
  • Deprecated: api::set_yaml_trace does nothing now.
  • Other logs: the gRPC listener's per-request diagnostics and the OpenAPI caller's request lines are DEBUG logs.
  • Dependencies: console is no longer a library dependency.
  • CLI: jackdaw-cli/src/trace.rs renders the events exactly as before. The CLI previously had no log formatter at all, so library warnings were invisible. It now prints warnings to stderr (debug with --verbose; RUST_LOG overrides).
  • Subscriber propagation: YAML runs, script output readers and listener servers now spawn with the caller's subscriber, as Rust workflows already did. A new test runs a YAML shell task under a scoped subscriber and checks that the output arrives as an event.

YAML instances on the engine

  • Engine::list, status and describe now include YAML instances, read from the interpreter's stored events. Before, these methods saw only Rust instances.
  • Leases: with EngineBuilder::lease, YAML instances are leased like Rust ones.
    • The lease is taken at start or resume and renewed with the others.
    • If another engine takes the lease, the run is stopped. The lease is released on a terminal event.
    • recover skips an instance whose lease another engine holds. Before, two engines could both resume one YAML instance.
    • The interpreter's own store writes go through a lease fence (api::fence::LeaseFence). An engine that lost the lease has its writes refused, as a Rust instance's are.
  • New specs:
    • "YAML instances are listed and described like Rust ones".
    • "A YAML instance is owned by one engine at a time".
    • Both pass on Redb, SQLite and Postgres.

YAML listen follows more of the spec

  • with: a string is an anchored regular expression. A runtime expression is evaluated against the workflow's data and matched the same way. Other values must be equal.
  • correlate: each event's from value must equal expect, or, without expect, the value from the first matching event.
  • Delivery across a restart: published events are also kept in a store stream, __jackdaw_emitted__. It has events but no checkpoint, so it is never listed as an instance. A listen task that resumes after a restart first offers the events emitted since it first started, then live ones, dropping duplicates by source and id. Before, an event emitted while the listener's engine was down was lost.
  • emit: a YAML emit task now stamps time from the engine's clock.
  • Retention: published events are stored in one stream per day. Engine::sweep deletes the days older than the retention period, and now also purges finished YAML instances.
  • Payload codec: with EngineBuilder::codec, the interpreter's event payloads and checkpoint data go through the codec, like Rust instances' records. Before, a YAML workflow's data was stored as plain JSON.
  • Engine clock: the interpreter stamps every event and checkpoint with the engine's clock. Some used the wall clock before, so an instance on a custom or test clock had timestamps from two clocks.

OpenAPI request validation

  • What it checks: Listener::openapi now checks each request against its operation before a workflow starts:
    • required parameters;
    • the schemas of path, query and header parameters;
    • the JSON request body's schema, with $refs into components resolved.
  • Schema dialect: 3.0 documents are read as JSON Schema draft 4, 3.1 documents as 2020-12.
  • Errors: a mismatch gets a 400 whose problems list each one, and no workflow starts. An invalid schema fails Listener::openapi.
  • Dependency: jsonschema, without default features (no remote $refs, no C code), only with http-listener. deny.toml allows MIT-0 for its dependency borrow-or-share.
  • TLS: left to a reverse proxy or sidecar, as the listener docs now say.
  • YAML HTTP listener: the YAML interpreter's own HTTP listener applies the same checks.
    • The operation is the document path that the listen URI's path ends with: /api/v1/add matches /add.
    • Without a matching path, the resource.name body schema applies.
    • A document that can't be read is skipped with a warning.

Fixes

  • HTTP listener parameters: the YAML HTTP listener used to report the last path segment of a GET or DELETE as petId, whatever the route said. It now names path parameters after the route and adds the query string, for every method. Both HTTP listeners share listeners::request_input.
  • #[catalog] without yaml: fails with one error that names the feature, instead of errors about missing __private items. The slim-build spec checks this.
  • Docs without features: no longer warn about links to feature-gated items.

The SQL-store stall in the specs

  • The bug: with several scenarios at once, the SQLite and Postgres spec runs used to stall: every thread parked, nothing progressing. It was in the test harness, not the library.
    • The harness opened SQL stores with block_in_place + Handle::block_on, on the thread that polls every scenario.
    • That nested block_on parks on the same thread-local parker, so it swallowed the wakeups meant for the other scenarios, and they were never polled again.
    • lldb showed exactly that.
  • The fix: stores now open on a thread of their own.
  • Timing races exposed by concurrent runs, fixed in the steps:
    • the saga compensation crash now waits for the parallel ReleaseStock record before crashing;
    • the drop-flush scenario is pinned to Redb, which is what it describes;
    • the YAML listener step waits for the workflow's completion to be stored.
  • Clock race: the harness moved the virtual clock once task calls were quiet for a few polls. A Postgres write under load could outlast that, so the subscription-billing scenarios lost cycles.
    • Each scenario's store is now wrapped in a counter (support::Tracked).
    • Time moves only when task calls, store operations and timers started have not changed, and no store operation is running.
  • Crash steps:
    • "A loop resumes at the iteration it was in" waited for any running call, not the blocked one, so it could crash mid-way through an earlier iteration.
    • The for_each row of "Every kind of step resumes ..." had the same problem.
    • Both now wait for the right call and for their siblings' records.
  • YAML trace test: moved to its own test binary. Tracing's per-callsite interest raced with other tests in the same process.
  • CI: both SQL-store spec jobs now run 8 scenarios at a time.

CI and tooling

  • semver job: cargo semver-checks -p jackdaw-wf --all-features against the latest crates.io release (just semver). The semver scenario in public_surface.feature is now @external.
  • deny job: cargo deny check licenses bans sources with a new deny.toml (just deny).
    • Licenses are allow-listed.
    • Wildcard versions and unknown registries or git sources fail.
    • Duplicate versions are only reported.
  • Docs job: also builds the docs without features.
  • SDK unit tests: the Open Workflow SDK's unit tests are now vendored as jackdaw/src/dsl/unit_tests.rs by just update-dsl (18 tests).

Testing

  • Full workspace run: 341 library scenarios, 77 Rust API tests, 50 doctests, and the CTK, listener and CLI suites all pass.
  • clippy passes with all features and for each feature on its own, and RUSTDOCFLAGS=-D warnings cargo doc passes with all features and without features.
  • The new YAML lease, list and listen specs also pass on SQLite and Postgres.
  • Docker integration tests: 21 pass against an image rebuilt from this branch.
  • Full library specs with 8 scenarios at a time:
    • Postgres: 3 clean runs.
    • Redb: 6 runs, all clean since the crash-step fix.
    • SQLite: no stall.
    • Neither the stall nor the rare Redb CPU-spin hang showed up, with the watchdog and lldb armed.
  • cargo +1.94 check --workspace --all-features --locked (MSRV) passes; cargo deny passes.

Not covered yet:

  • The rare Redb hang from October has not come back but was never caught.

🤖 Generated with Claude Code

arminhammer and others added 12 commits November 1, 2026 15:12
…d semver and deny checks

- The YAML interpreter's HTTP listener names path parameters after the route and adds the query string, for every
  method, instead of reporting the last segment of a GET or DELETE as `petId`. Both HTTP listeners now build a
  request's input with one helper (`listeners::request_input`).
- `#[catalog]` wraps its expansion in `__private::catalog!`, which is a compile_error naming the `yaml` feature when
  jackdaw is built without it. The slim-build spec checks the message.
- Links to feature-gated items no longer warn in docs built without those features; CI builds the docs without
  features too.
- CI: `cargo semver-checks` against the latest release (`just semver`) and `cargo deny` for licenses, wildcards and
  sources (`deny.toml`, `just deny`). The semver scenario is now `@external`.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
`just update-dsl` now also copies the SDK's `core/src/lib.rs` unit tests into `jackdaw/src/dsl/unit_tests.rs`
(dropping its `mod models;` line and using serde-saphyr in place of serde_yaml), and the library runs them as
`dsl_unit_tests`. serde-saphyr's `serialize` feature is enabled for tests only.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Trace:
- The YAML interpreter's trace, script output and listener startup are `tracing` events on the `jackdaw::yaml`
  target (documented in the events chapter). A YAML script task's output used to go to the host process's
  stdout and stderr.
- `set_yaml_trace` is deprecated and does nothing. The gRPC listener and OpenAPI caller log at DEBUG.
- `console` is no longer a library dependency. The CLI renders the trace (`jackdaw-cli/src/trace.rs`) as before,
  and now also logs warnings to stderr (debug with `--verbose`, `RUST_LOG` overrides).
- YAML runs, script output readers and listener servers spawn with the caller's subscriber
  (`api::observe::spawn`).

YAML instances:
- `Engine::list`, `status` and `describe` include YAML instances, read from the interpreter's stored events.
- With `EngineBuilder::lease`, YAML instances are leased:
  - an engine takes the lease on start or resume, and renews it with the Rust instances' leases;
  - it stops the run if another engine takes the lease, and releases the lease on a terminal event;
  - `recover` skips an instance whose lease another engine holds.
- New specs: "YAML instances are listed and described like Rust ones" and "A YAML instance is owned by one engine
  at a time".

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…eners see missed events

- `with` strings are regular expressions the whole attribute must match. A runtime expression is evaluated against
  the workflow's data, and its value is matched the same way. Other values must be equal.
- `correlate`: `from` is evaluated against each event and must equal `expect`, or, without `expect`, the value from
  the first matching event.
- The interpreter keeps every published event in the store's `__jackdaw_emitted__` stream. The stream has events
  and no checkpoint, so it is never listed as an instance.
- A listen task that resumes after a restart first offers the events emitted since it first started, then live
  ones. Duplicates are dropped by `source` and `id`.
- YAML `emit` stamps `time` from the engine's clock.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The spec harness opened SQLite and Postgres stores with `block_in_place` and `Handle::block_on`, on the thread that
polls every scenario. That nested `block_on` parks on the thread's own parker, so it took the wakeups meant for the
other scenarios, and they were never polled again. A run with 8 SQL-store scenarios at a time stalled within
minutes. Stores now open on a thread of their own (`open_blocking`).

With scenarios running concurrently, "A crash during compensation finishes the compensation" could also crash
before SQLite had stored the result of the parallel `ReleaseStock`, which then rightly ran again. The step now
waits for that result to be stored before it crashes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
`Listener::openapi` now compiles, for each operation:
- its parameters: path, query and header, with the path item's parameters overridden by the operation's;
- its JSON request body schema, with local `$ref`s resolved against `components`;
- schemas as JSON Schema draft 4 for 3.0 documents and 2020-12 for 3.1.

Each request is checked against them before a workflow starts. A parameter value passes if it matches as text or as
the JSON it spells. A mismatch gets a 400 whose `problems` list each one. An invalid schema fails
`Listener::openapi`.

Uses `jsonschema` without default features (no remote references, no C code) under `http-listener`. `deny.toml`
allows MIT-0 (borrow-or-share) and drops the BlueOak allowance, which only dev-dependencies needed. The listener docs
say TLS is for a proxy or sidecar.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…g steps

With the harness stall fixed, the SQLite spec job runs 8 scenarios at a time. Postgres stays at one: with several at
once, the subscription-billing scenarios still lose cycles to the clock race.

- "Dropping the engine flushes the store" pins Redb, which it is about.
- The YAML listener step waits for the workflow's completion to be stored, not only the task's.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…cs concurrently

The spec harness moved its clock once task calls had been quiet for a few polls. Under load, a Postgres write
between a charge and the next `sleep` could outlast that, and the clock jumped before the workflow had registered
its next timer. That is how the subscription-billing scenarios lost cycles when several scenarios ran at once.

Each durable store a scenario opens is now wrapped in `support::Tracked`, which counts the operations in flight
and started. Time moves only when task calls, store operations and timers started have not changed for a few
polls, and no store operation is running. Lease and message polls, which engines with leases make all the time,
are not counted.

With this and the earlier stall fix, Postgres passes the full specs 8 at a time, so the SQL-store CI job no longer
limits the concurrency.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…alidate its HTTP requests

- Lease fence: with `EngineBuilder::lease`, the YAML interpreter writes through `api::fence::LeaseFence`.
  - Before each write for an instance, it checks the instance's lease, renewing it once less than half is left.
  - It refuses the write when another engine holds the lease.
  - The engine's own `__jackdaw*` records pass through.
- Retention: published events are kept in one store stream per day (`__jackdaw_emitted__/<date>`).
  - `Engine::sweep` deletes the days older than the retention period.
  - It also purges finished YAML instances, which it used to skip.
- Clock: the interpreter now takes every stored timestamp from the engine's clock (`ExecutionServices::clock`).
  Some events used the wall clock, so instances had timestamps from two clocks, and a sweep on a custom clock
  misjudged their age.
- HTTP validation: the interpreter's HTTP listener checks requests against the listen task's OpenAPI document
  with the engine listener's rules.
  - `RequestRules::for_route` picks the operation whose path the listen URI's path ends with, or the body schema
    named by `resource.name`.
  - An unreadable document is skipped with a warning.
- Tests: the YAML trace test gets its own test binary. Sharing a process with tests that run YAML workflows without
  a subscriber made tracing's per-callsite interest race, and the test sometimes missed events.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
"A loop resumes at the iteration it was in" crashed once any `tick` call was running, which on a loaded machine
could be an earlier iteration than the blocked one. A crash just after that call returned, before its record was
stored, rightly ran it again, and the scenario failed. It now waits for the blocked iteration.

The `for_each` row of "Every kind of step resumes without repeating completed work" had the same race, plus another:
items run beside the blocked one. It now waits until the blocked item runs, every other item that started has
finished, and their results are stored.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@arminhammer arminhammer changed the title Post-0.2 follow-ups: no printing, YAML leases and listen, OpenAPI validation, spec stall fix Release 0.2.1: no printing, YAML leases and listen, OpenAPI validation, spec fixes Nov 1, 2026
arminhammer and others added 2 commits November 1, 2026 19:03
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
With `EngineBuilder::codec`, the YAML interpreter's store is wrapped in `api::fence::CodecStore`, under the lease
fence. It encodes event payloads (inputs, task results, outputs, published events) and checkpoint data, and decodes
them on read. Before, only Rust instances' journals and history were encoded, so a YAML workflow's data was stored
as plain JSON. Records without the codec envelope still read.

`Engine::list`, `describe` and `recover` decode the YAML records they read, as `history` already did.

New spec: "A YAML workflow's payloads go through the codec too".

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@arminhammer
arminhammer merged commit 5785f14 into main Nov 2, 2026
18 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

0