8000 chore(deps): upgrade jsonschema to 0.62 and redb to 5 by arminhammer · Pull Request #68 · arminhammer/jackdaw · GitHub
[go: up one dir, main page]

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,15 @@ The workspace publishes three crates with the same version: `jackdaw-wf` (the li

## [Unreleased]

### Changed

- **Breaking for code that uses redb types with jackdaw:** `redb` is now 5 (was 4). `RedbPersistence::db`,
`RedbCache::new` and the `*_TABLE` definitions in `providers::persistence::redb` are redb types, so a program that
passes in or reads its own `redb::Database` must move to redb 5 too. Programs that use `Redb::open` or
`RedbPersistence::new` need no change.
- `jsonschema` is now 0.62 (was 0.61), with its fixes to how `$ref`, `$dynamicRef` and `$schema` resolve. The HTTP
listener may judge a request differently against an OpenAPI schema that depends on those.

## [0.3.0] - 2026-11-24

### Added
Expand Down
22 changes: 11 additions & 11 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions jackdaw/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ petgraph = { version = "0.8", optional = true }
async-recursion = { version = "1.0", optional = true }

# stores
redb = { version = "4", optional = true }
redb = { version = "5", optional = true }

# What needs an operating system underneath: child processes, sockets, C libraries, Docker, and the HTTP client (reqwest
# on wasm is the browser's `fetch`, which cannot run on WASI and whose futures are not `Send`). On wasm none of it is
Expand Down Expand Up @@ -87,7 +87,7 @@ bollard = { version = "0.21", optional = true }
# http-listener
axum = { version = "0.8", optional = true }
# OpenAPI request validation in the engine's HTTP listener. Without default features: no remote `$ref`s, no C TLS.
jsonschema = { version = "0.61", default-features = false, optional = true }
jsonschema = { version = "0.62", default-features = false, optional = true }

# grpc-listener
tonic = { version = "0.14", optional = true }
Expand Down
2 changes: 1 addition & 1 deletion jackdaw/src/providers/cache/redb.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! A cache in a Redb file, usually the same file as the [`RedbPersistence`](crate::providers::persistence::RedbPersistence) store.
use crate::cache::{CacheEntry, CacheProvider, Error, Result, SerializationSnafu};
use async_trait::async_trait;
use redb::ReadableDatabase as _;
use redb::{ReadableDatabase as _, ReadableTable as _};
use snafu::prelude::*;
use std::sync::Arc;

Expand Down
12 changes: 6 additions & 6 deletions jackdaw/src/providers/persistence/redb.rs
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ impl PersistenceProvider for RedbPersistence {
// Only this instance's keys: `{id}:` up to (not including) `{id};`.
let (start, end) = (format!("{instance_id}:"), format!("{instance_id};"));
let range = table
.range::<&str>(start.as_str()..end.as_str())
.range(start.as_str()..end.as_str())
.map_err(|e| Error::Database {
message: format!("Failed to create range: {e}"),
})?;
Expand Down Expand Up @@ -272,7 +272,7 @@ impl PersistenceProvider for RedbPersistence {
let (start, end) = journal_range(&instance_id);
let mut records = Vec::new();
for item in table
.range::<&str>(start.as_str()..end.as_str())
.range(start.as_str()..end.as_str())
.map_err(|e| db_error("Failed to create range", e))?
{
let (key, value) =
Expand Down Expand Up @@ -310,7 +310,7 @@ impl PersistenceProvider for RedbPersistence {
journal_key(&instance_id, before)
};
table
.retain_in::<&str, _>(start.as_str()..end.as_str(), |_, _| false)
.retain_in(start.as_str()..end.as_str(), |_, _| false)
.map_err(|e| db_error("Failed to prune the journal", e))?;
}
write_txn
Expand Down Expand Up @@ -363,7 +363,7 @@ impl PersistenceProvider for RedbPersistence {
.map_err(|e| db_error("Failed to open checkpoints table", e))?;
let mut ids = Vec::new();
for item in table
.range::<&str>(..)
.range(..)
.map_err(|e| db_error("Failed to create range", e))?
{
let (key, _) = item.map_err(|e| db_error("Failed to read a checkpoint", e))?;
Expand Down Expand Up @@ -394,14 +394,14 @@ impl PersistenceProvider for RedbPersistence {
.map_err(|e| db_error("Failed to open events table", e))?;
let (start, end) = (format!("{instance_id}:"), format!("{instance_id};"));
events
.retain_in::<&str, _>(start.as_str()..end.as_str(), |_, _| false)
.retain_in(start.as_str()..end.as_str(), |_, _| false)
.map_err(|e| db_error("Failed to delete events", e))?;
let mut journal = write_txn
.open_table(JOURNAL_TABLE)
.map_err(|e| db_error("Failed to open journal table", e))?;
let (start, end) = journal_range(&instance_id);
journal
.retain_in::<&str, _>(start.as_str()..end.as_str(), |_, _| false)
.retain_in(start.as_str()..end.as_str(), |_, _| false)
.map_err(|e| db_error("Failed to delete the journal", e))?;
let mut leases = write_txn
.open_table(LEASES_TABLE)
Expand Down
29 changes: 21 additions & 8 deletions jackdaw/tests/listen_read_modes_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ use serde_json::json;
use std::env;
use std::path::PathBuf;
use std::sync::Arc;
use std::time::{Duration, Instant};
use tempfile::TempDir;

use crate::yaml_engine::YamlEngine;
Expand All @@ -37,6 +38,22 @@ async fn setup_test_engine(temp_dir: &TempDir) -> YamlEngine {
.unwrap()
}

/// Waits until the workflow's listener accepts connections. It starts after `execute` returns, and how long that
/// takes depends on the machine (the store's first writes are synced to disk), so a fixed delay is not enough.
async fn wait_for_listener(port: u16) {
let started = Instant::now();
while tokio::net::TcpStream::connect(("127.0.0.1", port))
.await
.is_err()
{
assert!(
started.elapsed() < Duration::from_secs(30),
"no listener on port {port} after 30s"
);
tokio::time::sleep(Duration::from_millis(20)).await;
}
}

#[tokio::test]
async fn test_listen_read_mode_data() {
// Set up Python path for handler
Expand All @@ -59,8 +76,7 @@ async fn test_listen_read_mode_data() {
.await
.expect("Failed to start workflow");

// Give listener time to start
tokio::time::sleep(tokio::time::Duration::from_millis(200)).await;
wait_for_listener(8081).await;

// Send a CloudEvent to the listener
let client = reqwest::Client::new();
Expand Down Expand Up @@ -123,8 +139,7 @@ async fn test_listen_read_mode_envelope() {
.await
.expect("Failed to start workflow");

// Give listener time to start
tokio::time::sleep(tokio::time::Duration::from_millis(200)).await;
wait_for_listener(8082).await;

// Send a CloudEvent to the listener
let client = reqwest::Client::new();
Expand Down Expand Up @@ -202,8 +217,7 @@ async fn test_listen_read_mode_raw() {
.await
.expect("Failed to start workflow");

// Give listener time to start
tokio::time::sleep(tokio::time::Duration::from_millis(200)).await;
wait_for_listener(8083).await;

// Send raw JSON (not necessarily a CloudEvent) to the listener
let client = reqwest::Client::new();
Expand Down Expand Up @@ -264,8 +278,7 @@ async fn test_listen_read_mode_default_is_envelope() {
.await
.expect("Failed to start workflow");

// Give listener time to start
tokio::time::sleep(tokio::time::Duration::from_millis(200)).await;
wait_for_listener(8084).await;

// Send a CloudEvent to the listener
let client = reqwest::Client::new();
Expand Down
0