Skip to content

feat(queue): QueueStore port with a DocumentQueue over any document store - #71

Merged
senamakel merged 2 commits into
tinyhumansai:mainfrom
senamakel:feat/queue-store
Oct 19, 2026
Merged

senamakel merged 2 commits into
tinyhumansai:mainfrom
senamakel:feat/queue-store

Conversation

@senamakel

@senamakel senamakel commented Oct 19, 2026 •

Copy link
Copy Markdown
Member

Summary

Adds a fourth port, QueueStore: durable at-least-once message queues. Consumers lease messages for a visibility window, then ack, nack (retry after a delay, or dead-letter) or extend the lease. A lapsed lease means another delivery with the attempt count raised. A message that runs out of attempts is dead-lettered, and a dead letter can be redriven. Optional semantics are reported in QueueFeatures: priorities, delays, groups (at most one leased message per group, so one conversation is serialized without serializing the whole queue) and dedupe keys (a redelivery is rejected while the message is held and for a window after it is acked).

Queues are declared in an editable JSON manifest instead of in code. QueueManifest::load("queues.json") followed by apply(&store) declares every queue the file lists. The format is in schemas/queues.schema.json, so people and other agents can add or tune a queue by editing one file. Parsing is strict: a typo, a duplicate or an invalid value fails with an error that names the entry.

queue::DocumentQueue implements all of it over DocumentStore::claim and version-guarded writes, so memory, SQLite, file and MongoDB are queue backends without driver code. It is the first step towards tinyhumansai/tinyeventqueues, a module that buffers and filters noisy inbound events (chat messages, webhooks, connector triggers) before they reach an agent. A native RabbitMQ driver and the storage-bus selectors follow in separate PRs, as listed in docs/plans/queue-store.md.

Related issue

None.

API or behavior changes

Additive only. New public module queue, with QueueStore re-exported at the crate root. New: QueueManifest/QueueDeclaration, schemas/queues.schema.json and docs/examples/queues.json. New reserved collections: tsd.queue, tsd.queue_groups and tsd.queue_specs. conformance::run_ports now also runs the queue checks, so every driver and the bus-client loopback exercise them. No existing behavior changes.

Validation

  • cargo fmt --all -- --check
  • cargo clippy --all-targets --all-features -- -D warnings
  • cargo build --all-targets --all-features
  • cargo test --all-features: the memory, SQLite, file and client-loopback suites all pass.
  • MongoDB live suite (TSD_MONGO_URL, against a throwaway single-node replica set from .github/scripts/start-mongo-replset.sh): passes both live_conformance_on_a_replica_set and live_conformance_without_transactions.
  • cargo llvm-cov -p tinystoragedrivers-core: line coverage is 96.5% for queue/document.rs 98.6% for queue/manifest.rs, and 100% for queue/types.rs and conformance/queue.rs.

Tests

conformance/queue.rs drives the queue with a hand-moved clock, so leases, delays and dedupe windows are tested without sleeping. It covers:

  • priority and FIFO order
  • stale receipts after a lease lapses
  • attempts leading to a dead letter, and redrive
  • nack backoff
  • group exclusivity, including a delayed retry that keeps its group pinned
  • dedupe windows and tombstone pruning
  • lease extension
  • queue isolation and purge
  • input validation

Manifest tests check that the example loads, defaults, the errors for typos, bad values and duplicates (each naming the entry), file loading (missing file, directory, invalid content), that apply persists specs, and that the JSON Schema lists exactly the QueueDeclaration fields. Unit tests cover name and message validation, sequence monotonicity when the clock steps back, and spec caching.

Two behaviors are documented but not asserted:

  • A consumer that crashes between the claim and the attempt-count write gets one uncounted delivery.
  • Cross-handle ordering is only to the millisecond.

Documentation

  • docs/specs/queue-store.md (the contract)
  • docs/plans/queue-store.md (the delivery plan, with remaining tasks)
  • The README port list, and the module and crate rustdoc

Checklist

  • The change is focused on one logical change
  • No new #[allow(...)], #[ignore], or relaxed lints. There are two scoped allows, each with a reason:
    • clippy::expect_used on DocumentQueue::new, for the constant collection names. Leases::new uses the same pattern.
    • clippy::struct_excessive_bools on QueueFeatures, whose fields are independent feature flags.
  • No secrets, tokens, or .env contents in the diff or the description

…cument store

Durable at-least-once queues: leases with a visibility window, attempt
counting, dead letters and redrive, priorities, delays, per-group
serialization and dedupe keys with an acknowledgement window.
DocumentQueue implements every feature over DocumentStore::claim and
version-guarded writes, so memory, SQLite, file and MongoDB are queue
backends without driver code. The queue checks run in run_ports.

Co-authored-by: Medulla <medulla@tinyhumans.ai>
@tinysweeper

tinysweeper Bot commented Oct 19, 2026 •

Copy link
Copy Markdown

Tiny Sweeper review

Tiny Sweeper reviewed this change across 5 lane(s) and found 0 active actionable finding(s). Detailed lane evidence and any incomplete work are listed below.

State: Incomplete
Priority: none
Reviewed head: 15f1bb6efbd5
Updated: 2026-10-19T16:02:41Z

Review snapshot

Change surface Files Review signal Count
Production 7 Active findings 0
Tests 3 Noted findings 0
Documentation 6 Resolved findings 0
Configuration 1 Pending checks/questions 17

Completeness: Incomplete
Test assessment: No supported feature-to-test mapping was available; this does not mean tests are absent or passed.

Features

None identified with supported citations.

Tests

No supported feature-to-test mapping was produced. Test execution is not inferred.

  • Unreviewed: tinysweeper/tests

Findings

No active actionable findings.

Could not review: README.md, crates/tinystoragedrivers-core/src/queue/document.rs, crates/tinystoragedrivers-core/src/queue/manifest.rs, crates/tinystoragedrivers-core/src/queue/manifest_tests.rs, crates/tinystoragedrivers-core/src/queue/mod.rs, docs/examples/queues.json, docs/plans/queue-store.md, docs/specs/queue-store.md, schemas/queues.schema.json, tinysweeper/description, tinysweeper/tests

Before merge

  • Complete the critique review for README.md, crates/tinystoragedrivers-core/src/queue/document.rs, crates/tinystoragedrivers-core/src/queue/mod.rs, crates/tinystoragedrivers-core/src/queue/manifest.rs, crates/tinystoragedrivers-core/src/queue/manifest_tests.rs, docs/examples/queues.json, docs/plans/queue-store.md, docs/specs/queue-store.md, schemas/queues.schema.json.
  • Complete the security review for crates/tinystoragedrivers-core/src/queue/document.rs, crates/tinystoragedrivers-core/src/queue/mod.rs, crates/tinystoragedrivers-core/src/queue/manifest.rs, crates/tinystoragedrivers-core/src/queue/manifest_tests.rs, docs/examples/queues.json, schemas/queues.schema.json.
  • Complete the tests review for tinysweeper/tests.
  • Complete the description review for tinysweeper/description.

How this fits together

flowchart LR
  n0["enqueue"]:::impacted
  n1["attempts_and_dead_letters"]:::impacted
  n2["dedupe"]:::impacted
  n3["delays_and_nack"]:::impacted
  n4["extend"]:::impacted
  n5["groups"]:::impacted
  n1 -->|calls| n0
  n2 -->|calls| n0
  n3 -->|calls| n0
  n4 -->|calls| n0
  n5 -->|calls| n0
  classDef changed fill:#0d4429,stroke:#238636,color:#e6edf3
  classDef impacted fill:#161b22,stroke:#6e7681,color:#c9d1d9
  classDef flagged fill:#5a1e02,stroke:#d93f0b,color:#ffffff
  classDef blocking fill:#67060c,stroke:#f85149,color:#ffffff
Loading
Agent review details

critique

  • Conclusion: Neutral
  • Scope reviewed: incomplete; unanswered: README.md, crates/tinystoragedrivers-core/src/queue/document.rs, crates/tinystoragedrivers-core/src/queue/mod.rs, crates/tinystoragedrivers-core/src/queue/manifest.rs, crates/tinystoragedrivers-core/src/queue/manifest_tests.rs, docs/examples/queues.json, docs/plans/queue-store.md, docs/specs/queue-store.md, schemas/queues.schema.json
  • Lane summary: Reviewed 0 files; 0 findings. 9 files could not be reviewed: README.md, crates/tinystoragedrivers-core/src/queue/document.rs, crates/tinystoragedrivers-core/src/queue/mod.rs, crates/tinystoragedrivers-core/src/queue/manifest.rs, crates/tinystoragedrivers-core/src/queue/manifest_tests.rs, docs/examples/queues.json, docs/plans/queue-store.md, docs/specs/queue-store.md, schemas/queues.schema.json.

security

  • Conclusion: Neutral
  • Scope reviewed: incomplete; unanswered: crates/tinystoragedrivers-core/src/queue/document.rs, crates/tinystoragedrivers-core/src/queue/mod.rs, crates/tinystoragedrivers-core/src/queue/manifest.rs, crates/tinystoragedrivers-core/src/queue/manifest_tests.rs, docs/examples/queues.json, schemas/queues.schema.json
  • Lane summary: Reviewed 0 files; 0 findings. 6 files could not be reviewed: crates/tinystoragedrivers-core/src/queue/document.rs, crates/tinystoragedrivers-core/src/queue/mod.rs, crates/tinystoragedrivers-core/src/queue/manifest.rs, crates/tinystoragedrivers-core/src/queue/manifest_tests.rs, docs/examples/queues.json, schemas/queues.schema.json. 3 files were not security-reviewed: README.md (prose or tabular data), docs/plans/queue-store.md (prose or tabular data), docs/specs/queue-store.md (prose or tabular data).

tests

  • Conclusion: Neutral
  • Scope reviewed: incomplete; unanswered: tinysweeper/tests
  • Lane summary: No reviewer produced a usable response.

commits

  • Conclusion: Neutral
  • Scope reviewed: all assigned evidence
  • Lane summary: Nothing sensitive found in what this pull request commits.

description

  • Conclusion: Neutral
  • Scope reviewed: incomplete; unanswered: tinysweeper/description
  • Lane summary: No reviewer produced a usable response.
Evidence and run details
  • Models: ladder/vectors-oai3
  • Spend: $0.000102
  • Tokens: 0 input · 0 output · 0 cached · 786 embedding
Head State Pass summary
a515531a4f7b incomplete 0 active finding(s), 0 resolved finding(s) (at 2026-10-19T15:54:00Z)
15f1bb6efbd5 incomplete 0 active finding(s), 0 resolved finding(s) (at 2026-10-19T16:02:41Z)

tinysweeper 0.1.2

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ⚠️ Failed 2026-10-19T15:53:32.399929Z a515531 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, add credits to your account and enable them for code reviews in your settings.

@coderabbitai

coderabbitai Bot commented Oct 19, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

  • Run on-demand review

This review includes 17 billable files and costs up to $4.25.

Or wait 25 minutes for your next included review.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: ccd3da3d-87ef-45bd-b418-94c32f2d0fbd
📥 Commits

Reviewing files that changed from the base of the PR and between 88fefb9 and 15f1bb6.

📒 Files selected for processing: 17
  • README.md
  • crates/tinystoragedrivers-core/src/conformance/mod.rs
  • crates/tinystoragedrivers-core/src/conformance/queue.rs
  • crates/tinystoragedrivers-core/src/lib.rs
  • crates/tinystoragedrivers-core/src/queue/document.rs
  • crates/tinystoragedrivers-core/src/queue/document_tests.rs
  • crates/tinystoragedrivers-core/src/queue/manifest.rs
  • crates/tinystoragedrivers-core/src/queue/manifest_tests.rs
  • crates/tinystoragedrivers-core/src/queue/mod.rs
  • crates/tinystoragedrivers-core/src/queue/mod_tests.rs
  • crates/tinystoragedrivers-core/src/queue/types.rs
  • docs/examples/queues.json
  • docs/plans/README.md
  • docs/plans/queue-store.md
  • docs/specs/README.md
  • docs/specs/queue-store.md
  • schemas/queues.schema.json
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

@tinysweeper tinysweeper Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tinysweeper found nothing blocking, but could not review everything, so this is not an approval: README.md, crates/tinystoragedrivers-core/src/conformance/mod.rs, crates/tinystoragedrivers-core/src/conformance/queue.rs, crates/tinystoragedrivers-core/src/lib.rs, crates/tinystoragedrivers-core/src/queue/document.rs, crates/tinystoragedrivers-core/src/queue/document_tests.rs, crates/tinystoragedrivers-core/src/queue/mod.rs, crates/tinystoragedrivers-core/src/queue/mod_tests.rs and 7 more.

$0.0001 · 0 in / 0 out · 780 embedded · ladder/vectors-oai3

QueueManifest loads queues.json (strict: unknown fields, duplicate or
invalid names and bad values fail naming the entry) and apply() declares
every queue on a QueueStore, so queues are added or tuned by editing a
file instead of code. schemas/queues.schema.json documents the format
for editors and agents, a test keeps it in step with QueueDeclaration,
and docs/examples/queues.json is a working example.

Co-authored-by: Medulla <medulla@tinyhumans.ai>

@tinysweeper tinysweeper Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tinysweeper found nothing blocking, but could not review everything, so this is not an approval: README.md, crates/tinystoragedrivers-core/src/queue/document.rs, crates/tinystoragedrivers-core/src/queue/manifest.rs, crates/tinystoragedrivers-core/src/queue/manifest_tests.rs, crates/tinystoragedrivers-core/src/queue/mod.rs, docs/examples/queues.json, docs/plans/queue-store.md, docs/specs/queue-store.md and 3 more.

$0.0001 · 0 in / 0 out · 786 embedded · ladder/vectors-oai3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant