Skip to content

Expand test coverage to 96% (and add AGENTS.md)#21

Draft
jdidion wants to merge 1 commit into
mainfrom
modernize/beekeeper
Draft

Expand test coverage to 96% (and add AGENTS.md)#21
jdidion wants to merge 1 commit into
mainfrom
modernize/beekeeper

Conversation

@jdidion

@jdidion jdidion commented Jun 14, 2026

Copy link
Copy Markdown
Owner

Note: This MR was largely generated by Claude and has not been completely reviewed by me (the human). You should feel free to defer your review until this warning has been removed.

Improved test coverage for the beekeeper Rust worker-pool library by adding 49 targeted unit tests for previously-uncovered non-trivial branches, identified via cargo-llvm-cov. Coverage rose from 93.31%/93.87%/93.88% to 95.26%/96.30%/96.05% (region/function/line) under the canonical feature set. Added AGENTS.md. No production code or build-system changes. All checks pass (clippy -D warnings, fmt --check, 377 lib tests, 26 doctests). Committed locally to branch modernize/beekeeper off main; nothing pushed.

Changes

  • Created branch modernize/beekeeper off main (was on maintenance/template-alignment)
  • Added AGENTS.md documenting build/test/coverage commands, the mutually-exclusive channel-backend features (so --all-features does NOT compile), trunk=main, and the coverage gotcha (needs a rustup toolchain with llvm-tools; the active Homebrew rustc lacks llvm-profdata, so run via rustup run stable cargo llvm-cov)
  • panic.rs: tests for payload() accessor and PartialEq/Eq
  • bee/error.rs: tests for From for ApplyRefError, all into_apply_error arms, and None-input cases for input()/into_input()
  • bee/context.rs: new test module covering task_id()/attempt(), submit() error branch with no LocalContext, From for TaskMeta, and weight()
  • bee/worker.rs: tests for Worker::map's Fatal and Retryable error-mapping arms and apply_ref Fatal/Cancelled arms
  • bee/stock/thunk.rs: tests for PunkWorker (success + panic-catch into ApplyError::Panic) and the Clone impls of all three worker types
  • bee/stock/call.rs: test exercising Callable's Deref/DerefMut
  • bee/queen.rs: test for Default impl of CloneQueen
  • hive/builder/bee.rs: tests for From, From, and config_ref path
  • hive/builder/full.rs: tests for From and From
  • hive/builder/open.rs: test for with_queen_mut (rstest over both queue types)
  • hive/outcome/impl.rs: tests for error() accessor, subtask_ids() on *WithSubtasks variants, and try_into_input for FailureWithSubtasks/UnprocessedWithSubtasks
  • hive/outcome/iter.rs: tests for select_results/select_outputs, into_results/into_outputs, and the drop-unrequested-outcome branch
  • hive/outcome/queue.rs: test exercising outcomes_deref_mut (mutable flush path)
  • hive/outcome/store.rs: tests for len(), counts, remove_all() drain, and the OwnedOutcomes group (into_iter, unwrap success+panic, ok_or_unwrap_errors ok/err/panic, into_unprocessed ordered+unordered, iter_unprocessed/successes/failures)
  • Committed locally as 99a2c86 on modernize/beekeeper

Test coverage

  • Before: 328 lib tests + 26 doctests passing; coverage 93.31% region / 93.87% function / 93.88% line (-F affinity,local-batch,retry)
  • After: 377 lib tests + 26 doctests passing (1 doctest ignored, unchanged); coverage 95.26% region / 96.30% function / 96.05% line; clippy --all-targets -D warnings clean; cargo fmt --check clean

Review findings (Claude code-reviewer)

  • SUGGESTION Coverage gap: ApplyError::into_source() Cancelled/Retryable/Fatal arms now tested, but ApplyRefError::into_apply_error has no negative/round-trip coverage for the Panic path (src/bee/error.rs)
  • NIT panic.rs::test_eq documents surprising equality semantics but could be more explicit that payload VALUE is never compared (src/bee/error.rs)
  • NIT New panic-catching tests print backtraces to stderr during the test run (src/bee/stock/thunk.rs)
  • NIT call.rs::test_callable_deref is correct but relies implicitly on the closure being Copy (src/bee/stock/call.rs)
  • SUGGESTION Ordering-sensitive assertions in new store/iter tests are sound; flagging the one place ordering is deliberately asserted vs sorted (src/hive/outcome/store.rs)
  • SUGGESTION AGENTS.md mutual-exclusivity claim is accurate and matches Cargo.toml, but is not enforced in code (AGENTS.md)

Add 49 unit tests targeting previously-uncovered branches identified via
cargo-llvm-cov, plus an AGENTS.md documenting build/test/coverage conventions.

Coverage (features affinity,local-batch,retry):
  region 93.31% -> 95.26%, function 93.87% -> 96.30%, line 93.88% -> 96.05%

New tests cover:
- panic.rs: payload() accessor and PartialEq/Eq
- bee/error.rs: From<E> for ApplyRefError, into_apply_error arms, None inputs
- bee/context.rs: task_id/attempt, submit() without local ctx, From<TaskId>
- bee/worker.rs: Worker::map Fatal/Retryable arms, apply_ref Fatal/Cancelled
- bee/stock/thunk.rs: PunkWorker ok + panic-catch, worker Clone impls
- bee/stock/call.rs: Callable Deref/DerefMut
- bee/queen.rs: Default for CloneQueen
- hive/builder/{bee,full,open}.rs: From<Config>/From<Q>, with_queen_mut, config_ref
- hive/outcome/impl.rs: error(), subtask_ids(), try_into_input WithSubtasks
- hive/outcome/iter.rs: select_*_results/outputs, into_results/outputs, drop-unrequested
- hive/outcome/queue.rs: outcomes_deref_mut path
- hive/outcome/store.rs: len, remove_all, OwnedOutcomes group (unwrap,
  ok_or_unwrap_errors, into_unprocessed ordered/unordered, iter_*)

No production code or build-system changes. clippy -D warnings, fmt --check,
doc-tests, and the full suite (377 lib + 26 doc) all pass.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant