Repository navigation
Release 0.2.1: no printing, YAML leases and listen, OpenAPI validation, spec fixes - #42
Merged
Merged
Conversation
…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>
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
runscript's stdout and stderr went straight to the host process's terminal, throughTaskOutputStreamer, whatever the application did. The--debugtrace was also printed withprintln!.tracingevents on thejackdaw::yamltarget. Each event has aneventfield and JSON values as text. The events chapter of the guide documents the format.DEBUG, because it carries inputs and outputs.INFO.api::set_yaml_tracedoes nothing now.DEBUGlogs.consoleis no longer a library dependency.jackdaw-cli/src/trace.rsrenders 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_LOGoverrides).YAML instances on the engine
Engine::list,statusanddescribenow include YAML instances, read from the interpreter's stored events. Before, these methods saw only Rust instances.EngineBuilder::lease, YAML instances are leased like Rust ones.recoverskips an instance whose lease another engine holds. Before, two engines could both resume one YAML instance.api::fence::LeaseFence). An engine that lost the lease has its writes refused, as a Rust instance's are.YAML
listenfollows more of the specwith: 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'sfromvalue must equalexpect, or, withoutexpect, the value from the first matching event.__jackdaw_emitted__. It has events but no checkpoint, so it is never listed as an instance. Alistentask that resumes after a restart first offers the events emitted since it first started, then live ones, dropping duplicates bysourceandid. Before, an event emitted while the listener's engine was down was lost.emit: a YAMLemittask now stampstimefrom the engine's clock.Engine::sweepdeletes the days older than the retention period, and now also purges finished YAML instances.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.OpenAPI request validation
Listener::openapinow checks each request against its operation before a workflow starts:$refs intocomponentsresolved.problemslist each one, and no workflow starts. An invalid schema failsListener::openapi.jsonschema, without default features (no remote$refs, no C code), only withhttp-listener.deny.tomlallows MIT-0 for its dependencyborrow-or-share./api/v1/addmatches/add.resource.namebody schema applies.Fixes
petId, whatever the route said. It now names path parameters after the route and adds the query string, for every method. Both HTTP listeners sharelisteners::request_input.#[catalog]withoutyaml: fails with one error that names the feature, instead of errors about missing__privateitems. The slim-build spec checks this.The SQL-store stall in the specs
block_in_place+Handle::block_on, on the thread that polls every scenario.block_onparks on the same thread-local parker, so it swallowed the wakeups meant for the other scenarios, and they were never polled again.ReleaseStockrecord before crashing;support::Tracked).for_eachrow of "Every kind of step resumes ..." had the same problem.CI and tooling
semverjob:cargo semver-checks -p jackdaw-wf --all-featuresagainst the latest crates.io release (just semver). The semver scenario inpublic_surface.featureis now@external.denyjob:cargo deny check licenses bans sourceswith a newdeny.toml(just deny).jackdaw/src/dsl/unit_tests.rsbyjust update-dsl(18 tests).Testing
RUSTDOCFLAGS=-D warnings cargo docpasses with all features and without features.cargo +1.94 check --workspace --all-features --locked(MSRV) passes;cargo denypasses.Not covered yet:
🤖 Generated with Claude Code