Skip to content

Annotate rust_consume_stream as implemented but not integrated (#127) - #164

Merged
leynos merged 14 commits into
mainfrom
issue-127-consume-stream-dispatch
Jun 25, 2026
Merged

Annotate rust_consume_stream as implemented but not integrated (#127)#164
leynos merged 14 commits into
mainfrom
issue-127-consume-stream-dispatch

Conversation

@leynos

@leynos leynos commented Jun 11, 2026

Copy link
Copy Markdown
Owner

Summary

This branch resolves the asymmetric status of rust_consume_stream by annotating it as implemented but not yet integrated, per the ADR-002 migration plan.

Closes #127.

The pump half of the Rust acceleration story is wired (_pump_stream_dispatch with Rust-then-Python fallback), but rust_consume_stream — though shipped, public, tested, and documented — has no production caller. ADR-002 gates consume-routing on its Phase 1 measurement schema, so of the two resolutions the issue offers, this takes the annotation path; wiring a _consume_stream_dispatch now would bypass that evidence gate.

Review walkthrough

Validation

  • make check-fmt: pass
  • make lint: pass
  • make typecheck: pass
  • make test: pass (603 passed, 44 skipped; Rust suite passes with 4 passed)
  • make markdownlint: pass
  • make nixie: pass
  • coderabbit review --agent: 0 findings

Notes

When Phase 2 work lands (parity property tests per #90, dispatcher with fallback), the marker and the guard test are removed together — the guard's failure message says exactly that.

References

@coderabbitai

coderabbitai Bot commented Jun 11, 2026

Copy link
Copy Markdown

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

This PR resolves the rust_consume_stream integration asymmetry by documenting it as implemented but not yet wired into production, rather than adding a consume-side dispatcher.

Key changes:

  • Clarify in cuprum/_streams_rs.py that rust_pump_stream is production-wired, while rust_consume_stream remains exported/tested but deferred to ADR-002 Phase 2.
  • Update user, developer, and design docs to reflect that production consume paths still use pure-Python _consume_stream, and to narrow the current Rust scope to pump-only routing.
  • Record the decision and Phase 2 boundaries in docs/adr-002-additional-rust-components.md, including the capture-only eligibility constraints and guard expectations.
  • Add guard coverage in cuprum/unittests/test_rust_streams.py to ensure rust_consume_stream stays unreferenced by production code, with improved AST-based scanning and error handling.
  • Keep the Rust lint suppression in rust/cuprum-rust/src/lib.rs for is_available.

The docs also align terminology (echo=True) and link the relevant ADRs, including ADR-002 and ADR-004.

Walkthrough

Marks rust_consume_stream as implemented but not production-routed, adds AST-based guard tests, and updates ADR, design, user, developer, and roadmap docs to record the deferred consume-dispatch path and its constrained Phase 2 scope.

Changes

Deferred consume dispatch annotation and guard

Layer / File(s) Summary
rust_consume_stream docstring markers
cuprum/_streams_rs.py
Module-level docs and the rust_consume_stream function docstring both gain explicit "not yet integrated" notes referencing ADR-002 Phase 2 work.
Guard test enforcing non-integration
cuprum/unittests/test_rust_streams.py
Adds AST-based module scanning helpers, a parametrised detector test for code-versus-text references, and production guard tests that assert the docstring marker and fail if any production module references rust_consume_stream.
ADR and design scope updates
docs/adr-002-additional-rust-components.md, docs/cuprum-design.md
Records Phase 1 profiling, narrows Phase 2 to capture-only fd-backed UTF-8/replace streams without echo sinks or line callbacks, and states that only pump-side routing is currently wired while consume-side routing remains deferred.
User and developer documentation
docs/users-guide.md, docs/developers-guide.md
The users guide states that consume paths continue to use the pure-Python implementation, and the developers guide adds the integration-status section while updating the decisions reference list to include ADR-002 and ADR-004.
Roadmap phases 5–8
docs/roadmap.md
Adds Phase 5 consume hot-path work, Phase 6 capture-only consume acceleration with dispatch and fallback, Phase 7 raw-sink echo/tee acceleration, and Phase 8 reliability plus native orchestration follow-ups.

Poem

🦀 A stream was named, yet left to rest,
In docs and guards it passed the test.
The pump runs native; consume stays neat,
Until Phase Two makes paths complete.
For now, the Python route holds fast.

🚥 Pre-merge checks | ✅ 19 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Out of Scope Changes check ⚠️ Warning The roadmap phase 5-8 expansion is unrelated to issue #127 and adds substantial scope beyond annotating rust_consume_stream. Remove the roadmap expansion or split it into a separate PR so this change stays focused on issue #127.
✅ Passed checks (19 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately states the chosen outcome for rust_consume_stream and includes the linked issue number.
Description check ✅ Passed The description stays on-topic and explains the annotation path for rust_consume_stream clearly.
Linked Issues check ✅ Passed The PR records the deferred integration decision in docs and adds guard tests, satisfying issue #127's deferred path.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Testing (Overall) ✅ Passed The new tests are substantive: they exercise consume decoding/defaults/error cases and the AST guard scans production modules, ignoring comments/docstrings, to catch real references.
User-Facing Documentation ✅ Passed Document the internal Rust consume status in docs/users-guide.md; it now says the helper is implemented but not yet integrated and routes stay on Python.
Developer Documentation ✅ Passed PASS: The developers’ guide, design doc and ADR all record rust_consume_stream as implemented but not integrated, and the guard tests back that status; no completed roadmap item or execplan needed...
Module-Level Documentation ✅ Passed Both touched code modules have clear top-level docs: _streams_rs.py states purpose and dispatch relations, and lib.rs/test_rust_streams.py explain their roles.
Testing (Unit And Behavioural) ✅ Passed Docs-only change; added tests cover helper edge cases, decode/error invariants, and a repository guard, with no new production routing to exercise.
Testing (Property / Proof) ✅ Passed The PR uses a finite repo scan plus example parametrisation; it does not introduce a new unbounded invariant or proof assumption that warrants proptest/CrossHair.
Testing (Compile-Time / Ui) ✅ Passed No compile-time or UI-adjacent behaviour was added; the PR only annotates docs and runtime guard tests, so trybuild/snapshot coverage is not newly required.
Unit Architecture ✅ Passed PASS: The PR stays in docs/tests; production still uses pure-Python _consume_stream, and the new scan helper keeps filesystem/parse fallibility explicit and test-only.
Domain Architecture ✅ Passed Approve: this branch only updates docs and tests; no domain logic or business policy code is moved into transport or infrastructure concerns.
Observability ✅ Passed PASS: The PR only changes docstrings/docs and tests; no production path, logging, metrics, tracing, or alerts were added, so observability changes were not required.
Security And Privacy ✅ Passed Touched files only add documentation and AST-based tests; no secrets, credentials, auth changes, or unsafe input sinks appear.
Performance And Resource Use ✅ Passed PASS: only docs/docstrings change runtime behaviour, and the new guard test scans a bounded set of 35 package .py files once; no hot-path or unbounded resource use.
Concurrency And State ✅ Passed PASS: the PR only updates docstrings/docs and adds sequential guard tests; no shared mutable state, locks, tasks, or ordering logic changed.
Architectural Complexity And Maintainability ✅ Passed Only docs and test-only AST guards changed; no new runtime layer, dispatcher, or abstraction was added.
Rust Compiler Lint Integrity ✅ Passed The Rust diff adds no dead_code/unused suppressions or artificial anchors; only a narrow clippy::missing_const_for_fn expect remains, and no suspicious clones appear.
📋 Issue Planner

Let us write the prompt for your AI agent so you can ship faster (with fewer bugs).

View plan for ticket: #127

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch issue-127-consume-stream-dispatch

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

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Sorry @leynos, you have reached your weekly rate limit of 2500000 diff characters.

Please try again later or upgrade to continue using Sourcery

codescene-delta-analysis[bot]

This comment was marked as outdated.

@lodyai
lodyai Bot force-pushed the issue-127-consume-stream-dispatch branch from d438c13 to 8a32149 Compare June 11, 2026 21:31
codescene-delta-analysis[bot]

This comment was marked as outdated.

@lodyai
lodyai Bot force-pushed the issue-127-consume-stream-dispatch branch from 8a32149 to e0405ba Compare June 11, 2026 22:22
codescene-delta-analysis[bot]

This comment was marked as outdated.

@lodyai
lodyai Bot force-pushed the issue-127-consume-stream-dispatch branch from e0405ba to 657187f Compare June 12, 2026 11:56
codescene-delta-analysis[bot]

This comment was marked as outdated.

@lodyai
lodyai Bot force-pushed the issue-127-consume-stream-dispatch branch from 657187f to 88f88f8 Compare June 14, 2026 17:28
codescene-delta-analysis[bot]

This comment was marked as outdated.

@leynos
leynos marked this pull request as ready for review June 15, 2026 07:20

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Sorry @leynos, you have reached your weekly rate limit of 500000 diff characters.

Please try again later or upgrade to continue using Sourcery

@pandalump

Copy link
Copy Markdown
Collaborator

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jun 15, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

chatgpt-codex-connector[bot]

This comment was marked as resolved.

@coderabbitai coderabbitai Bot added the Issue label Jun 15, 2026
coderabbitai[bot]

This comment was marked as resolved.

codescene-delta-analysis[bot]

This comment was marked as outdated.

codescene-delta-analysis[bot]

This comment was marked as outdated.

@leynos

leynos commented Jun 16, 2026

Copy link
Copy Markdown
Owner Author

@coderabbitai resume

@coderabbitai

coderabbitai Bot commented Jun 16, 2026

Copy link
Copy Markdown
✅ Action performed

Reviews resumed.

codescene-delta-analysis[bot]

This comment was marked as outdated.

coderabbitai[bot]

This comment was marked as resolved.

@lodyai
lodyai Bot force-pushed the issue-127-consume-stream-dispatch branch from 7fac2af to 8b84f66 Compare June 16, 2026 00:13
codescene-delta-analysis[bot]

This comment was marked as outdated.

codescene-delta-analysis[bot]

This comment was marked as outdated.

@lodyai
lodyai Bot force-pushed the issue-127-consume-stream-dispatch branch from 2814da7 to b076755 Compare June 16, 2026 00:17
codescene-delta-analysis[bot]

This comment was marked as outdated.

leynos and others added 13 commits June 24, 2026 00:28
Record the tee hot-path baseline findings in the rust consume-stream
component documentation. Keep the current branch's annotation intact:
`rust_consume_stream` is implemented and tested, but production dispatch
must still wait for the Phase 2 dispatcher, fallback path, and parity
property tests.

Clarify the design diagrams and backend-selection text so they no longer
imply that stdout or stderr consumption is routed through Rust today.
Clarify that the tee profiling baseline provides hotspot evidence for
Phase 2, not acceptance of the consume dispatcher. Keep the 20% median
wall-time gate tied to a future Rust-versus-Python dispatcher benchmark.
Use a NumPy-style `Notes` section for the `rust_consume_stream`
status note, keeping the helper documentation consistent with the rest of
its docstring.

Switch the not-integrated guard from raw text matching to AST symbol
reference detection so comments and docstrings do not create false
positives when checking production modules.
Split the consume-stream status guard so the docstring marker and the
production-reference scan are checked independently.

Add maintainer documentation for the current `rust_consume_stream` state:
it is implemented, tested, and exported, but production consume dispatch
remains deferred to ADR-002 Phase 2 until dispatcher wiring, Python
fallback, and parity/property coverage land.
Add roadmap phases 5-8 translating the tee hot-path profiling baseline and
the issue #90/#127 follow-up into outcome-oriented work:

- Phase 5 lands the Rust-free wins first (read-size plateau bump and lean
  per-line observe-hook emission) so the consume dispatcher must beat a tuned
  Python baseline.
- Phase 6 hardens the PyO3 boundary (#90), establishes the 20% wall-time
  acceptance gate, wires _consume_stream_dispatch, and records the outcome.
- Phase 7 scopes raw-sink echo/tee acceleration, profiling first to exclude
  kernel-bound PTY cost.
- Phase 8 collects deferred reliability work (Rust pump FD close race, perf
  frame attribution) and the native-orchestration go/no-go decisions.

Each phase carries a falsifiable GIST idea; tasks cite ADR-002, the design
doc, the profiling baseline, and the relevant issues.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Handle AST scan read and parse failures explicitly in the production
reference guard, and add coverage for invalid candidate modules.

Update the consume-stream documentation to use current `echo=True`
terminology and clarify that only pump-side routing has Rust backing today.
Replace the awkward consume-routing wording in ADR-002 and tighten the
design guide so it says final stream consumption still uses the Python
path until the Phase 2 consume dispatcher is wired and tested.
Avoid implying that a consume dispatcher is already wired for line-callback
streams. State that stream consumption stays on the Python pathway until the
Phase 2 consume dispatcher exists.
Use the specific module-reference scan error in the guard test and
tighten the consume-stream documentation wording.

Expand the consume-dispatch roadmap gate so it covers fallback
regressions, parity before routing, and outcome-specific documentation
dependencies.
Make the production-reference scan error a normal exception and report
scan failures from the guard test with an explicit assertion message.
Link the developer guide introduction to ADR-002 and ADR-004 so
maintainers can reach the governing stream and docstring decisions early.

State that production consume paths continue to use the pure-Python
`_consume_stream` implementation until Phase 2 is complete.
Preserve module scan causes in the `rust_consume_stream` guard and report
production references with package-relative paths so failures identify the
actual module.

Tighten the roadmap's performance criteria with objective benchmark and
profiler artefact requirements, and add the missing parity-proof dependency
before consume benchmarking.
@lodyai
lodyai Bot force-pushed the issue-127-consume-stream-dispatch branch from d104210 to 382d120 Compare June 23, 2026 22:29
@leynos

leynos commented Jun 25, 2026

Copy link
Copy Markdown
Owner Author

@coderabbitai Have the following now been resolved?

docs/roadmap.md (2)

318-327: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Add the parity-proof prerequisite to the benchmark task.
Line 318 now bakes parity into the success criteria, but the dependency list still stops at Phase 5 and 6.1.1.

Add 6.1.2 here, or the benchmark can start before the proptest gate that the success criteria depend on.

🤖 Detailed instructions

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

In @docs/roadmap.md around lines 318 - 327, The success criteria for task 6.2.1
references confirming Python/Rust parity before any Rust routing, but the
Requires section does not list 6.1.2 as a prerequisite dependency. Add 6.1.2
(the parity-proof task) to the dependency list so the benchmark cannot begin
until the parity verification work that the success criteria depend on has been
completed.

232-257: 📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
Tighten the Phase 5 success thresholds.
The success text still uses soft qualifiers (roughly, measurably), which leaves no clean finish line.

State explicit thresholds or benchmark artefacts for both tasks so completion is objectively testable.
Triage: [type:docstyle]

🤖 Detailed instructions

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

In @docs/roadmap.md around lines 232 - 257, Replace the soft qualifiers in the
success criteria for tasks 5.2.1 and 5.2.2 with explicit, objective thresholds.
In task 5.2.1, replace "measurably" in the success text and "roughly 20%" in the
wall time description with specific percentage targets or benchmark artifact
references. In task 5.2.2 (which is cut off in the diff but referenced), ensure
the success criteria also state explicit thresholds or benchmark artefacts
instead of vague qualifiers. Specify exactly what measurements or benchmark
artifacts will demonstrate completion rather than using relative terms.

@leynos

leynos commented Jun 25, 2026

Copy link
Copy Markdown
Owner Author

@coderabbitai Have the following now been resolved?

docs/developers-guide.md (2)

5-8: 🧹 Nitpick | 🔵 Trivial | ⚡ Quick win
Add ADR-002 and ADR-004 to the opening references.
The introduction only surfaces ADR-003 today, but this guide now depends on the deferred consume-side decision in ADR-002 and the docstring gate in ADR-004. Link both up front so maintainers can reach the governing decisions without scrolling.
Triage: [type:docstyle]

As per coding guidelines, link early to the design document, repository layout document, accepted decision records, and other normative references.

🤖 Detailed instructions

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

In @docs/developers-guide.md around lines 5 - 8, The introduction section
currently only references ADR-003 but the guide now depends on decisions in
ADR-002 and ADR-004. Add references to both ADR-002 and ADR-004 in the opening
paragraph alongside the existing ADR-003 reference, following the same markdown
link format used for ADR-003, so that maintainers can access all three governing
decision records without needing to scroll through the document.

Source: Coding guidelines
47-53: 🧹 Nitpick | 🔵 Trivial | ⚡ Quick win
State the current consume path explicitly.
Replace the looser “not yet routed through production consume paths” phrasing with the exact current behaviour: production consumes still go through the pure-Python _consume_stream until Phase 2 lands. That keeps the guide aligned with the module docstring and avoids ambiguity about partial routing.
Triage: [type:docstyle]

Based on learnings, keep pure Python first-class as the behavioural reference implementation.

🤖 Detailed instructions

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

In @docs/developers-guide.md around lines 47 - 53, In the section starting with
"rust_consume_stream is implemented, tested, and exported...", replace the
vague phrase "not yet routed through production consume paths" with an explicit
statement that production consumes currently go through the pure-Python
_consume_stream function until Phase 2 is complete. This aligns the developer
guide with the module docstring and clarifies the actual current behavior rather
than describing what is not happening.

Source: Learnings

@coderabbitai

coderabbitai Bot commented Jun 25, 2026

Copy link
Copy Markdown

Tip

For best results, initiate chat on the files or code changes.

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "=== docs/roadmap.md around Phase 5 tasks (220-270) ==="
sed -n '220,270p' docs/roadmap.md

echo
echo "=== docs/roadmap.md around Phase 6 benchmark task (310-335) ==="
sed -n '310,335p' docs/roadmap.md

echo
echo "=== Search for soft qualifiers and dependency marker ==="
rg -n 'measurably|roughly|6\.1\.2|Requires:' docs/roadmap.md

Length of output: 5379



@leynos Both are now resolved.

  1. Parity-proof prerequisite for 6.2.1 — resolved.
    The dependency list now includes 6.1.2 at Line 325:

    - Requires phase 5, 6.1.1, and 6.1.2.

    That closes the sequencing gap.

  2. Phase 5 success thresholds — resolved.
    The success criteria are now objective rather than vague:

    • 5.1.1: at least 20% lower median wall time, plus recorded benchmark artefact.
    • 5.2.1: dataclass-construction share reduced to no more than 10% in a committed profiler artefact.
    • 5.2.2: inspect.isawaitable contributes 0 sampled frames in the hot path.

    No measurably wording remains. The remaining roughly matches at Line 245 and Line 279 are explanatory background text, not success criteria, so they do not keep this finding open.

These comments can be marked resolved.

@coderabbitai

coderabbitai Bot commented Jun 25, 2026

Copy link
Copy Markdown

Tip

For best results, initiate chat on the files or code changes.

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "=== docs/developers-guide.md lines 1-20 ==="
sed -n '1,20p' docs/developers-guide.md

echo
echo "=== docs/developers-guide.md lines 43-58 ==="
sed -n '43,58p' docs/developers-guide.md

echo
echo "=== ADR references near top ==="
rg -n 'ADR-002|ADR-003|ADR-004' docs/developers-guide.md

echo
echo "=== consume-path wording ==="
rg -n '_consume_stream|not yet routed through production consume paths|production consume paths|pure-Python' docs/developers-guide.md

Length of output: 3421



@leynos Both items are resolved.

  1. Opening references: Resolved.
    Lines 5-11 now link all three governing ADRs up front:

    • Line 9: ADR-002: Additional Rust components
    • Line 10: ADR-003: Two-tier Python linting
    • Line 11: ADR-004: Interrogate docstring-coverage gate
  2. Current consume path wording: Resolved.
    Lines 50-51 now state the exact current behaviour:

    production consumes currently go through the pure-Python _consume_stream function until Phase 2 is complete.

Mark both comments resolved.

@leynos

leynos commented Jun 25, 2026

Copy link
Copy Markdown
Owner Author

@coderabbitai Have the following failed checks now been resolved?

If further work is required, please provide an AI agent prompt for the remaining work to be done to address these failures.

Do not treat warnings as optional or aspirational. Where a change is out of scope for this PR, propose a GitHub issue unless one exists already. (Treat documentation and validation coverage as in scope).

  • Ignore

❌ Failed checks (1 error, 1 warning)

Check name Status Explanation Resolution
Unit Architecture ❌ Error Guard test violates fallibility and diagnosticity principles: stores bare filenames (not relative paths) masking duplicate modules; discards chained exception causes hiding whether failures were pa... Fix line 399 to use path.relative_to(package_root) and lines 400–402 to preserve exc.__cause__ in scan_errors messages as specified in review comments.
Developer Documentation ⚠️ Warning Developer's guide and design documents substantially document the rust_consume_stream deferral, ADR-002 Phase 2 decision, and architectural changes; but three unaddressed review comments affect doc... Fix review comments: (1) use path.relative_to(package_root) for error diagnostics in line 399, (2) preserve exception cause details in scan_errors collection, (3) update ADR-004 reference to canonical title "Interrogate docstring-coverag...

@coderabbitai

coderabbitai Bot commented Jun 25, 2026

Copy link
Copy Markdown

Tip

For best results, initiate chat on the files or code changes.

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "=== docs/cuprum-design.md lines 1880-1910 ==="
sed -n '1880,1910p' docs/cuprum-design.md

echo
echo "=== echo_io occurrences in docs/cuprum-design.md ==="
rg -n 'echo_io' docs/cuprum-design.md || true

echo
echo "=== Relevant routing wording in docs/cuprum-design.md ==="
rg -n 'echo=True|RunOutputOptions\(echo=True\)|pump-side routing|_pump_stream_dispatch|final stdout/stderr consumption|pure-Python|_consume_stream' docs/cuprum-design.md

Length of output: 4353


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "=== docs/cuprum-design.md lines 1880-1910 ==="
sed -n '1880,1910p' docs/cuprum-design.md

echo
echo "=== echo_io occurrences in docs/cuprum-design.md ==="
rg -n 'echo_io' docs/cuprum-design.md || true

echo
echo "=== Relevant routing wording in docs/cuprum-design.md ==="
rg -n 'echo=True|RunOutputOptions\(echo=True\)|pump-side routing|_pump_stream_dispatch|final stdout/stderr consumption|pure-Python|_consume_stream' docs/cuprum-design.md

Length of output: 4353



@leynos Yes — both parts are resolved.

  1. Rename the tee flag: Resolved.
    No echo_io occurrences remain in docs/cuprum-design.md, and the teeing bullet now uses echo=True at Line 1888–Line 1890.

  2. Keep the note pump-only: Resolved.
    Line 1897–Line 1900 now states explicitly that only _pump_stream_dispatch has Rust backing for inter-stage transfer, while final stdout/stderr consumption still uses the Python _consume_stream path directly.

Mark this comment resolved.

@coderabbitai

coderabbitai Bot commented Jun 25, 2026

Copy link
Copy Markdown

Tip

For best results, initiate chat on the files or code changes.

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "=== Outline: cuprum/unittests/test_rust_streams.py ==="
ast-grep outline cuprum/unittests/test_rust_streams.py --view expanded | sed -n '1,220p'

echo
echo "=== Guard test section in cuprum/unittests/test_rust_streams.py ==="
python - <<'PY'
from pathlib import Path
path = Path("cuprum/unittests/test_rust_streams.py")
lines = path.read_text().splitlines()
for i, line in enumerate(lines, 1):
    if line.startswith("def test_rust_consume_stream_not_referenced_in_production"):
        start = max(1, i - 5)
        end = min(len(lines), i + 45)
        for j in range(start, end + 1):
            print(f"{j}: {lines[j-1]}")
        break
PY

echo
echo "=== Searches in cuprum/unittests/test_rust_streams.py ==="
rg -n -C2 'relative_to\(package_root\)|scan_errors|__cause__|referencing\.append|_ModuleReferenceScanError' cuprum/unittests/test_rust_streams.py

echo
echo "=== Outline: docs/developers-guide.md ==="
ast-grep outline docs/developers-guide.md --view expanded | sed -n '1,160p' || true

echo
echo "=== Top of docs/developers-guide.md ==="
sed -n '1,20p' docs/developers-guide.md

echo
echo "=== ADR title searches in docs/developers-guide.md and docs/adr-004* ==="
rg -n -C1 'ADR-002|ADR-003|ADR-004|Interrogate docstring' docs/developers-guide.md docs/adr-004* || true

Length of output: 9294



@leynos Mark both checks resolved.

  1. Unit Architecture — resolved.
    cuprum/unittests/test_rust_streams.py now matches the requested diagnostics behaviour:

    • Line 399 uses path.relative_to(package_root), so the guard stores package-relative paths rather than bare filenames.
    • Line 401 to Line 407 preserve chained-cause detail from exc.__cause__ in scan_errors, so the failure output now retains the underlying parse/read error context.
  2. Developer Documentation — resolved.
    docs/developers-guide.md now uses the canonical ADR-004 title at Line 11:

    ADR-004: Interrogate docstring-coverage gate

No further work is required for these two checks, so do not open a follow-up issue and do not generate an AI agent prompt.

@coderabbitai

coderabbitai Bot commented Jun 25, 2026

Copy link
Copy Markdown

Tip

For best results, initiate chat on the files or code changes.

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "=== Outline: cuprum/unittests/test_rust_streams.py ==="
ast-grep outline cuprum/unittests/test_rust_streams.py --view expanded | sed -n '1,220p'

echo
echo "=== Relevant block: cuprum/unittests/test_rust_streams.py ==="
python - <<'PY'
from pathlib import Path
path = Path("cuprum/unittests/test_rust_streams.py")
lines = path.read_text().splitlines()
for i, line in enumerate(lines, 1):
    if "def test_rust_consume_stream_not_referenced_in_production" in line:
        start = max(1, i - 5)
        end = min(len(lines), i + 45)
        for j in range(start, end + 1):
            print(f"{j}: {lines[j-1]}")
        break
PY

echo
echo "=== Search for relative_to / cause handling in cuprum/unittests/test_rust_streams.py ==="
rg -n -C2 'relative_to\(package_root\)|__cause__|scan_errors|referencing.append|str\(path\)|path.name' cuprum/unittests/test_rust_streams.py

echo
echo "=== Top of docs/developers-guide.md ==="
sed -n '1,20p' docs/developers-guide.md

echo
echo "=== ADR title search in docs/developers-guide.md ==="
rg -n 'ADR-002|ADR-003|ADR-004|Interrogate docstring-coverage gate|Interrogate docstring coverage gate' docs/developers-guide.md

Length of output: 7343



@leynos Yes — both remaining checks are now resolved.

  1. Unit Architecture — resolved.

    • Line 399 in cuprum/unittests/test_rust_streams.py now uses path.relative_to(package_root), so diagnostics no longer collapse to bare filenames.
    • Lines 401–407 now preserve chained-cause detail via exc.__cause__ and include it in scan_errors, so read/parse failures retain their underlying reason.
  2. Developer Documentation — resolved.

    • The documentation-side dependency on those same guard-test fixes is satisfied by the changes above.
    • Line 11 in docs/developers-guide.md now uses the canonical ADR-004 title: ADR-004: Interrogate docstring-coverage gate.

No further work is required for these two checks. Mark both resolved.

@coderabbitai

coderabbitai Bot commented Jun 25, 2026

Copy link
Copy Markdown

Tip

For best results, initiate chat on the files or code changes.

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "=== Outline: cuprum/unittests/test_rust_streams.py ==="
ast-grep outline cuprum/unittests/test_rust_streams.py --view expanded || true

echo
echo "=== Relevant symbols in cuprum/unittests/test_rust_streams.py ==="
rg -n -C3 '_ModuleReferenceScanError|test_rust_consume_stream_not_referenced_in_production|relative_to\(package_root\)|__cause__|scan_errors|referencing.append' cuprum/unittests/test_rust_streams.py

echo
echo "=== Slice: cuprum/unittests/test_rust_streams.py around guard test ==="
python3 - <<'PY'
from pathlib import Path
path = Path("cuprum/unittests/test_rust_streams.py")
lines = path.read_text().splitlines()
for i, line in enumerate(lines, 1):
    if line.startswith("def test_rust_consume_stream_not_referenced_in_production"):
        start = max(1, i - 5)
        end = min(len(lines), i + 45)
        for j in range(start, end + 1):
            print(f"{j}: {lines[j-1]}")
        break
PY

echo
echo "=== Top of docs/developers-guide.md ==="
sed -n '1,20p' docs/developers-guide.md

echo
echo "=== ADR title references in docs/developers-guide.md ==="
rg -n -C2 'ADR-002|ADR-003|ADR-004|docstring' docs/developers-guide.md

echo
echo "=== Canonical ADR-004 title from file headings ==="
fd -a 'adr-004*' docs | while read -r f; do
  echo "--- $f ---"
  sed -n '1,8p' "$f"
done

Length of output: 11739



@leynos Both remaining checks are now resolved.

  1. Unit Architecture — resolved.
    cuprum/unittests/test_rust_streams.py now has both requested fixes:

    • Line 399 stores path.relative_to(package_root) instead of a bare filename.
    • Line 400–Line 407 preserves chained exception detail from exc.__cause__ in scan_errors, so read/parse failures remain diagnosable.
  2. Developer Documentation — resolved.
    docs/developers-guide.md now uses the canonical ADR-004 title:

    • Line 11: ADR-004: Interrogate docstring-coverage gate

That matches the heading in docs/adr-004-interrogate-docstring-gate.md, so the documentation warning no longer has an open item.

No further work remains here. Mark both checks resolved.

@pandalump

Copy link
Copy Markdown
Collaborator

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jun 25, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

coderabbitai[bot]

This comment was marked as resolved.

@leynos
leynos merged commit 1716f08 into main Jun 25, 2026
18 checks passed
@leynos
leynos deleted the issue-127-consume-stream-dispatch branch June 25, 2026 22:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Rust extension: wire a _consume_stream_dispatch for rust_consume_stream or annotate its inert status

2 participants