Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
b711cf2
test(session): add file and MongoDB storage conformance tests
senamakel Oct 18, 2026
564ddf1
test(run_ledger): cover driver conformance and scope isolation
senamakel Oct 18, 2026
fa5d02e
style(tinyagents-session): reorder imports and reflow mongodb test setup
senamakel Oct 18, 2026
0b4319b
chore: files changed Cargo.lock
senamakel Oct 18, 2026
c55502a
test(session): remove file backend ledger conformance test
senamakel Oct 18, 2026
15d047d
test(run_ledger): cover file driver workflow run round trip and scope…
senamakel Oct 18, 2026
5d7d897
test(run_ledger): cover file driver lease races and unsupported atomi…
senamakel Oct 18, 2026
cf71139
test(run_ledger): cover atomic team task claim rejection
senamakel Oct 18, 2026
0555ac1
docs(session): document FileStorage conformance coverage
senamakel Oct 18, 2026
29c7ec2
test(run-ledger): assert raw storage snapshots in driver tests
senamakel Oct 18, 2026
768ea7f
test(run-ledger): capture team snapshots after seeding
senamakel Oct 18, 2026
b504700
style: format run ledger driver tests
senamakel Oct 18, 2026
cd0ca3f
refactor(session): move MongoDB conformance tests to integration-proofs
senamakel Oct 18, 2026
d0d87f2
chore: files changed Cargo.lock,crates/tinyagents-session/src/testkit…
senamakel Oct 18, 2026
e0c5406
style(integration-proofs): reformat session driver conformance test
senamakel Oct 18, 2026
667a130
test(run_ledger): remove unused ledger conformance helper
senamakel Oct 18, 2026
dc01151
chore(integration-proofs): refresh run-ledger-mongodb lockfile
senamakel Oct 18, 2026
4988f64
test(session-driver-conformance): shorten generated MongoDB database …
senamakel Oct 18, 2026
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
38 changes: 38 additions & 0 deletions .github/scripts/start-session-mongo-replset.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#!/usr/bin/env bash
# Start the same single-node replica-set fixture used by tinystoragedrivers.
set -euo pipefail

port="${1:-27017}"
image="${2:-mongo:7}"
name="tinyagents-session-mongo"

cleanup() {
if [[ $? -ne 0 ]]; then
docker rm -f "$name" >/dev/null 2>&1 || true
fi
}
trap cleanup EXIT

docker run -d --rm --name "$name" -p "127.0.0.1:${port}:27017" "$image" \
--replSet rs0 --bind_ip_all >/dev/null

for _ in $(seq 1 60); do
if docker exec "$name" mongosh --quiet --eval 'db.adminCommand({ping: 1}).ok' >/dev/null 2>&1; then
break
fi
sleep 1
done

docker exec "$name" mongosh --quiet --eval \
'rs.initiate({_id: "rs0", members: [{_id: 0, host: "localhost:27017"}]})' >/dev/null

for _ in $(seq 1 60); do
if [[ "$(docker exec "$name" mongosh --quiet --eval 'db.hello().isWritablePrimary')" == "true" ]]; then
echo "MongoDB replica set ready on port ${port}"
exit 0
fi
sleep 1
done

echo "MongoDB replica set did not elect a primary" >&2
exit 1
58 changes: 58 additions & 0 deletions .github/workflows/session-mongodb.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: Session MongoDB conformance

on:
pull_request:
paths:
- "Cargo.toml"
- "Cargo.lock"
- "crates/tinyagents-session/**"
- "integration-proofs/run-ledger-mongodb/**"
- ".github/scripts/start-session-mongo-replset.sh"
- ".github/workflows/session-mongodb.yml"
push:
branches: [main]
paths:
- "Cargo.toml"
- "Cargo.lock"
- "crates/tinyagents-session/**"
- "integration-proofs/run-ledger-mongodb/**"
- ".github/scripts/start-session-mongo-replset.sh"
- ".github/workflows/session-mongodb.yml"
schedule:
- cron: "23 3 * * *"
workflow_dispatch:

permissions:
contents: read

jobs:
mongo-conformance:
name: MongoDB session-store and run-ledger conformance
runs-on: ubuntu-latest
timeout-minutes: 35
env:
TSD_MONGO_URL: mongodb://localhost:27017/tsd_test?directConnection=true
CARGO_TERM_COLOR: always
CARGO_INCREMENTAL: 0
CARGO_PROFILE_TEST_DEBUG: 0
RUST_BACKTRACE: 1
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
submodules: recursive

- uses: dtolnay/rust-toolchain@6bed0761d98439e5a578e2877258200ad565ba87 # stable
with:
toolchain: stable

- uses: Swatinem/rust-cache@6323deb102c322ba6fcbdcafc7e3dddab59af2b6 # v2.9.2
with:
workspaces: .
key: session-mongodb

- name: Start a local MongoDB replica set
run: .github/scripts/start-session-mongo-replset.sh 27017

- name: Run MongoDB driver conformance
run: cargo test --manifest-path integration-proofs/run-ledger-mongodb/Cargo.toml --features mongodb-storage-tests --test session_driver_conformance -- --ignored
26 changes: 20 additions & 6 deletions Cargo.lock

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

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ tracing = "0.1"
# module (tinyflows, tinybox, tinychannels, ...) and tinyinference names, so a
# host's graph holds one set of port types with no [patch] to reconcile them.
tinystoragedrivers-core = { version = "1.0.0", git = "https://github.com/tinyhumansai/tinystoragedrivers", tag = "v1.0.0" }
tinystoragedrivers-file = { version = "1.0.0", git = "https://github.com/tinyhumansai/tinystoragedrivers", tag = "v1.0.0" }
tinystoragedrivers-sqlite = { version = "1.0.0", git = "https://github.com/tinyhumansai/tinystoragedrivers", tag = "v1.0.0" }
uuid = { version = "1", features = ["v4"] }

Expand Down
1 change: 1 addition & 0 deletions crates/tinyagents-session/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ storage-drivers = []
# `legacy`, so they need the importer even under `--no-default-features`.
tinyagents-session = { path = ".", features = ["legacy-import"] }
tinystoragedrivers-sqlite = { workspace = true }
tinystoragedrivers-file = { workspace = true }
tokio = { workspace = true, default-features = true, features = ["macros", "rt-multi-thread"] }

[lints]
Expand Down
13 changes: 13 additions & 0 deletions crates/tinyagents-session/src/port/drivers/mod_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ use super::*;
use crate::testkit::conformance::{session_store_conformance, session_store_isolation_conformance};
use crate::turn_state::{TurnLifecycle, TurnState};
use tinystoragedrivers_core::MemoryStorage;
use tinystoragedrivers_file::FileStorage;
use tinystoragedrivers_sqlite::SqliteStorage;

fn memory() -> DriverSessionStores {
Expand Down Expand Up @@ -117,6 +118,18 @@ async fn sqlite_backed_stores_keep_agents_apart() {
session_store_isolation_conformance(&sqlite(&dir)).await;
}

#[tokio::test]
async fn file_backed_stores_meet_the_contract_and_keep_agents_apart() {
let dir = tempfile::tempdir().unwrap();
let stores = DriverSessionStores::new(
Arc::new(FileStorage::open(dir.path()).unwrap()),
tinystoragedrivers_core::Scope::local(),
)
.unwrap();
session_store_conformance(&stores).await;
session_store_isolation_conformance(&stores).await;
}

#[tokio::test(flavor = "multi_thread")]
async fn stores_work_from_a_multi_threaded_runtime() {
session_store_conformance(&memory()).await;
Expand Down
Loading
Loading