refactor(durable): consolidate key-material params and split LocalBackend impl block#6529
Merged
Merged
Conversation
bug-ops
enabled auto-merge (squash)
July 19, 2026 23:50
bug-ops
force-pushed
the
feat/issue-6458/durable-key-material-struct
branch
from
July 19, 2026 23:50
ccf0615 to
1d044ec
Compare
…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
force-pushed
the
feat/issue-6458/durable-key-material-struct
branch
from
July 19, 2026 23:57
1d044ec to
bd7dea4
Compare
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
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.
open_durable_backendand bothAgentBuilder::with_durable_*methods took 5+ positional key-materialOptionparameters (AEAD cipher key, control-entry HMAC key + previous key, high-water-mark key + previous key), which had tripped clippy'stoo_many_arguments/too_many_linesthresholds on 4 functions, worked around with#[allow(...)]. Bundled into a singlepub struct DurableKeyMaterial(crates/zeph-core/src/agent/durable_bootstrap.rs), threaded throughsrc/runner.rs,builder.rs,plan.rs. Removed the three now-unnecessarytoo_many_argumentsallows; kepttoo_many_linesonensure_session_durable_ctx(its length comes from the open-execution/lock sequence, not param count). Deliberately does not deriveDebug(raw key-material bytes) and does not addZeroize(parity with prior by-value key passing — a separate follow-up if wanted).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-groupedimpl LocalBackendblocks (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 toDurableKeyMaterial'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 --checkcargo clippy --profile ci --workspace --all-targets --features "desktop,ide,server,chat,pdf,scheduler,testing" -- -D warningscargo 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 newDurableKeyMaterialdoctest)LocalBackendmethods accounted for, byte-for-byte identical across old/new impl blocks; all 6DurableKeyMaterialconstruction/destructure sites traced field-by-field for swap risk