Skip to content

C-d · K1 audit taste follow-ups (commitment_holds bool, fixture dedup, empty-stream reason) #133

Description

@trivejoel

Minor, non-blocking code-quality items surfaced by the K1 (#87) audit and deliberately deferred (correct + gate-green as-is):

  1. rotation::commitment_holds returns Result<bool> that collapses to one reason. Both Err (digest-primitive build failure) and Ok(false) (hash/length mismatch) map to NextKeyCommitmentMismatch at the call site. The Result<bool> shape buys nothing over bool (fail-closed either way); and a digest-engine failure is arguably an internal error, not a commitment mismatch. Simplify to bool, or distinguish the internal-error case.

  2. Test fixture duplication. keri/tests/common/mod.rs has 5+ inception constructors (inception, inception_with_config, inception_with_threshold, inception_with_witnesses, inception_multi), each re-typing the full InceptionBuilder → serialize → deserialize_event chain with one field varied. Same drift risk as the production dedup already fixed — consolidate to one params-struct/base-builder helper.

  3. fold empty-stream reason. fold(None, []) returns RejectionReason::InvalidEvent; an empty iterator with no initial state is a distinct "nothing to fold" condition, not an invalid event. Consider a dedicated reason (the enum is #[non_exhaustive], so additive) — likely folds into the K2 (K2 · Escrow decision engine — pure EscrowReason verdicts (no tables, no timers) #88) taxonomy work.

All three are taste/quality, not correctness. #1/#2 are self-contained; #3 pairs with #88.

Spawned from #87 (K1) audit, 2026-07-06.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions