feat: add optional drift-core rust acceleration path#121
Merged
Conversation
Contributor
There was a problem hiding this comment.
1 issue found across 1 file (changes from recent commits).
Prompt for AI agents (all issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="src/instrumentation/libraries/mysql2/mocks/TdMysql2ConnectionMock.ts">
<violation number="1" location="src/instrumentation/libraries/mysql2/mocks/TdMysql2ConnectionMock.ts:61">
P2: Execute replay input values can omit `values` for no-parameter queries while recording stores an empty array, causing replay matching failures. Preserve the empty-array default to match recording behavior.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
src/instrumentation/libraries/mysql2/mocks/TdMysql2ConnectionMock.ts
Outdated
Show resolved
Hide resolved
Contributor
There was a problem hiding this comment.
1 issue found across 1 file (changes from recent commits).
Prompt for AI agents (all issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="src/instrumentation/libraries/mysql2/Instrumentation.ts">
<violation number="1" location="src/instrumentation/libraries/mysql2/Instrumentation.ts:1643">
P2: Pooled connections can be reused across requests, but the new guard prevents rebinding to the current request context. Because the wrapper closures capture the original `parentContext`, later checkouts will keep using a stale context, causing cross-request trace contamination. Update the binding to store the current context and reuse wrappers without pinning the first context forever.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
Contributor
There was a problem hiding this comment.
1 issue found across 4 files (changes from recent commits).
Prompt for AI agents (all issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="src/instrumentation/libraries/mysql2/mocks/TdMysql2ConnectionMock.ts">
<violation number="1" location="src/instrumentation/libraries/mysql2/mocks/TdMysql2ConnectionMock.ts:42">
P2: The mock now captures stack traces but excludes `Mysql2Instrumentation` instead of the mock class. That leaves `TdMysql2ConnectionMock` frames in the replay stack trace while record mode stacks don’t include them, which can cause mock lookup mismatches when stackTrace is part of the replay request payload. Exclude the mock class (and optionally the instrumentation class) to keep record/replay stacks aligned.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
src/instrumentation/libraries/mysql2/mocks/TdMysql2ConnectionMock.ts
Outdated
Show resolved
Hide resolved
sohil-kshirsagar
approved these changes
Feb 21, 2026
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
Add Rust-core acceleration paths to the Node SDK export pipeline, wire Rust opt-in through instrumentation e2e runners/CI, and document Node-specific Rust binding behavior.
Also includes mysql2 replay correctness/stability fixes that were uncovered during broader CI/e2e validation in this branch.
Changes
src/core/rustCoreBinding.tsbridge and route span payload processing/building through Rust helpers with fail-open fallback to JS paths.SpanTransformerto use Rust-assisted payload/schema/hash processing and prebuild span protobuf bytes when available.ApiSpanAdapterto use Rust-builtExportSpansRequestbytes when all spans have prebuilt bytes, while preserving existing typed-proto fallback behavior.CleanSpanDatawith optionalprotoSpanBytesto support mixed fast-path export flow.run.shscripts and setTUSK_USE_RUST_CORE=1in.github/workflows/e2e.ymlso CI exercises Rust-enabled e2e.@use-tusk/drift-core-node@0.1.6inpackage.jsonand lockfile.docs/rust-core-bindings.mdfor Node (enablement, fallback behavior, native platform concerns).onConflictDoUpdate) for duplicate key scenarios.Mysql2 Replay Follow-ups
These fixes are included in this PR because mysql2 replay started failing in CI while validating the broader branch. Root cause was record/replay identity drift in mysql2 paths (pool connection context/shape/normalization), not Rust protobuf/export logic.
trxNN) to reduce nondeterministic replay misses.While the Rust refactor did not introduce the mysql2 logic changes directly, enabling the Rust path and running wider/more frequent e2e coverage in CI may have made pre-existing mysql2 replay fragility easier to surface. Keeping these fixes in the same branch avoids shipping known flaky replay behavior and keeps CI green for the end-to-end changes being introduced.
Notes
TUSK_USE_RUST_CORE.