← Back to Pull requests

feat: promote rust streaming from nominal.experimental into nominal.core #1072

Closed
unknown closed this pull request without merging on Oct 09, 2026 20:42 UTC
View on GitHub
unknown unknown commented on Oct 08, 2026 22:27 UTC
Author

What and why

Rust streaming has been what get_write_stream() returns by default since #974, but RustWriteStream still lived in nominal.experimental.rust_streaming, and nominal.core.datasource imported from nominal.experimental to build its default stream.

This moves RustWriteStream into nominal/core/_stream/rust_write_stream.py, next to the python WriteStream. get_write_stream() behaves exactly as before: rust by default, falling back to python when nominal-streaming is unavailable, and refusing to fall back when rust or a rust-only argument was asked for.

It also consolidates the missing-nominal-streaming handling. Previously the rust module wrapped its failed import in a generic message, and _get_write_stream caught that to choose between falling back and refusing. Now _get_write_stream alone writes the error, and names why rust was needed (implementation='rust' and/or the rust-only arguments passed). The module imports nominal_streaming plainly.

Compatibility

  • nominal.experimental.rust_streaming and its rust_write_stream submodule keep working as deprecated aliases that re-export the nominal.core class. It is the same class object, so isinstance checks keep passing. Importing either path emits one UserWarning at the importing line, saying the path will be removed in a future release and pointing to get_write_stream() and nominal.core.DataStream. UserWarning matches the neighboring get_write_stream deprecations. No removal version is proposed. The warning fires when the module is first imported in a process, like any deprecated-module warning.

  • Without nominal-streaming, importing either alias fails up front with ModuleNotFoundError, as importing the package did before this PR.

  • RustWriteStream is not exported from nominal.core. nominal-streaming only installs on some platforms, so a top-level export would break import nominal.core on the others, and DataStream already declares every enqueue method.
  • Validation

  • just verify: 1391 passed, ruff format/lint clean, mypy clean; mypy also clean with --python-version 3.10.

  • New tests: both legacy import paths return the core class with exactly one warning, attributed to the importing line. Both fail against an earlier __getattr__ version of the alias, which warned twice and dropped the submodule. Existing tests cover the default stream paths, which would fail if they warned (warnings are errors).

  • That a module-level warning with stacklevel=2 names the importing line was checked on Python 3.10 and 3.12, for import pkg, from pkg import X, and from pkg.sub import X.

  • Checked by hand with nominal_streaming hidden: get_write_stream(implementation='rust', file_fallback=...) raises an ImportError naming both, chained to the original ModuleNotFoundError, and both alias imports raise that ModuleNotFoundError.
  • 🤖 Generated with Claude Code

    Diff: 371 lines (+278 / -93) across 4 files Reviewer: stefanv Review duration: 1334m
    All Vouch review confidence checks passed
    Residual risk 0.17 = Change Risk (0.43) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.43 · 371 lines diff across 4 files
    0.43
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    60%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.354
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #1072"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 42.8% (MEDIUM) · Higher = larger blast radius
    42.8%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 60.5% · Lower = rushed or shallow review
    60.5%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 16.9% · Safe to merge
    16.9%