feat: add optional drift-core rust acceleration path#69
Merged
Conversation
There was a problem hiding this comment.
4 issues found across 17 files
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="drift/core/json_schema_helper.py">
<violation number="1" location="drift/core/json_schema_helper.py:163">
P2: Inconsistent `None` check: this line uses `or` (falsy check), but `generate_deterministic_hash` uses `is not None`. An empty-string return would behave differently. Additionally, when `rust_decoded_hash` is `None`, the fallback `generate_deterministic_hash` will redundantly call `deterministic_hash_jsonable(decoded)` a second time. Use an explicit `if ... is not None` check and avoid the double call.</violation>
<violation number="2" location="drift/core/json_schema_helper.py:169">
P2: Same inconsistent `or` vs `is not None` pattern and redundant Rust call as the `decoded_value_hash` line. Use an explicit `is not None` check for consistency with `generate_deterministic_hash`.</violation>
</file>
<file name="drift/core/tracing/otel_converter.py">
<violation number="1" location="drift/core/tracing/otel_converter.py:462">
P2: The Rust fast-path now replaces input/output schemas with empty JsonSchema objects when `span_proto_bytes` is present, but filesystem export still serializes `span.input_schema`/`span.output_schema`. This drops schema data whenever Rust acceleration is enabled. Keep the schema conversion so downstream exports retain schema content.</violation>
</file>
<file name="drift/core/tracing/adapters/api.py">
<violation number="1" location="drift/core/tracing/adapters/api.py:209">
P2: `span.to_proto()` drops dict metadata because `clean_span_to_proto` only serializes `metadata.__dict__`. This regresses span exports (metadata omitted) when `proto_span_bytes` is missing or Rust serialization falls back. Consider using `_transform_span_to_protobuf` for Python serialization or updating `clean_span_to_proto` to handle dict metadata before switching to `to_proto`.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
sohil-kshirsagar
approved these changes
Feb 19, 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
Integrate optional
drift-core-pythonacceleration into the Python SDK behind fail-open feature flags, and wire e2e/benchmark flows to use SDK extras instead of ad-hoc version-pinned installs. See drift-core.Changes
pyproject.tomlextra:rust = ["drift-core-python>=0.1.6"]drift/core/rust_core_binding.pydrift_coreonly whenTUSK_USE_RUST_COREis enabled[rust]extra instead of direct version-plumbed binding installs:drift/instrumentation/e2e_common/base_runner.pydocs/environment-variables.mdwith Rust flagsdocs/rust-core-bindings.md.gitignore,.dockerignore) and dependency lock updates (uv.lock)Notes
TUSK_USE_RUST_CORE.