Logging tests#472
Conversation
|
Warning Review limit reached
More reviews will be available in 8 minutes and 58 seconds. Learn how PR review limits work. Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file). ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the 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 credits. 🚦 How do rate limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan refill rate. 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, the refill rate gradually slows as usage increases. The highest same-day bursts are limited more strictly. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (10)
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. Comment |
There was a problem hiding this comment.
Pull request overview
This PR adds test coverage for the Rust→JS logging forwarding layer, including validation of the exposed types.logLevels string enum and multi-callback / lifecycle isolation behaviors.
Changes:
- Adds new JS unit and integration tests covering log emission, formatting, level filtering, and per-client callback registration/removal.
- Adds Rust-side NAPI test helpers that emit
tracingevents for deterministic verification from JS. - Adds additional Rust unit tests for
MessageVisitorformatting and updates TS API-generation/typecheck tests to includetypes.logLevels.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| test/unit/logging-tests.js | New unit tests for Rust log forwarding, formatting, filtering, and multi-callback behavior. |
| test/unit/api-tests.js | Verifies types.logLevels is exposed with expected string values. |
| test/typescript/types-test.ts | Typecheck coverage for types.logLevels in TS. |
| test/typescript/client-tests.ts | Typecheck coverage for using logLevel: types.logLevels.* in Client options. |
| test/typescript/api-generation-test.ts | Extends TS API generation checks to include string-enum printing for types.logLevels. |
| test/integration/supported/client-logging-tests.js | New integration tests validating Rust log emission and isolation across shutdown/GC. |
| src/tests/mod.rs | Registers the new Rust test-helper module. |
| src/tests/logging_tests.rs | Adds NAPI-exported Rust helpers that emit tracing events at known levels/fields. |
| src/logging.rs | Adds unit tests for MessageVisitor formatting and existing level parsing/mapping. |
| package.json | Removes --exit from the integration test script. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
At some point the code was changed, in a way that fixes scylladb#44. This commit fixes scylladb#44 by removing that redundant flag
This includes moving api tests to a proper directory, since those tests are properly supported.
Covers MessageVisitor field formatting (str message, mixed str/debug extras, comma separation across multiple fields) and the rust_level_to_js / parse_js_level_to_rust mapping correctness.
Adds napi test helpers (tests_emit_log_*) that emit tracing events at controlled levels and with varied field shapes, plus the JS unit suite that drives them across the FFI boundary: - forwarding delivers events at all 5 tracing levels - message content and target (Rust module path) survive the FFI boundary - multiple registered callbacks each receive events (shared subscriber) - removeLogging stops delivery without affecting other callbacks - level filtering only passes events at or above the registered level - furtherInfo field formatting end-to-end (comma separation, debug quotes, int/bool repr) - default logLevel registers the Rust callback; logLevel 'off' suppresses all events
Verifies logging against a real cluster: - the Rust driver produces log events during connection - JS and Rust log events coexist during connection - cleanup works both on explicit shutdown and on GC finalization
Fixes: #44