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
Open
test: fill coverage gaps with 87 new integration tests across bot + dispatch + events#58devin-ai-integration[bot] wants to merge 1 commit intomainfrom
devin-ai-integration[bot] wants to merge 1 commit intomainfrom
Conversation
…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.
Contributor
Author
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Autonomous coverage fill-in from an audit over
scripts/audit_teamtalk_coverage.pyplus a manual walk ofcrates/teamtalk/src/andcrates/teamtalk/tests/. Adds 87 new integration tests across six focused files; no changes tosrc/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.rs— 19 tests.DialogStatedefaults/expiry-boundary/timeout-policy round-trip, metadata replace+remove, legacypipedecode & malformed rejections;DialogFlownext/previous/start/terminal navigation;DialogMachinesession id uniqueness, advance reactivates paused, Clear vs Pause timeout policy on live expired, set/clear timeout, metadata persistence across reloads, custom prefix namespacing,is_inignores paused,restart_flowrotates session id.crates/teamtalk/tests/dispatcher_extra_tests.rs— 11 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 viastep()while siblings still run).crates/teamtalk/tests/events_error_extra_tests.rs— 14 tests.Event::is_reconnect_neededandis_reconnect_needed_with(discriminant match, payload irrelevance, empty extras);ConnectionState::default()andJoining(ChannelId)inequality;ErrorDisplay for each variant;IoError/ClientErrormessage fields;FfiErrorDisplay per variant;From<FfiError>cascade throughError::Ffi;SdkErrorClonepayload round-trip;Event::Unknown(ClientEvent)payload.crates/teamtalk/tests/bot_state_v2_extra_tests.rs— 13 tests.setoverwrite without growth,set_with_ttlreplaces permanent, plainsetclears TTL, remove on expired entry still evicts (documents current implementation: returns stale value but frees the slot),remove_prefixzero-match, empty-prefix removes all,keyswith empty prefix,existsfor expired,get_manypreserves requested order,set_manyempty-batch and overwrite,getfor missing/expired,remove_prefixwith mixed TTL expiry.crates/teamtalk/tests/scheduler_tests.rs— 11 tests. Empty-scheduler sentinel delay,every_named+every(unique auto-names),removeidempotence,set_enabledtoggle,set_enabledon missing is noop,is_enabled→Noneon missing, recurring job fires across ticks,afterjob is one-shot and fully removed after running, disabled job skipped,next_run_delayonly considers enabled jobs.crates/teamtalk/tests/bot_command_extra_tests.rs— 19 tests.parse_commandmulti-prefix / empty+prefix-only rejection / argument order / whitespace collapsing;CommandPattern::parserejects empty/required-after-optional/variadic-not-last/command-token-after-args;min_args/max_argsfor fixed and variadic tails;acceptsarity validation; descriptor flags (required/variadic); multi-word command names; usage bracketing + prefix insertion;Argsraw/rest/get-parse-error/missing/all.What was NOT changed
src/files touched.mock/bot) already used by sibling tests.Observations from audit that did NOT become test changes
audit_teamtalk_coverage.pyreports 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 referenceTT_*names. Most high-level wrappers are exercised through the safe API, so expanding that metric by parrotingTT_*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.Botthrough 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.bot_state_v2_extra_tests::remove_evicts_expired_entry_even_though_it_returns_the_stale_valuedocuments thatMemoryStateStore::removedoes 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 ansrc/change (not in this PR).dispatcher_extra_tests::dispatcher_stop_from_first_handler_still_surfaces_stop_and_lets_siblings_run— confirms current semantics:Stopfrom one handler still lets siblings on the same event fire;Stopis reported atstep()return so the outer loop exits after the event. If you'd rather have "short-circuit within event", that's also ansrc/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