Skip to content

test: fill coverage gaps with 87 new integration tests across bot + dispatch + events#58

Open
devin-ai-integration[bot] wants to merge 1 commit intomainfrom
devin/1776972136-coverage-tests
Open

test: fill coverage gaps with 87 new integration tests across bot + dispatch + events#58
devin-ai-integration[bot] wants to merge 1 commit intomainfrom
devin/1776972136-coverage-tests

Conversation

@devin-ai-integration
Copy link
Copy Markdown
Contributor

@devin-ai-integration devin-ai-integration Bot commented Apr 23, 2026

Summary

Autonomous coverage fill-in from an audit over scripts/audit_teamtalk_coverage.py plus a manual walk of crates/teamtalk/src/ and crates/teamtalk/tests/. Adds 87 new integration tests across six focused files; no changes to src/ and no public API shifts.

Test count on this branch: 287 → 374 (+87), all green under cargo test --workspace --all-features.

Files added

  • crates/teamtalk/tests/bot_fsm_extra_tests.rs19 tests. DialogState defaults/expiry-boundary/timeout-policy round-trip, metadata replace+remove, legacy pipe decode & malformed rejections; DialogFlow next/previous/start/terminal navigation; DialogMachine session id uniqueness, advance reactivates paused, Clear vs Pause timeout policy on live expired, set/clear timeout, metadata persistence across reloads, custom prefix namespacing, is_in ignores paused, restart_flow rotates session id.
  • crates/teamtalk/tests/dispatcher_extra_tests.rs11 tests. Empty-queue step, event-specific filtering, wildcard for-all, Stop flow from any slot, shortcut handlers (connect_success/connection_lost/connect_failed/command_error/user_joined/text_message), multi-specific ordering, specific+wildcard insertion order merge, Stop semantics (surfaces via step() while siblings still run).
  • crates/teamtalk/tests/events_error_extra_tests.rs14 tests. Event::is_reconnect_needed and is_reconnect_needed_with (discriminant match, payload irrelevance, empty extras); ConnectionState::default() and Joining(ChannelId) inequality; Error Display for each variant; IoError/ClientError message fields; FfiError Display per variant; From<FfiError> cascade through Error::Ffi; SdkError Clone payload round-trip; Event::Unknown(ClientEvent) payload.
  • crates/teamtalk/tests/bot_state_v2_extra_tests.rs13 tests. set overwrite without growth, set_with_ttl replaces permanent, plain set clears TTL, remove on expired entry still evicts (documents current implementation: returns stale value but frees the slot), remove_prefix zero-match, empty-prefix removes all, keys with empty prefix, exists for expired, get_many preserves requested order, set_many empty-batch and overwrite, get for missing/expired, remove_prefix with mixed TTL expiry.
  • crates/teamtalk/tests/scheduler_tests.rs11 tests. Empty-scheduler sentinel delay, every_named + every (unique auto-names), remove idempotence, set_enabled toggle, set_enabled on missing is noop, is_enabledNone on missing, recurring job fires across ticks, after job is one-shot and fully removed after running, disabled job skipped, next_run_delay only considers enabled jobs.
  • crates/teamtalk/tests/bot_command_extra_tests.rs19 tests. parse_command multi-prefix / empty+prefix-only rejection / argument order / whitespace collapsing; CommandPattern::parse rejects empty/required-after-optional/variadic-not-last/command-token-after-args; min_args/max_args for fixed and variadic tails; accepts arity validation; descriptor flags (required/variadic); multi-word command names; usage bracketing + prefix insertion; Args raw/rest/get-parse-error/missing/all.

What was NOT changed

  • No src/ files touched.
  • No public API surface shifts; no new items re-exported; no trait methods added.
  • All new tests compile under existing feature flags (mock / bot) already used by sibling tests.

Observations from audit that did NOT become test changes

  • audit_teamtalk_coverage.py reports 203 "missing_tests" symbols, but the audit's own README notes the metric is strict direct-symbol grep — it flags tests that don't literally reference TT_* names. Most high-level wrappers are exercised through the safe API, so expanding that metric by parroting TT_* identifiers into assertions would not increase real behavioural coverage. The gaps I did fill are areas where the high-level Rust behaviour itself was lightly covered.
  • Router-group / unknown-command-policy / auto-help coverage is a legitimate next fill-in, but it requires a mock harness that wires a Bot through a full message flow; deferred to a follow-up rather than stubbed shallowly here.

Review & Testing Checklist for Human

  • cargo test --workspace --all-features — should report 374 passed on this branch.
  • Spot-check one non-obvious test assumption: bot_state_v2_extra_tests::remove_evicts_expired_entry_even_though_it_returns_the_stale_value documents that MemoryStateStore::remove does not consult the TTL — it returns the stored value even if expired, then evicts the slot. If you want strict TTL-aware remove, that's an src/ change (not in this PR).
  • Spot-check dispatcher_extra_tests::dispatcher_stop_from_first_handler_still_surfaces_stop_and_lets_siblings_run — confirms current semantics: Stop from one handler still lets siblings on the same event fire; Stop is reported at step() return so the outer loop exits after the event. If you'd rather have "short-circuit within event", that's also an src/ change.

Notes

This PR is the coverage-fill follow-up the user explicitly approved ("сам почитаеш и посмотриш как там что ну точнее если быть точнее куда где что ещё можно тестами в 58 и сделаеш"). Two new tests were written as documenting tests rather than bug reports — they record existing behaviour that looked surprising but is internally consistent. Call out in review if either should change behaviour instead; happy to follow up with the src/ change in a separate PR.

Link to Devin session: https://app.devin.ai/sessions/71fdd6196cb74723a2e277bb81993a9c
Requested by: @BlindMaster24


Open in Devin Review

…ge gaps

Adds six focused integration test files covering under-tested behaviour
surfaced by `scripts/audit_teamtalk_coverage.py` and a manual walk through
`crates/teamtalk/tests/`.

- `bot_fsm_extra_tests.rs` (19): DialogState defaults, expiry boundary,
  timeout policy encode/decode round-trip, metadata replace/remove, legacy
  pipe decode, DialogFlow navigation (next/previous/start/terminal),
  DialogMachine session ids, advance after pause, Clear vs Pause timeout
  policy, set/clear timeout, metadata persistence across reloads, custom
  prefix namespacing, is_in ignores paused, restart_flow rotates session.
- `dispatcher_extra_tests.rs` (11): empty queue behaviour, event-specific
  filtering, wildcard firing, Stop flow from any slot, shortcut handlers
  (connect/connection-lost/failed/cmd-error/user-joined/text-message),
  ordering of multiple specific handlers, specific+wildcard insertion
  order, Stop semantics (surfaces via step() but siblings still run).
- `events_error_extra_tests.rs` (14): Event::is_reconnect_needed and
  is_reconnect_needed_with (discriminant match, payload irrelevance, empty
  extras), ConnectionState defaults and Joining(ChannelId) inequality,
  Error Display for each variant, IoError/ClientError message fields,
  FfiError Display per variant, From<FfiError> cascade through Error::Ffi,
  SdkError Clone payload round-trip, Event::Unknown ClientEvent payload.
- `bot_state_v2_extra_tests.rs` (13): set overwrite without growth,
  set_with_ttl replaces permanent, set clears TTL, remove on expired entry
  still evicts (documents current behaviour: returns stale value but frees
  slot), remove_prefix 0-match case, empty prefix removes all, keys with
  empty prefix, exists for expired, get_many preserves request order,
  set_many empty batch and overwrites, get missing/expired, remove_prefix
  with mixed TTL expiry.
- `scheduler_tests.rs` (11): empty scheduler sentinel delay, every_named
  and every (unique auto-names), remove idempotence, set_enabled toggle,
  set_enabled on missing job is noop, is_enabled returns None for missing,
  recurring job fires multiple times, after job is one-shot and is removed
  after running, disabled job skipped, next_run_delay only considers
  enabled jobs.
- `bot_command_extra_tests.rs` (19): parse_command multi-prefix, empty
  and prefix-only rejection, argument order/count, whitespace collapsing;
  CommandPattern::parse rejection of empty/required-after-optional/
  variadic-not-last/command-token-after-args; min/max arity for fixed and
  variadic tails; accepts() validation; descriptor flags; multi-word
  command names; usage bracketing and prefix insertion; Args raw/rest/
  get-parse-error/missing/all.

Total: 287 -> 374 tests (+87) on this branch. All pass under
`cargo test --workspace --all-features`; no changes to src/ or public API.
@devin-ai-integration
Copy link
Copy Markdown
Contributor Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

Copy link
Copy Markdown
Contributor Author

@devin-ai-integration devin-ai-integration Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 5 additional findings.

Open in Devin Review

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