Skip to content

refactor(durable): consolidate key-material params and split LocalBackend impl block#6529

Merged
bug-ops merged 1 commit into
mainfrom
feat/issue-6458/durable-key-material-struct
Jul 20, 2026
Merged

refactor(durable): consolidate key-material params and split LocalBackend impl block#6529
bug-ops merged 1 commit into
mainfrom
feat/issue-6458/durable-key-material-struct

Conversation

@bug-ops

@bug-ops bug-ops commented Jul 19, 2026

Copy link
Copy Markdown
Owner

Summary

Two grouped, non-blocking structural refactors in the durable execution layer, both with concrete before/after scope already specified in their issues and no behavior change.

  • durable: bundle open_durable_backend's growing key-material params into a DurableKeyMaterial struct #6458: open_durable_backend and both AgentBuilder::with_durable_* methods took 5+ positional key-material Option parameters (AEAD cipher key, control-entry HMAC key + previous key, high-water-mark key + previous key), which had tripped clippy's too_many_arguments/too_many_lines thresholds on 4 functions, worked around with #[allow(...)]. Bundled into a single pub struct DurableKeyMaterial (crates/zeph-core/src/agent/durable_bootstrap.rs), threaded through src/runner.rs, builder.rs, plan.rs. Removed the three now-unnecessary too_many_arguments allows; kept too_many_lines on ensure_session_durable_ctx (its length comes from the open-execution/lock sequence, not param count). Deliberately does not derive Debug (raw key-material bytes) and does not add Zeroize (parity with prior by-value key passing — a separate follow-up if wanted).
  • zeph-durable: LocalBackend's single impl block mixes 5 unrelated concerns across 60 methods #6483: impl LocalBackend (crates/zeph-durable/src/backend/local.rs) mixed 60 methods spanning five independent concerns in one ~2300-line block. Split in-place into five concern-grouped impl LocalBackend blocks (file stays a single file per /specs/064-durable-execution/spec.md's crate/module layout), each with a one-line doc comment. Promise/timer and checkpoint methods were folded into the execution-lifecycle block rather than split into a sixth block — a dedicated sixth block is a defensible alternative left for a future pass.

Both refactors were independently verified as pure reorganizations (byte-for-byte identical method bodies for #6483, field-by-field traced construction for #6458) by both the test-coverage validator and an adversarial critic pass, then confirmed again by code review — including one addressed finding: a security-relevant invariant note (mis-wired key material fails closed via ControlIntegrity/HighWaterMarkIntegrity, never a silent accept) that had been dropped during the refactor was re-added to DurableKeyMaterial's doc comment, verified against the actual verification code paths.

This is a structural-only change with no new config/CLI/TUI surface, so the live-testing playbook and coverage-status requirements do not apply.

Closes #6458
Closes #6483

Test plan

  • cargo +nightly fmt --check
  • cargo clippy --profile ci --workspace --all-targets --features "desktop,ide,server,chat,pdf,scheduler,testing" -- -D warnings
  • cargo nextest run --config-file .github/nextest.toml --workspace --features "desktop,ide,server,chat,pdf,scheduler" --lib --bins (14752 passed, 35 skipped)
  • RUSTFLAGS="-D warnings" RUSTDOCFLAGS="--deny rustdoc::broken_intra_doc_links" cargo doc --no-deps --workspace --features "desktop,ide,server,chat,pdf,scheduler"
  • cargo test --doc --workspace --features "desktop,ide,server,chat,pdf,scheduler" (includes the new DurableKeyMaterial doctest)
  • Independent verification: 60/60 LocalBackend methods accounted for, byte-for-byte identical across old/new impl blocks; all 6 DurableKeyMaterial construction/destructure sites traced field-by-field for swap risk

@github-actions github-actions Bot added documentation Improvements or additions to documentation rust Rust code changes core zeph-core crate refactor Code refactoring without functional changes size/XL Extra large PR (500+ lines) labels Jul 19, 2026
@bug-ops
bug-ops enabled auto-merge (squash) July 19, 2026 23:50
@bug-ops
bug-ops force-pushed the feat/issue-6458/durable-key-material-struct branch from ccf0615 to 1d044ec Compare July 19, 2026 23:50
…kend impl block

Bundle open_durable_backend's and AgentBuilder::with_durable_*'s 5+ positional
key-material Option params into a DurableKeyMaterial struct, removing the
now-unnecessary too_many_arguments allows. Split LocalBackend's single
60-method impl block into five concern-grouped blocks (construction,
execution lifecycle, HMAC/HWM crypto, payload sealing, retention/pruning).
Both are pure structural reorganizations with no behavior change.

Closes #6458
Closes #6483
@bug-ops
bug-ops force-pushed the feat/issue-6458/durable-key-material-struct branch from 1d044ec to bd7dea4 Compare July 19, 2026 23:57
@bug-ops
bug-ops merged commit 14ea7db into main Jul 20, 2026
79 of 81 checks passed
@bug-ops
bug-ops deleted the feat/issue-6458/durable-key-material-struct branch July 20, 2026 00:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core zeph-core crate documentation Improvements or additions to documentation refactor Code refactoring without functional changes rust Rust code changes size/XL Extra large PR (500+ lines)

Projects

None yet

1 participant