Skip to content

Add WAL provider support to Drasi.create - #6

Draft
danielgerlag wants to merge 1 commit into
mainfrom
danielgerlag-add-wal-provider
Draft

danielgerlag wants to merge 1 commit into
mainfrom
danielgerlag-add-wal-provider

Conversation

@danielgerlag

Copy link
Copy Markdown
Contributor

Drasi.create could persist state and query indexes, but transient sources had no engine-level WAL provider. Sources configured for durability therefore failed at startup because DrasiLib had no WAL provider to inject.

This change:

  • adds wal_provider={"kind": "redb", "path": ...} to async creation, the sync wrapper, typed config, and from_config
  • defaults the provider kind to redb, validates the directory path with stable error codes, and wires drasi-wal-redb 0.2.10 into DrasiLibBuilder
  • adds durability=True to Python sources, with append-before-return dispatch, WAL replay, confirmed-position pruning, and cleanup
  • keeps Python sources on their existing restartable SourceBase, preserving push acknowledgement and query subscriptions across source stop/start
  • adds a two-process recovery test that proves a change can be read from the WAL without a persistent query index masking the result
  • updates the API reference, guides, changelog, and API audit, including the distinction from PostgreSQL replication slots

Volatile Python sources now report that they cannot replay changes. Persistent queries backed by Python sources must configure a WAL provider and opt the source into durability.

Validation includes the full hermetic suite, Rust tests and Clippy, Pyright, Ruff, generated-doc checks, and default plus RocksDB build configurations.

Closes #5

Expose redb WAL configuration across the async, sync, and config APIs, and add durable Python-source replay with fresh-process recovery coverage.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings October 10, 2026 16:43

Copilot AI 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.

🟡 Changes recommended

WAL cleanup fails for durable sources that were not successfully started, and the generated API signature is malformed.

2 open findings
What changed in this PR

Adds engine-level redb WAL support and durable Python-source recovery.

Changes:

  • Exposes WAL configuration across async, sync, typed, and config APIs.
  • Adds durable Python-source persistence, replay, pruning, and recovery tests.
  • Updates documentation, dependencies, and stable error codes.
File Description
Cargo.toml Adds redb WAL dependency.
Cargo.lock Locks WAL dependency.
CHANGELOG.md Records durability features.
README.md Adds durable-source example.
docs/​api-audit.md Marks WAL support complete.
python/​drasi/​_drasi.pyi Extends async API types.
python/​drasi/​sync.py Extends blocking API.
python/​drasi/​types.py Defines WAL configuration types.
scripts/​generate_api_reference.py Documents WAL behavior.
src/​components.rs Implements durable Python sources.
src/​engine.rs Exposes WAL and durability arguments.
src/​errors.rs Adds WAL error codes.
src/​stores.rs Parses and installs WAL providers.
tests/​e2e/​test_concurrency.py Covers durable concurrent processing.
tests/​e2e/​test_durable_and_config.py Updates durable fixtures.
tests/​e2e/​test_python_components.py Tests lifecycle behavior.
tests/​e2e/​test_stores.py Tests WAL validation and persistence.
tests/​e2e/​test_sync.py Tests blocking WAL support.
tests/​e2e/​test_wal_recovery.py Tests cross-process recovery.
tests/​e2e/​wal_recovery_worker.py Provides recovery subprocess worker.
website/​content/​docs/​api/​_index.md Updates generated API reference.
website/​content/​docs/​guides/​error-handling.md Documents WAL errors.
website/​content/​docs/​guides/​python-reactions.md Explains durable-source requirement.
website/​content/​docs/​guides/​python-sources.md Documents source durability.
website/​content/​docs/​guides/​typing.md Lists the WAL type.

🧠 Review effort: Balanced


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/components.rs
Comment on lines +234 to +239
async fn deprovision(&self) -> Result<()> {
if let Some(wal) = self.wal.read().await.clone() {
wal.delete_wal(self.base.get_id()).await?;
}
Ok(())
}
| Member | Returns |
| --- | --- |
| `add_python_source(id: str, *, auto_start: bool = True)` | `Awaitable[None]` |
| `add_python_source(self, id: str, *, auto_start: bool = True, durability: bool = False )` | `Awaitable[None]` |

This branch has not been deployed

No deployments
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.

Add a WAL provider option to Drasi.create

2 participants