Loading
feat: add Labkit::Context.clear for resetting context between tests
Description
Adds Labkit::Context.clear to reset the context stack stored in
Thread.current[:labkit_contexts]. This is useful in test environments
where contexts are pushed outside of with_context and can otherwise
leak state into subsequent tests. It also provides a clean reset point
for thread-reusing frameworks (e.g. Puma, Sidekiq) that need to clear
context at the start of each request or job.
Without this method, callers would need to reference the internal
:labkit_contexts thread-local key directly to achieve the same effect.
Related Issues
Edited by Stan Hu