Skip to content

refactor!: accept flexible arguments across public signatures - #74

Open
sephynox wants to merge 1 commit into
fix/audit-phase-7-3from
feat/audit-phase-7-4
Open

sephynox wants to merge 1 commit into
fix/audit-phase-7-3from
feat/audit-phase-7-4

Conversation

@sephynox

@sephynox sephynox commented Sep 14, 2026

Copy link
Copy Markdown
Contributor

Summary

Many signatures demanded one concrete type (&[u8], &str, Vec<T>, Box<dyn T>), so callers holding an owned value, an array, or a concrete implementor had to convert first. Parameters now take AsRef, Into, IntoIterator, or impl Trait per the house flexible-arguments rule, except where a dyn-compatible trait method or a fixed crypto role requires the concrete type.

Related Issues

None

Changes Made

  • Byte and string parameters accept owned or borrowed values
  • Collection parameters accept any iterable, not only a Vec
  • Builders that stored a trait object now box it internally
  • decode accepts any byte source, including a bare &[u8]
  • KDF, nonce, and dyn trait inputs keep their concrete types

Testing

  • make test-all: passes

Breaking Changes

  • Widened trait methods such as ServletRegistry::insert and TrustBuilder::with_chain are generic.
    • Implementors update their signatures, and those traits are no longer dyn-compatible.
  • with_sink, with_analyzer, with_rng, and LoggerConfig::new take the value itself.
    • Drop the Arc::new or Box::new wrapper.

Note

Medium Risk
Widened trait methods are a breaking change for external implementors; runtime logic is largely unchanged, but the breadth of colony/crypto/cluster touchpoints increases regression surface.

Overview
Breaking API ergonomics refactor: parameters across the crate (and tightbeam-derive) now take AsRef, Into, or IntoIterator instead of fixed &[u8], &str, Vec<T>, or caller-supplied Box/Arc wrappers.

Call sites can pass literals, owned buffers, and arrays directly—e.g. cluster registry lookups use type_key("ping") without extra references, gossip helpers accept array slices, and frame with_rng boxes an impl CryptoRngCore internally. Docs show StdoutBackend without Box::new. Fuzz/colony paths gain the same flexibility for IDs, dial addresses, and advertisement type lists.

Trait surface breaks: widened methods on ServletRegistry (hive) and TrustBuilder::with_chain (and similar) are no longer dyn-compatible—custom implementors must match the new generic signatures. wcet! / timing builders pass analyzers without Arc::new where the API now accepts the value directly.

Behavior at boundaries is unchanged aside from internal .into() / .collect(); the diff is mostly signature widening plus test and call-site cleanup.

Reviewed by Cursor Bugbot for commit 9fc73d7. Bugbot is set up for automated code reviews on this repo. Configure here.

@sephynox sephynox self-assigned this Sep 14, 2026
@sephynox
sephynox added this pull request to stack #55 September 14, 2026 06:09
@sephynox sephynox added the enhancement New feature or request label Sep 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant