Skip to content

test: enforce 90% per-file coverage - #6

Merged
senamakel merged 134 commits into
mainfrom
coverage-per-file-90
Aug 10, 2026
Merged

senamakel merged 134 commits into
mainfrom
coverage-per-file-90

Conversation

@senamakel

@senamakel senamakel commented Aug 10, 2026 •

Copy link
Copy Markdown
Member

Summary

Adds a CI coverage job that builds module fixtures, runs fixture-backed end-to-end tests, and enforces at least 90% line coverage for every executable source file.

Expands in-crate coverage across the bus, module runtime and host, CLI, macro generation, transport, loader, error handling, events, and protocol helpers.

The two abstract port-trait files are explicitly excluded because they contain contract declarations rather than executable bodies; their implementations are covered.

Validation

  • cargo fmt --all -- --check
  • cargo clippy --locked --all-targets --all-features -- -D warnings
  • cargo check --locked --no-default-features
  • cargo test --locked --all-features
  • fixture-backed cargo llvm-cov --workspace --all-features --fail-under-file-lines 90 -- --include-ignored

Coverage gate result: tinybus-module 90.28%; module host 91.04%; all enforced executable files meet the 90% threshold.

Summary by CodeRabbit

  • Tests
    • Expanded coverage across module hosting, loading, transport, broker, events, manifests, naming, and error handling.
    • Added integration tests for module lifecycle, startup, shutdown, callbacks, malformed requests, and failure scenarios.
    • Added macro, ABI, registry, and Unix transport edge-case tests.
  • Chores
    • Added automated coverage reporting with a 90% per-file line-coverage threshold.

senamakel and others added 30 commits August 10, 2026 17:39
…src/module/abi.rs,crates/tinybu

Auto-committed-on: dragonfly
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Reformatted test assertions and struct literals in the ABI and manifest modules to follow standard Rust formatting conventions, wrapping long lines and aligning expressions for improved readability without any behavioural changes.

Auto-committed-on: dragonfly
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Add unit tests covering the round-trip encoding and decoding of arguments, the redaction of sensitive data in error messages, the validation of interface and member name parsers, and the fallback behavior of the unknown method error constructor.

Auto-committed-on: dragonfly
Co-authored-by: Medulla <medulla@tinyhumans.ai>
…names

Reformatted the assertion for parse_interface to span multiple lines, improving readability without changing any behavior.

Auto-committed-on: dragonfly
Co-authored-by: Medulla <medulla@tinyhumans.ai>
The test for unknown method fallback was checking the error name directly and then checking for a substring that was too broad. The assertion now verifies that the rendered error message contains both "UnknownMethod" and "Unknown", making the test more precise about what the error actually communicates.

Auto-committed-on: dragonfly
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Auto-committed-on: dragonfly
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Add tests to verify that every structured error has a stable wire name starting with the correct prefix, and that the module refusal error uses a safe filename fallback. Also add tests for name grammar boundary cases and generated conversions to ensure valid names are preserved correctly.

Auto-committed-on: dragonfly
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Reformatted the error variant initializers in the test to use multi-line struct expressions, making the test easier to read and maintain without changing any behavior.

Auto-committed-on: dragonfly
Co-authored-by: Medulla <medulla@tinyhumans.ai>
The test assertion for ModuleUnavailable was updated to use the new struct variant with named fields instead of the old tuple variant, ensuring the test compiles and correctly validates the refactored error type.

Auto-committed-on: dragonfly
Co-authored-by: Medulla <medulla@tinyhumans.ai>
…error classification

Add three test cases covering edge cases in the Unix transport: verifying that a mid-frame hangup is treated as a protocol error and that close is idempotent, ensuring socket labels and failed dials produce operator-useful error messages, and confirming that transient accept errors are correctly classified without hiding fatal errors.

Auto-committed-on: dragonfly
Co-authored-by: Medulla <medulla@tinyhumans.ai>
…test

The test for socket labels and failed dials now uses `err().expect()` instead of `unwrap_err()` to make the assertion clearer when the dial unexpectedly succeeds, improving the diagnostic message on test failure.

Auto-committed-on: dragonfly
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Reformatted several test assertions in the Unix transport module to break long lines into multiple lines, improving code readability without changing any behavior.

Auto-committed-on: dragonfly
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Add imports for Message, InterfaceName, MemberName, and ObjectPath types that are used by the test code but were previously missing, resolving compilation errors in the test module.

Auto-committed-on: dragonfly
Co-authored-by: Medulla <medulla@tinyhumans.ai>
…ode rejection

Add three new test functions covering edge cases in event bus configuration and message decoding. The root catalog test verifies that a bus configured with a root path maintains the expected wire shape and path resolution. The config validation test ensures that invalid catalog paths and interface names are rejected before subscription creation. The decode rejection test confirms that messages with wrong interfaces, members, paths, or malformed bodies are correctly ignored during decoding.

Auto-committed-on: dragonfly
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Auto-committed-on: dragonfly
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Reformatted two multi-argument function calls in the test file to use one argument per line, improving code readability without changing any behavior.

Auto-committed-on: dragonfly
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Replaced the assertion on the connection description string with a check against the unique bus name, ensuring the test validates the actual connection identity rather than a generic transport label.

Auto-committed-on: dragonfly
Co-authored-by: Medulla <medulla@tinyhumans.ai>
The test previously asserted that a root bus connection always has the unique name `:1.0`, but this assumption is incorrect when the connection has not been assigned a name. The assertion now checks that the unique name is `None`, matching the actual behaviour of an unconnected bus.

Auto-committed-on: dragonfly
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Adds a test module covering the subscriber's core behaviour: handlers without a filter accept all domains, subscription handles expose their name and support cancellation, and a closed signal stream correctly ends the dispatch loop.

Auto-committed-on: dragonfly
Co-authored-by: Medulla <medulla@tinyhumans.ai>
…d malformed messages

Add three new test cases to the subscriber module: one verifying that handlers and closures can be called through the trait, one ensuring that forgetting a completed handle leaves its task alone, and one confirming that malformed and lagged messages do not end the dispatch loop.

Auto-committed-on: dragonfly
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Add three new test cases to the OnceBus test module covering default construction, initialisation over an existing transport with manifest announcement, and the safety of announcing before initialisation. These tests improve coverage of the bus's lifecycle and ensure that default-constructed instances behave as uninitialised singletons.

Auto-committed-on: dragonfly
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Reformatted an assertion in the global module's test that exceeded the project's line length guidelines, wrapping the arguments across multiple lines for improved readability without changing any behavior.

Auto-committed-on: dragonfly
Co-authored-by: Medulla <medulla@tinyhumans.ai>
The test code now constructs PeerManifest instances using the builder method `.version()` instead of passing the version as a second constructor argument, reflecting a change in the library's API.

Auto-committed-on: dragonfly
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Reformatted two long lines in the test module of the global bus to comply with the project's line length conventions, wrapping the `PeerManifest` construction across two lines for improved readability.

Auto-committed-on: dragonfly
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Added a `cfg_attr` annotation to the `Listener` trait to skip coverage instrumentation when the `coverage` feature is enabled, as trait definitions cannot be meaningfully measured by code coverage tools.

Auto-committed-on: dragonfly
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Added a `cfg_attr` annotation to the `Transport` trait so that when coverage profiling is enabled, the trait definition is excluded from coverage measurement. This prevents false negatives in coverage reports, as trait definitions themselves contain no executable logic.

Auto-committed-on: dragonfly
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Register the `coverage` cfg with `rustc-check-cfg` so that `cargo llvm-cov` can enable it without triggering unexpected-cfg warnings. The port traits only declare contracts, so their abstract methods have no executable coverage to measure.

Auto-committed-on: dragonfly
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Add comprehensive unit tests for the tinybus-macros crate covering expansion of dispatch members, validation of interface method signatures, and parsing of helper attributes to ensure correctness of the derive macro implementation.

Auto-committed-on: dragonfly
Co-authored-by: Medulla <medulla@tinyhumans.ai>
The test assertion was changed to check for the absence of the attribute marker `# [ tinybus` instead of checking for the absence of the words `private` and `tinybus` separately. This makes the test more precise by targeting the generated attribute syntax rather than unrelated occurrences of those strings.

Auto-committed-on: dragonfly
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Reformatted two test assertions in the macro crate's test suite to break long lines, improving code readability without changing any behaviour.

Auto-committed-on: dragonfly
Co-authored-by: Medulla <medulla@tinyhumans.ai>
senamakel and others added 7 commits August 10, 2026 18:34
The test module was moved from a separate file into an inline `#[cfg(test)] mod tests` block within lib.rs, removing the external test.rs file. This consolidates the test code with the implementation it tests, making the module self-contained and simplifying the crate structure.

Auto-committed-on: dragonfly
Co-authored-by: Medulla <medulla@tinyhumans.ai>
The CI workflow now passes the `--ignore-filename-regex` flag to `cargo llvm-cov` to exclude port trait files from coverage requirements, since those files declare contracts without executable bodies and their coverage is exercised through transport implementations instead.

Auto-committed-on: dragonfly
Co-authored-by: Medulla <medulla@tinyhumans.ai>
…ension

Added assertions to verify that the default search paths include the expected modules directory and that loading a file with a non-loadable extension produces an appropriate error message, improving test coverage for module host helper functions.

Auto-committed-on: dragonfly
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Reformatted two multi-line assertion chains in the module host test to improve readability by breaking them across multiple lines, making the code easier to follow without changing any test logic or behavior.

Auto-committed-on: dragonfly
Co-authored-by: Medulla <medulla@tinyhumans.ai>
The test subscriber now creates a tracing span before emitting log messages, ensuring that the span context is properly captured and tested alongside the log output.

Auto-committed-on: dragonfly
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Auto-committed-on: dragonfly
Co-authored-by: Medulla <medulla@tinyhumans.ai>
The test was passing a reference to a moved `HostSubscriber` value, causing a use-after-move when `record_follows_from`, `enter`, and `exit` were called. The fix re-creates the subscriber after the `with_default` closure so the value is still live when those methods are invoked.

Auto-committed-on: dragonfly
Co-authored-by: Medulla <medulla@tinyhumans.ai>
@coderabbitai

coderabbitai Bot commented Aug 10, 2026 •

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@senamakel, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 42 minutes

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 75fab4b5-3d2d-4071-bfad-610c7ed1250e

📥 Commits

Reviewing files that changed from the base of the PR and between b368f1f and c2bc89e.

📒 Files selected for processing (9)
  • crates/tinybus-macros/src/lib.rs
  • crates/tinybus-module/src/lib.rs
  • crates/tinybus/src/bin/tinybus.rs
  • crates/tinybus/src/connection.rs
  • crates/tinybus/src/error.rs
  • crates/tinybus/src/events/subscriber.rs
  • crates/tinybus/src/module/host_test.rs
  • crates/tinybus/src/module/loader.rs
  • crates/tinybus/src/private.rs
📝 Walkthrough

Walkthrough

The pull request adds a CI coverage job and expands tests across macro expansion, module startup and lifecycle, broker and transport behavior, events, errors, naming, and command integration.

Changes

Coverage and test expansion

Layer / File(s) Summary
Macro expansion and validation
crates/tinybus-macros/src/lib.rs
Tests cover generated interfaces, method attributes, skipped and zero-argument methods, valid names, and invalid signatures.
Module ABI, manifest, and transport behavior
crates/tinybus-module/src/lib.rs, crates/tinybus/src/module/{abi,manifest,loader,transport}.rs
Tests cover ABI fields, manifests, loader validation, callbacks, startup configuration, readiness, delivery, faults, and shutdown.
Module host and command lifecycle
crates/tinybus/src/module/host_test.rs, crates/tinybus/src/bin/tinybus.rs
Tests cover module admission, state transitions, directory operations, command errors, and dynamic module lifecycle operations.
Bus, event, and error behavior
crates/tinybus/src/{connection,build_info,error,global,name,native,private}.rs, crates/tinybus/src/events/*
Tests cover bus identity and manifests, event validation and subscriptions, global initialization, names, native handlers, and stable errors.
Broker, Unix transport, and CI coverage
crates/tinybus/src/{broker,transport/unix}.rs, .github/workflows/ci.yml
Tests cover listener behavior, malformed requests, partial frames, socket errors, and accept-error classification. CI enforces a 90% per-file line-coverage threshold.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Possibly related PRs

Poem

A rabbit checks each bus and byte,
Through module dawn and shutdown night.
Macros hop through names with care,
Coverage blooms in CI air.
Every test goes thump-thump-thump!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: enforcing a 90% per-file coverage threshold through tests and CI.
Docstring Coverage ✅ Passed Docstring coverage is 89.02% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 4

🧹 Nitpick comments (5)
crates/tinybus/src/module/loader.rs (1)

270-279: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Assert which refusal the loader returns.

Both assertions only check is_err(). The NUL-path case passes even if the failure comes from dlopen instead of the CString::new guard in platform::open, so the test does not prove that the path validation ran. Assert the refusal text for each case.

♻️ Proposed stronger assertions
-        let missing = Path::new("/definitely/not/a/tinybus-module.so");
-        assert!(load(missing, false).is_err());
+        let missing = Path::new("/definitely/not/a/tinybus-module.so");
+        assert!(
+            load(missing, false)
+                .unwrap_err()
+                .to_string()
+                .contains("dynamic loader rejected the artifact")
+        );
 
         use std::os::unix::ffi::OsStrExt;
         let nul_path = Path::new(std::ffi::OsStr::from_bytes(b"module\0name"));
-        assert!(platform::open(nul_path).is_err());
+        assert!(
+            platform::open(nul_path)
+                .unwrap_err()
+                .to_string()
+                .contains("artifact path is invalid")
+        );
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@crates/tinybus/src/module/loader.rs` around lines 270 - 279, Strengthen
unix_loader_refuses_missing_and_nul_containing_paths by asserting the specific
refusal text for both load(missing, false) and platform::open(nul_path), rather
than only checking is_err(). Match the message produced by the missing-path
loader failure and the CString::new validation guard so the NUL case proves path
validation executed.
crates/tinybus/src/bin/tinybus.rs (2)

495-503: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Document that the returned ModuleHost must stay bound.

ModuleHost::new registers only a Weak module control with the broker. If a caller writes let (_dir, address, _) = broker_with_module_host().await;, the host drops immediately, the broker loses its module control, and every module command fails for a reason unrelated to the test. The current callers bind _host, which keeps it alive, but nothing in the code states why that binding matters.

♻️ Proposed comment
     async fn broker_with_module_host() -> (tempfile::TempDir, PathBuf, ModuleHost) {
         let dir = tempfile::tempdir().unwrap();
         let address = dir.path().join("bus");
         let listener = UnixListenerAdapter::bind(&address).await.unwrap();
         let broker = Broker::new();
+        // The broker keeps only a `Weak` to the module control, so the caller
+        // must hold this `ModuleHost` for the whole test. Dropping it turns
+        // every module command into an unrelated failure.
         let host = ModuleHost::new(broker.clone());
         broker.spawn(listener);
         (dir, address, host)
     }

As per coding guidelines: "Comments must explain decisions rather than restate code; document load-bearing ordering, bounds, and lock choices with their reasons."

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@crates/tinybus/src/bin/tinybus.rs` around lines 495 - 503, Document in
broker_with_module_host that the returned ModuleHost must remain bound for the
broker’s weak module control to stay alive and module commands to work. Add a
concise rationale-focused comment near the helper’s return or host creation,
without changing its behavior or callers.

Source: Coding guidelines


628-629: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Rename or split this test so the name matches the asserted property.

The name states that module commands and invalid JSON fail, but Lines 663-685 assert that List, Doctor, and Scan succeed, and Lines 687-712 switch to a second broker to cover a different property. Split the successful-command coverage into its own test, or rename this one to state both properties.

As per coding guidelines: "Name tests after the property they assert, not the function under test."

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@crates/tinybus/src/bin/tinybus.rs` around lines 628 - 629, Rename or split
module_commands_and_invalid_json_fail_with_a_running_broker so its name
accurately reflects the assertions: successful List, Doctor, and Scan commands,
invalid JSON failures, and the separate second-broker behavior. Prefer
extracting the successful-command assertions into a dedicated test named for
their success property while keeping the failure-focused assertions in the
original test.

Source: Coding guidelines

crates/tinybus/src/module/host_test.rs (1)

811-814: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Assert the actual state names, not the array length.

assert_eq!(states.iter().map(state_name).collect::<Vec<_>>().len(), 11) compares the length of a mapped array against the length of that same array. It always holds, so it only raises coverage and proves nothing about state_name. Assert the produced names instead.

♻️ Proposed assertion on the mapped names
-    assert_eq!(states.iter().map(state_name).collect::<Vec<_>>().len(), 11);
+    assert_eq!(
+        states.iter().map(state_name).collect::<Vec<_>>(),
+        [
+            "discovered",
+            "rejected",
+            "unresolved",
+            "resolved",
+            "initializing",
+            "ready",
+            "serving",
+            "faulted",
+            "failed",
+            "stopped",
+            "disabled",
+        ]
+    );
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@crates/tinybus/src/module/host_test.rs` around lines 811 - 814, Update the
assertion around state_name in the host test to compare the collected mapped
state names against the expected names, rather than comparing the collection’s
length to 11. Preserve the existing state_detail assertions and verify the
complete ordered name list produced from states.
crates/tinybus-macros/src/lib.rs (1)

308-311: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Make the helper-attribute assertion spacing-independent.

# [ tinybus is token spacing rather than a stable Rust-token invariant, so the test can pass if the token stream is serialized with adjacent attribute punctuation. Parse the emitted TokenStream into a syn::File and assert that no re-emitted method attributes are identified as tinybus.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@crates/tinybus-macros/src/lib.rs` around lines 308 - 311, Update the relevant
macro test around the expanded TokenStream assertions to parse expanded with
syn::File, then inspect the emitted methods’ attributes and assert none are
identified as tinybus. Replace the fragile expanded.contains("# [ tinybus")
check while preserving the existing interface, Ping, and Zero assertions.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@crates/tinybus-module/src/lib.rs`:
- Around line 636-641: Serialize all tests that access the shared HOST_* globals
and START_OUTGOING by adding or reusing a module-level test mutex following
VTABLE_TEST_LOCK and FAKE_MODULE_TEST_LOCK, then acquire its guard at the
beginning of each affected test, including
module_transport_maps_host_results_and_wakes_after_receiving,
host_calls_and_subscriber_forward_logs_at_their_original_level,
configured_startup_builds_a_runtime_announces_ready_and_shuts_down, and
start_functions_reject_invalid_host_and_config_before_spawning_a_runtime.
Convert the two asynchronous tests to #[tokio::test] or use a std::sync::Mutex
guard so the lock remains held throughout each test.

In `@crates/tinybus/src/events/subscriber.rs`:
- Around line 256-264: Update the test at
crates/tinybus/src/events/subscriber.rs lines 256-264 to await the subscriber
task’s completion after dropping the broadcast sender, rather than yielding and
dropping the handle. In the test at lines 267-283, send a valid event after the
malformed and lagged inputs, then await handler delivery using
tokio::time::timeout around the receive; do not use sleep for synchronization.

In `@crates/tinybus/src/module/host_test.rs`:
- Around line 833-838: Make the search_paths assertion platform-safe in the test
around ModuleHost::search_paths: on Windows, set LOCALAPPDATA before checking
the result using the specified cfg guard, or restrict the existing assertion to
platforms that always append a path. Preserve the current suffix assertion where
the path is guaranteed to exist.

In `@crates/tinybus/src/private.rs`:
- Around line 60-69: Update
generated_helpers_round_trip_values_and_redact_bad_arguments to pass a
distinctive sensitive string that triggers the decode_args type error, then
assert the rendered error contains the member name and “bad arguments” but does
not contain that sensitive value. Preserve the existing successful round-trip
assertions.

---

Nitpick comments:
In `@crates/tinybus-macros/src/lib.rs`:
- Around line 308-311: Update the relevant macro test around the expanded
TokenStream assertions to parse expanded with syn::File, then inspect the
emitted methods’ attributes and assert none are identified as tinybus. Replace
the fragile expanded.contains("# [ tinybus") check while preserving the existing
interface, Ping, and Zero assertions.

In `@crates/tinybus/src/bin/tinybus.rs`:
- Around line 495-503: Document in broker_with_module_host that the returned
ModuleHost must remain bound for the broker’s weak module control to stay alive
and module commands to work. Add a concise rationale-focused comment near the
helper’s return or host creation, without changing its behavior or callers.
- Around line 628-629: Rename or split
module_commands_and_invalid_json_fail_with_a_running_broker so its name
accurately reflects the assertions: successful List, Doctor, and Scan commands,
invalid JSON failures, and the separate second-broker behavior. Prefer
extracting the successful-command assertions into a dedicated test named for
their success property while keeping the failure-focused assertions in the
original test.

In `@crates/tinybus/src/module/host_test.rs`:
- Around line 811-814: Update the assertion around state_name in the host test
to compare the collected mapped state names against the expected names, rather
than comparing the collection’s length to 11. Preserve the existing state_detail
assertions and verify the complete ordered name list produced from states.

In `@crates/tinybus/src/module/loader.rs`:
- Around line 270-279: Strengthen
unix_loader_refuses_missing_and_nul_containing_paths by asserting the specific
refusal text for both load(missing, false) and platform::open(nul_path), rather
than only checking is_err(). Match the message produced by the missing-path
loader failure and the CString::new validation guard so the NUL case proves path
validation executed.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 317fe733-f246-4e45-b4b8-efbaf4b573a5

📥 Commits

Reviewing files that changed from the base of the PR and between dd6063a and b368f1f.

📒 Files selected for processing (20)
  • .github/workflows/ci.yml
  • crates/tinybus-macros/src/lib.rs
  • crates/tinybus-module/src/lib.rs
  • crates/tinybus/src/bin/tinybus.rs
  • crates/tinybus/src/broker.rs
  • crates/tinybus/src/build_info.rs
  • crates/tinybus/src/connection.rs
  • crates/tinybus/src/error.rs
  • crates/tinybus/src/events/subscriber.rs
  • crates/tinybus/src/events/tests.rs
  • crates/tinybus/src/global.rs
  • crates/tinybus/src/module/abi.rs
  • crates/tinybus/src/module/host_test.rs
  • crates/tinybus/src/module/loader.rs
  • crates/tinybus/src/module/manifest.rs
  • crates/tinybus/src/module/transport.rs
  • crates/tinybus/src/name.rs
  • crates/tinybus/src/native.rs
  • crates/tinybus/src/private.rs
  • crates/tinybus/src/transport/unix.rs

Comment thread crates/tinybus-module/src/lib.rs
Comment thread crates/tinybus/src/events/subscriber.rs
Comment thread crates/tinybus/src/module/host_test.rs
Comment thread crates/tinybus/src/private.rs
@senamakel senamakel self-assigned this Aug 10, 2026
senamakel and others added 16 commits August 10, 2026 19:09
Auto-committed-on: dragonfly
Co-authored-by: Medulla <medulla@tinyhumans.ai>
The test for module host helpers now compares the full list of state names instead of just checking the count, making the assertion more precise and self-documenting. The loader tests for missing and nul-containing paths now verify the error messages contain the expected descriptions rather than only checking for an error. Tests that rely on platform-specific cdylib loading are gated behind `#[cfg(not(windows))]` to prevent build failures on Windows. A comment was added to the test helper to clarify that the module host must be kept alive because the broker stores it weakly.

Auto-committed-on: dragonfly
Co-authored-by: Medulla <medulla@tinyhumans.ai>
…module/src/lib.rs,crates/tinybu

Auto-committed-on: dragonfly
Auto-committed-on: dragonfly
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Auto-committed-on: dragonfly
Co-authored-by: Medulla <medulla@tinyhumans.ai>
…inybus/src/module/loader.rs

Auto-committed-on: dragonfly
…src/module/loader.rs

Auto-committed-on: dragonfly
Co-authored-by: Medulla <medulla@tinyhumans.ai>
The redaction logic now treats both backtick- and double-quoted spans as sensitive, matching how serde and most wrapped libraries format rejected values. It also handles escaped quotes inside double-quoted spans so the redaction does not stop early, keeping error messages safe to log while preserving their diagnostic value.

Auto-committed-on: dragonfly
The host state lock was changed from a blocking `std::sync::Mutex` to a non-blocking `tokio::sync::Mutex` to avoid potential deadlocks in async test contexts. The `host_state_guard` function is now async and returns a `tokio::sync::MutexGuard`, requiring all callers to await the guard and the affected tests to be marked as `#[tokio::test]`.

Auto-committed-on: dragonfly
Auto-committed-on: dragonfly
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Auto-committed-on: dragonfly
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Auto-committed-on: dragonfly
Co-authored-by: Medulla <medulla@tinyhumans.ai>
# Conflicts:
#	crates/tinybus/src/bin/tinybus.rs
#	crates/tinybus/src/connection.rs
#	crates/tinybus/src/module/loader.rs
@senamakel
senamakel merged commit 63e4955 into main Aug 10, 2026
8 checks passed
@senamakel
senamakel deleted the coverage-per-file-90 branch August 14, 2026 07:31
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