feat(durable): scaffold zeph-durable crate, core newtypes, journal schema#4965
Merged
Merged
Conversation
…hema
Add the Layer-0 zeph-durable crate (spec-064) as the foundation for the
native durable execution layer. This first slice is type-level only, with
no runtime behavior.
- ids: ExecutionId/PromiseId/TimerId (UUIDv7), StepId, JournalSeq, and
IdempotencyKey (BLAKE3 derive_key, domain-separated, length-delimited
injective input), plus the ExecutionKind discriminator. Private fields,
smart constructors, serde-round-trip stable.
- journal: the Journal trait (native async via RPITIT + Send), JournalEntry,
the closed EntryKind enum (control entries carry no payload, so illegal
states are unrepresentable), and ExecutionStatus.
- effect: the EffectClass per-step side-effect contract.
- config: pure-data DurableConfig + RetentionPolicy with container-level
serde defaults mirroring the [durable] TOML section.
- error: DurableError (non_exhaustive, metadata-only messages).
- sealed: Sealed token for the future backend hierarchy.
Schema: durable_executions/journal/promises/timers added as numbered
migrations 097-100 in zeph-db/migrations/{sqlite,postgres} (matching file
counts, schema-equivalent). zeph-durable owns no .sql and no sqlx::migrate!;
migrations are applied via zeph_db::run_migrations against the dedicated
durable pool.
No business-layer dependencies (INV-1). Migration ownership stays in
zeph-db (INV-14).
Part of #4707.
Closes #4944.
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.
Summary
Scaffolds the new Layer-0
zeph-durablecrate (spec-064) — the foundation of the native durableexecution layer. This first slice (C1) is type-level only: it establishes the crate skeleton,
core newtypes, the journal data model, the effect contract, pure-data config, the error type, and
the persistence schema. No execution behavior exists yet — the journal writer, backends, replay
cursor, and the durable step primitive land in follow-up issues of epic #4707.
What's included
New crate
crates/zeph-durable/:ids.rs—ExecutionId/PromiseId/TimerId(UUIDv7),StepId,JournalSeq,IdempotencyKey, and theExecutionKinddiscriminator. Private fields, smart constructors,serde-round-trip stable.
IdempotencyKey::deriveuses BLAKE3derive_keywith a domain-separationcontext string and length-delimited (injective) input.
journal.rs— theJournaltrait (native async via RPITIT +Send, matching theLlmProvider/ToolExecutorconvention),JournalEntry, the closedEntryKindenum, andExecutionStatus.effect.rs—EffectClass(the bare contract needed byEntryKind;OnAmbiguous/EffectIntentSubClassand the construction-time policy land in C4).config.rs— pure-dataDurableConfig+RetentionPolicywith container-level#[serde(default)]mirroring
[durable]TOML, and a type-safeDurableBackendenum.error.rs—DurableError(#[non_exhaustive], metadata-only messages, INV-5).sealed.rs,lib.rs,README.md.Schema (
zeph-db):durable_executions/durable_journal/durable_promises/durable_timersadded as numbered migrations097–100in bothzeph-db/migrations/sqlite/and.../postgres/(matching file counts, schema-equivalent:BLOB→BYTEA,AUTOINCREMENT→BIGSERIAL, epoch columnsINTEGER→BIGINT), including theUNIQUEpartial indexidx_durable_journal_result.zeph-durableowns no.sqland nosqlx::migrate!.Acceptance criteria
zeph-llm/zeph-memory/zeph-core/zeph-sanitizeror anybusiness-layer crate (
cargo tree -p zeph-durable→ onlyzeph-db+zeph-common).durable_*files in both dialect dirs (matching counts); no.sql/ nosqlx::migrate!insidezeph-durable.IdempotencyKey::deriveis domain-separated and injective; a boundary-shift test assertsdistinct keys.
ExecutionId::newuniquenessand serde round-trip of every newtype.
DurableConfig/RetentionPolicyserde defaults match the spec; an empty TOML tabledeserializes to every default.
EntryKindis a closed enum (exhaustive match compiles); control entries carry no payload.cargo check/clippy -D warnings/cargo docpass; everypubitem is documented.Verification
cargo +nightly fmt --checkcargo clippy --workspace --all-targets -- -D warningsRUSTFLAGS=-D warnings cargo check --workspace --all-targets --features desktop,ide,server,chat,pdf,schedulercargo nextest run --workspace --features full --lib --binscargo test --doc --workspace --features desktop,ide,server,chat,pdf,schedulerRUSTDOCFLAGS="--deny rustdoc::broken_intra_doc_links" cargo doc --no-deps -p zeph-durablerun_migrationsOut of scope (later issues)
PayloadCipher(C2/#4945);JournalWriter/backends/Journalimpl (C3/#4946);DurableStep/DurableContextand the ambiguity policy (C4/#4947); CLI / root-config wiring / TUI (C6/#4949).Part of #4707.
Closes #4944.