Skip to content

refactor(testkit): type the cleanup hook keys - #5240

Open
elezar wants to merge 1 commit into
mainfrom
refactor/testkit-typed-cleanup-keys/elezar
Open

elezar wants to merge 1 commit into
mainfrom
refactor/testkit-typed-cleanup-keys/elezar

Conversation

@elezar

@elezar elezar commented Nov 4, 2026

Copy link
Copy Markdown
Member

Follow-up to #5219 (testkit cleanup hooks), addressing two design nits from its review.

  • Replace the untyped Option<String> hook key with a crate-private Key enum. Variants are separate namespaces, so keys of different kinds can't collide. push_keyed takes a Key and remove takes &Key.
  • Take the key out of Hook::new and add a keyed() builder. Anonymous user hooks have no key.

Pure refactor with no behavior change: ordering, dedupe, timeouts, and the public API are unchanged, and Key is crate-private. Only cleanup.rs and context.rs change.

Verified from tests/testkit: cargo fmt --all, cargo nextest run (12 pass), cargo clippy --all-targets -- -D warnings.

No linked issue: the author has write access on this repository, as AGENTS.md permits.

Replace the untyped Option<String> hook key with a crate-private Key enum
whose variants are separate namespaces, and take the key out of Hook::new
in favor of a keyed() builder. No behavior change.

Signed-off-by: Evan Lezar <elezar@nvidia.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:build Related to CI/CD and builds topic:testing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant