Skip to content

Make _get_stage_stream_fds the canonical pipeline stdio policy (#112) - #134

Merged
leynos merged 13 commits into
mainfrom
issue-112-canonical-pipeline-stdio-policy
Jul 15, 2026
Merged

Make _get_stage_stream_fds the canonical pipeline stdio policy (#112)#134
leynos merged 13 commits into
mainfrom
issue-112-canonical-pipeline-stdio-policy

Conversation

@lodyai

@lodyai lodyai Bot commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

Summary

This branch makes _get_stage_stream_fds the canonical PIPE-versus-DEVNULL stdio policy for pipeline spawning and removes the inline duplication flagged by the refactoring audit.

Closes #112.

Previously the stdio policy lived twice: _spawn_pipeline_processes derived the stdin/stdout/stderr flags inline, while the purpose-built _get_stage_stream_fds helper was dead code reachable only through a self-referential re-export. The branch routes the spawn path through the helper, extracts a shared _cwd_arg conversion used by both the single-command and pipeline spawn sites, deletes the dead re-exports, adds exhaustive tests over the full finite input domain, and documents the canonical helpers in the developers' guide.

Note: the branch is stacked on #133 (baseline gate repairs); the first commit belongs to that PR and this branch should be rebased once #133 merges.

Review walkthrough

Validation

  • make check-fmt: pass
  • make lint: pass
  • make typecheck: pass
  • make test: pass (579 passed, 43 skipped; Rust suite 4 passed)
  • make markdownlint: pass

Notes

The wheel-build snapshot (test_maturin_build.ambr) is refreshed because it records the package file list, which now includes the new test module. The developers' guide diff includes mdformat reflow of neighbouring sections produced by make fmt.

Summary by Sourcery

Canonicalize pipeline stdio and cwd handling across subprocess spawn paths and align tooling invocation with uv-based workflows.

Enhancements:

  • Route pipeline process spawning through _get_stage_stream_fds and document it as the single source of truth for PIPE-versus-DEVNULL selection.
  • Introduce a shared _cwd_arg helper for consistent working-directory conversion used by both single-command and pipeline subprocess spawns.
  • Clarify and extend the developers’ guide with documented policies for pipeline stdio configuration and cwd conversion, including reuse guidance.
  • Remove redundant re-exports of pipeline stage stream helpers to reduce dead code and duplication.

Build:

  • Adjust Makefile to run ruff via uv run and classify it as a venv tool rather than a global tool dependency.

CI:

  • Stop installing ruff as a global uv tool in the CI workflow, relying instead on the updated local tooling configuration.

Tests:

  • Add exhaustive tests covering the full finite input domain for _get_stage_stream_fds and _cwd_arg, ensuring agreement with the single-command stdio policy and uniform cwd rendering.

References

@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 @LodyAI[bot], you have reached your weekly rate limit of 2500000 diff characters.

Please try again later or upgrade to continue using Sourcery

@coderabbitai

coderabbitai Bot commented Jun 10, 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

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 687ecce5-6d3a-48f5-967b-be7207269a19

📥 Commits

Reviewing files that changed from the base of the PR and between 0982a85 and fe3ba46.

📒 Files selected for processing (1)
  • docs/developers-guide.md
🔗 Linked repositories identified

CodeRabbit considers these linked repositories for cross-repo context during reviews:

  • leynos/shared-actions (auto-detected)
  • leynos/pylint-pypy-shim (auto-detected)
  • leynos/whitaker (auto-detected)

Summary

  • Made _get_stage_stream_fds the single canonical pipeline stage stdio (PIPE/DEVNULL) policy and routed _spawn_pipeline_processes through it.
  • Standardised subprocess cwd handling via shared _cwd_arg, reusing it across pipeline lifecycle and single-process subprocess spawning.
  • Removed dead/self-referential helper re-exports and expanded internal/module documentation plus developers’ guide guidance on the canonical stdio and cwd helpers.
  • Added exhaustive unit tests for all stage-position × capture/echo combinations (including agreement with the single-process policy) and _cwd_arg conversion edge cases.
  • Added end-to-end pipeline tests validating capture-enabled vs capture-disabled behaviour for intermediate and final stages.
  • Refreshed the maturin wheel-build snapshot, updated Makefile/CI Ruff invocation to use uv, and adjusted typo configuration; included a minor execplan doc header capitalisation tweak.

Walkthrough

Centralise pipeline stdio selection through _get_stage_stream_fds, share cwd conversion through _cwd_arg, wire both subprocess paths to these helpers, and add exhaustive unit, integration, packaging, and developer-guide coverage.

Changes

Canonical stdio policy and cwd refactor

Layer / File(s) Summary
Canonical helper contracts
cuprum/_pipeline_stage_streams.py, cuprum/_subprocess_context.py
Document the pipeline stream policy and add _cwd_arg for consistent subprocess working-directory conversion.
Spawn sites wired through shared helpers
cuprum/_process_lifecycle.py, cuprum/_subprocess_execution.py, cuprum/_pipeline_streams.py
Route pipeline and single-command spawning through the shared helpers and remove unused stream-policy imports.
Policy validation and maintainer guidance
cuprum/unittests/test_stage_stream_fds.py, cuprum/unittests/test_pipeline.py, cuprum/unittests/__snapshots__/test_maturin_build.ambr, docs/developers-guide.md, docs/execplans/4-1-1-performance-extension-foundation.md, typos.toml
Validate stage-policy combinations, end-to-end pipeline behaviour, cwd conversion, packaged tests, helper reuse rules, and supporting documentation and spelling updates.

Sequence Diagram(s)

sequenceDiagram
  participant Pipeline
  participant ProcessLifecycle
  participant StageStreams
  participant Subprocess
  Pipeline->>ProcessLifecycle: run pipeline stages
  ProcessLifecycle->>StageStreams: get stage stream descriptors
  StageStreams-->>ProcessLifecycle: return stdin/stdout/stderr policy
  ProcessLifecycle->>Subprocess: spawn each stage with policy and cwd
  Subprocess-->>Pipeline: return stage results and captured streams
Loading

Possibly related PRs

  • leynos/cuprum#152: Forwards RunOutputOptions into the execution path used by this PR’s stage stdio routing.

Suggested reviewers: leynos

Poem

Pipes align in orderly streams,
Paths shed their stringy dreams.
Stages pass their flags in flight,
Tests guard every left and right.
One shared rule now guides the way.


Caution

Pre-merge checks failed

Please resolve all errors before merging. Addressing warnings is optional.

  • Ignore

❌ Failed checks (1 error, 1 warning)

Check name Status Explanation Resolution
Testing (Overall) ❌ Error New helper tests are good, but pipeline coverage never exercises capture=False, echo=True; a capture-only bug in _spawn_pipeline_processes would still pass. Add an end-to-end pipeline test for RunOutputOptions(capture=False, echo=True) and assert stdout is piped, echoed, and preserved in the final stage.
Out of Scope Changes check ⚠️ Warning It adds unrelated changes such as typos.toml spelling entries and a docs/execplans capitalisation tweak beyond #112. Remove the unrelated typos.toml and docs/execplans edits, or split them into a separate PR.
✅ Passed checks (18 passed)
Check name Status Explanation
Title check ✅ Passed The title matches the main refactor and includes the linked issue reference (#112).
Description check ✅ Passed The description clearly discusses the pipeline stdio refactor and related helper changes.
Linked Issues check ✅ Passed The PR implements the #112 requirements: canonical helper routing, shared cwd conversion, dead re-export removal, tests, and docs.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
User-Facing Documentation ✅ Passed PASS: The diff is internal refactoring; the users’ guide already covers pipeline capture and cwd, and no new user-facing behaviour needs signposting.
Developer Documentation ✅ Passed docs/developers-guide.md now documents _get_stage_stream_fds and _cwd_arg as the canonical spawn helpers; no roadmap or locale sync is required here.
Module-Level Documentation ✅ Passed Accept the change: every touched Python module has a module docstring, and the new ones explain purpose, utility, and relationships to the pipeline helpers.
Testing (Unit And Behavioural) ✅ Passed Tests cover the full helper domain and an end-to-end Pipeline.run_sync workflow, not just mocks or internals.
Testing (Property / Proof) ✅ Passed PASS: the PR covers the finite invariant with exhaustive parametrised tests (stage positions × capture/echo) and _cwd_arg cases; no proof obligation remains.
Testing (Compile-Time / Ui) ✅ Passed No Rust/TS compile-time surface was added; the wheel-build snapshot is focused, redacted, and backed by a dedicated snapshot test.
Unit Architecture ✅ Passed PASS: _get_stage_stream_fds and _cwd_arg are pure helpers; subprocess spawning stays the explicit command boundary, and the new tests exercise the real pipeline boundary.
Domain Architecture ✅ Passed PASS: The diff stays in internal subprocess/pipeline helpers and tests; no domain model, repository, or command logic is coupled to HTTP, SQL, or other infrastructure concerns.
Observability ✅ Passed PASS: Treat it as a refactor; no new runtime behaviour is introduced, and existing subprocess start/exit/stdin-error observations already cover failures.
Security And Privacy ✅ Passed Only a comma change in docs/developers-guide.md; no secrets, auth logic, permissions, or sensitive data exposure were added.
Performance And Resource Use ✅ Passed PASS: New iteration is finite (12 helper cases, 2 end-to-end runs); runtime spawn paths stay O(stages) with no unbounded I/O or background work.
Concurrency And State ✅ Passed PASS: The PR only adds pure stdio/cwd helpers and tests; it introduces no new shared mutable state, and existing pipeline task ownership/cancellation remains explicit and unchanged.
Architectural Complexity And Maintainability ✅ Passed The PR removes duplicated spawn policy, reuses _cwd_arg across both call sites, documents the contract, and adds exhaustive tests; no extra indirection or new dependency layer.
Rust Compiler Lint Integrity ✅ Passed PR changes only Python/docs/typos.toml; no Rust sources were modified, so no lint suppressions or clone regressions were introduced.
📋 Issue Planner

Built with CodeRabbit's Coding Plans for faster development and fewer bugs.

View plan used: #112

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch issue-112-canonical-pipeline-stdio-policy

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

codescene-delta-analysis[bot]

This comment was marked as outdated.

@leynos

leynos commented Jun 11, 2026

Copy link
Copy Markdown
Owner

@coderabbitai Please suggest a fix for this issue and supply a prompt for an AI coding agent to enable it to apply the fix. Include the file and symbol names indicated in the issue at the head of your response.

cuprum/unittests/test_tee_profile_worker_concurrency.py

Comment on file

    """Structural type for the ``RLock`` operations this test instruments."""

    def acquire(self, *, blocking: bool = True, timeout: float = -1) -> bool: ...
    def acquire(self, *, blocking: bool = True, timeout: float = -1) -> bool:

❌ New issue: Low Cohesion
This module has at least 7 different responsibilities amongst its 35 functions, threshold = 4

@coderabbitai

This comment was marked as resolved.

@lodyai
lodyai Bot force-pushed the issue-112-canonical-pipeline-stdio-policy branch from 87657ee to 9c490ea Compare June 11, 2026 10:59
codescene-delta-analysis[bot]

This comment was marked as outdated.

@lodyai
lodyai Bot force-pushed the issue-112-canonical-pipeline-stdio-policy branch from 9c490ea to 9f38b2e Compare June 11, 2026 13:07
codescene-delta-analysis[bot]

This comment was marked as outdated.

@lodyai
lodyai Bot force-pushed the issue-112-canonical-pipeline-stdio-policy branch from 9f38b2e to 2749fc3 Compare June 11, 2026 21:31
codescene-delta-analysis[bot]

This comment was marked as outdated.

@lodyai
lodyai Bot force-pushed the issue-112-canonical-pipeline-stdio-policy branch from 2749fc3 to 6a7f716 Compare June 11, 2026 22:22
codescene-delta-analysis[bot]

This comment was marked as outdated.

@leynos
leynos marked this pull request as ready for review June 12, 2026 11:02
@sourcery-ai

sourcery-ai Bot commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

Reviewer's Guide

Routes pipeline spawning through a canonical helper for stdio and cwd handling, removes duplicated policy and dead re-exports, and adds exhaustive tests and documentation around the new canonical helpers while slightly adjusting tooling integration.

Sequence diagram for canonical pipeline and single-command spawn helpers

sequenceDiagram
    participant PipelineLifecycle as _spawn_pipeline_processes
    participant SubprocessExecution as _spawn_subprocess
    participant StageStreams as _get_stage_stream_fds
    participant SubprocessContext as _cwd_arg
    participant Asyncio as asyncio.create_subprocess_exec

    rect rgb(235, 245, 255)
        loop for each pipeline stage
            PipelineLifecycle->>StageStreams: _get_stage_stream_fds(idx, last_idx, capture_or_echo)
            StageStreams-->>PipelineLifecycle: _StageStreamConfig

            PipelineLifecycle->>SubprocessContext: _cwd_arg(config.ctx.cwd)
            SubprocessContext-->>PipelineLifecycle: cwd_arg

            PipelineLifecycle->>Asyncio: create_subprocess_exec(..., stdin=stream_fds.stdin,
            PipelineLifecycle-->>Asyncio: stdout=stream_fds.stdout, stderr=stream_fds.stderr, cwd=cwd_arg)
        end
    end

    rect rgb(245, 245, 245)
        SubprocessExecution->>SubprocessContext: _cwd_arg(execution.ctx.cwd)
        SubprocessContext-->>SubprocessExecution: cwd_arg

        SubprocessExecution->>Asyncio: create_subprocess_exec(..., cwd=cwd_arg)
    end
Loading

File-Level Changes

Change Details Files
Make _get_stage_stream_fds the single source of truth for pipeline stdio selection and document its contract.
  • Expanded _get_stage_stream_fds docstring to spell out stdin/stdout/stderr policy and added example usage.
  • Kept implementation logic but clarified that _spawn_pipeline_processes must delegate to this helper.
cuprum/_pipeline_stage_streams.py
docs/developers-guide.md
Route pipeline process spawning through the canonical stdio helper and shared cwd conversion.
  • Replaced inline stdin/stdout/stderr flag computation in _spawn_pipeline_processes with a call to _get_stage_stream_fds.
  • Replaced inline cwd stringification in _spawn_pipeline_processes with the new _cwd_arg helper.
  • Hooked _process_lifecycle.py up to new imports from _pipeline_stage_streams and _subprocess_context.
cuprum/_process_lifecycle.py
Introduce a canonical cwd conversion helper shared by single-command and pipeline spawn paths.
  • Added _cwd_arg(cwd) in _subprocess_context.py to normalize optional str
Path
Remove dead re-exports around pipeline stage streams to reduce indirection.
  • Deleted unused re-exports of _get_stage_stream_fds and _StageStreamConfig from _pipeline_streams.py so callers import directly from _pipeline_stage_streams.
cuprum/_pipeline_streams.py
Add exhaustive tests for the pipeline stdio policy and cwd conversion.
  • Introduced cuprum/unittests/test_stage_stream_fds.py to cover the full finite input domain of _get_stage_stream_fds and _cwd_arg.
  • Verified that final-stage pipeline behavior matches single-process stdio policy for overlapping cases.
  • Updated maturin build snapshot to include the new test module.
cuprum/unittests/test_stage_stream_fds.py
cuprum/unittests/__snapshots__/test_maturin_build.ambr
Adjust tooling/CI configuration so ruff runs through uv and only inside the venv.
  • Move ruff from global TOOLS list into VENV_TOOLS and update fmt/check-fmt/lint targets to invoke ruff via uv run.
  • Stop installing ruff as a uv tool in CI workflow; rely on venv instead.
Makefile
.github/workflows/ci.yml

Assessment against linked issues

Issue Objective Addressed Explanation
#112 Make _get_stage_stream_fds the canonical PIPE-vs-DEVNULL stdio policy for pipeline spawning by routing _spawn_pipeline_processes through it and removing the dead self-referential re-export.
#112 Introduce a shared `_cwd_arg(cwd) -> str None helper and use it in both the single-process (_spawn_subprocess) and pipeline (_spawn_pipeline_processes`) spawn paths so cwd conversion cannot drift.
#112 Document the canonical stdio-policy helper and its reuse policy in the developers’ guide and add exhaustive tests over the finite input domain (stage position × capture/echo), including agreement with the single-process policy.

Possibly linked issues


Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

sourcery-ai[bot]

This comment was marked as resolved.

@lodyai
lodyai Bot force-pushed the issue-112-canonical-pipeline-stdio-policy branch from 6a7f716 to 8029b56 Compare June 12, 2026 11:57
codescene-delta-analysis[bot]

This comment was marked as outdated.

codescene-delta-analysis[bot]

This comment was marked as outdated.

@leynos

leynos commented Jun 14, 2026

Copy link
Copy Markdown
Owner

@coderabbitai resume

@coderabbitai

coderabbitai Bot commented Jun 14, 2026

Copy link
Copy Markdown
✅ Action performed

Reviews resumed.

codescene-delta-analysis[bot]

This comment was marked as outdated.

@leynos

leynos commented Jun 14, 2026

Copy link
Copy Markdown
Owner

@coderabbitai Has this now been resolved in the latest commit?

Use codegraph analysis to determine your answer.

If this comment is now resolved, please mark it as such using the API. Otherwise, please provide an AI agent prompt for the remaining work to be done to address this comment.

## Overall Comments
- In `_subprocess_context._cwd_arg` the `Path` type is only imported under `TYPE_CHECKING`, but used in a runtime type annotation, which will raise a `NameError` without `from __future__ import annotations`; consider importing `Path` unconditionally or using a stringified annotation to avoid this.
- The `test_intermediate_stage_always_pipes_stdout` test currently calls `_get_stage_stream_fds(0, 1, ...)`, which is the first stage in a two-stage pipeline rather than an intermediate stage; adjust the indices (e.g., `idx=1, last_idx=2`) so the test truly covers the documented intermediate-stage behavior.

## Individual Comments

### Comment 1
<location path="cuprum/unittests/test_stage_stream_fds.py" line_range="99-102" />
<code_context>
+    assert fds.stderr == single_process_flag
+
+
+def test_intermediate_stage_always_pipes_stdout() -> None:
+    """Example: intermediate stages pipe stdout regardless of capture/echo."""
+    for capture_or_echo in (False, True):
+        fds = _get_stage_stream_fds(0, 1, capture_or_echo=capture_or_echo)
+        assert fds.stdout == _PIPE
+
</code_context>
<issue_to_address>
**issue (testing):** This test claims to cover intermediate stages, but currently exercises the first stage of a two-stage pipeline instead.

For a two-stage pipeline `(idx=0, last_idx=1)` there is no intermediate stage; `idx=0` is still the first stage. To truly cover an intermediate position, use a three-stage pipeline and target the middle stage, e.g.:

```python
def test_intermediate_stage_always_pipes_stdout() -> None:
    for capture_or_echo in (False, True):
        # three-stage pipeline: 0 (first), 1 (intermediate), 2 (last)
        fds = _get_stage_stream_fds(1, 2, capture_or_echo=capture_or_echo)
        assert fds.stdout == _PIPE
```

Right now the test asserts a valid property for the first stage, but the name/docstring don’t match what it actually covers.
</issue_to_address>

@coderabbitai

coderabbitai Bot commented Jun 14, 2026

Copy link
Copy Markdown

Tip

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

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
echo "=== cuprum/_subprocess_context.py ==="
cat cuprum/_subprocess_context.py

echo ""
echo "=== cuprum/unittests/test_stage_stream_fds.py ==="
cat cuprum/unittests/test_stage_stream_fds.py

Length of output: 5863


🏁 Script executed:

#!/bin/bash
# Find and resolve the review comment about test_intermediate_stage_always_pipes_stdout
gh api \
  -H "Accept: application/vnd.github+json" \
  /repos/leynos/cuprum/pulls/134/comments \
  --paginate \
  --jq '.[] | select(.user.login == "coderabbitai[bot]") | {id: .id, body: .body[0:120]}'

Length of output: 545


🏁 Script executed:

#!/bin/bash
# List all PR review comments without login filter
gh api \
  -H "Accept: application/vnd.github+json" \
  /repos/leynos/cuprum/pulls/134/comments \
  --paginate \
  --jq '.[] | {id: .id, user: .user.login, body: .body[0:150]}'

Length of output: 490



Both issues are confirmed resolved in the latest commit. However, the review comment (ID 3402845314) was filed by sourcery-ai[bot], not by CodeRabbit — so I am unable to resolve it via the API on your behalf.

Summary of resolution:

Issue Status
_cwd_arg: Path under TYPE_CHECKING with runtime annotation ✅ Resolved — from __future__ import annotations is present, making all annotations lazy strings at runtime
test_intermediate_stage_always_pipes_stdout uses (0, 1, ...) ✅ Resolved — now uses (1, 2, ...) with an explicit comment confirming the three-stage intermediate position

Dismiss the Sourcery comment manually in the GitHub UI, or ask a maintainer to do so.

@leynos

leynos commented Jun 14, 2026

Copy link
Copy Markdown
Owner

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jun 14, 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.

@pandalump

Copy link
Copy Markdown
Collaborator

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jun 14, 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.

leynos and others added 6 commits July 15, 2026 00:50
The `test_intermediate_stage_always_pipes_stdout` example exercised
`_get_stage_stream_fds(0, 1, ...)`, which is the *first* stage of a
two-stage pipeline, not an intermediate one. Target the middle stage of a
three-stage pipeline (`idx=1, last_idx=2`) so the test covers the
documented intermediate-stage behaviour its name claims.

`_cwd_arg`'s docstring example called `Path(...)` at runtime while `Path`
is a `TYPE_CHECKING`-only import (the `from __future__ import annotations`
present in the module already prevents the annotation `NameError` the
reviewer noted). Keeping `Path` type-only satisfies the `TC` ruff rule, so
rework the doctest to use a string argument and note that `Path` inputs are
covered exhaustively by `test_cwd_arg_conversion`.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
`_cwd_arg` renders its argument with `str`, so a `Path` expectation must be
`str(Path(...))` rather than a hard-coded POSIX string: on Windows
`str(Path("/srv/data"))` is `\srv\data`, which the literal `"/srv/data"`
would never match. The plain-string rows pass through unchanged and stay
correct as-is.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
"Context helpers for subprocess execution" did not convey that the module
hosts the canonical `_cwd_arg` working-directory conversion shared by the
single-command and pipeline spawn paths. Describe each utility the module
provides — `_cwd_arg`, `_resolve_timeout`, and the lazy-import shims — so the
canonical helper's role is discoverable from the module summary.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Expand the module-level documentation around pipeline stdio ownership
and replace the mock-based delegation test with an end-to-end
pipeline execution test that exercises capture and discard modes.
@lodyai
lodyai Bot force-pushed the issue-112-canonical-pipeline-stdio-policy branch from d5ab9b1 to d7f0737 Compare July 14, 2026 22:51
codescene-access[bot]

This comment was marked as outdated.

coderabbitai[bot]

This comment was marked as resolved.

Exercise the supported `RunOutputOptions` API in the pipeline
stdio integration test and clarify the distinct re-use scopes of
`_cwd_arg` and `_get_stage_stream_fds`.
codescene-access[bot]

This comment was marked as outdated.

leynos added 2 commits July 15, 2026 14:50
Include the canonical Oxford-spelling mappings emitted by the
repository generator.
codescene-access[bot]

This comment was marked as outdated.

codescene-access[bot]

This comment was marked as outdated.

Make failures in pipeline stdio and stage-stream policy tests identify
the active inputs and checked stage attribute.
codescene-access[bot]

This comment was marked as outdated.

@pandalump

Copy link
Copy Markdown
Collaborator

@coderabbitai resume

@coderabbitai

coderabbitai Bot commented Jul 15, 2026

Copy link
Copy Markdown
✅ Action performed

Reviews resumed.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@docs/developers-guide.md`:
- Line 23: Update docs/developers-guide.md at lines 23-23 and 1077-1077 by
inserting the missing commas before “so”: change “They exist so” to “They exist,
so” and “must use it so” to “must use it, so”.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: f396094c-2f91-4553-84dc-7b157499e7b6

📥 Commits

Reviewing files that changed from the base of the PR and between 099a105 and 0982a85.

📒 Files selected for processing (11)
  • cuprum/_pipeline_stage_streams.py
  • cuprum/_pipeline_streams.py
  • cuprum/_process_lifecycle.py
  • cuprum/_subprocess_context.py
  • cuprum/_subprocess_execution.py
  • cuprum/unittests/__snapshots__/test_maturin_build.ambr
  • cuprum/unittests/test_pipeline.py
  • cuprum/unittests/test_stage_stream_fds.py
  • docs/developers-guide.md
  • docs/execplans/4-1-1-performance-extension-foundation.md
  • typos.toml
🔗 Linked repositories identified

CodeRabbit considers these linked repositories for cross-repo context during reviews:

  • leynos/shared-actions (auto-detected)
  • leynos/pylint-pypy-shim (auto-detected)
  • leynos/whitaker (auto-detected)

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Caution

Inline review comments failed to post. This is likely due to GitHub's internal server error or limits when posting large numbers of comments. If you are seeing this consistently it is likely a permissions issue. Please check "Moderation" -> "Code review limits" under your organization settings.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@docs/developers-guide.md`:
- Line 23: Update docs/developers-guide.md at lines 23-23 and 1077-1077 by
inserting the missing commas before “so”: change “They exist so” to “They exist,
so” and “must use it so” to “must use it, so”.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: f396094c-2f91-4553-84dc-7b157499e7b6

📥 Commits

Reviewing files that changed from the base of the PR and between 099a105 and 0982a85.

📒 Files selected for processing (11)
  • cuprum/_pipeline_stage_streams.py
  • cuprum/_pipeline_streams.py
  • cuprum/_process_lifecycle.py
  • cuprum/_subprocess_context.py
  • cuprum/_subprocess_execution.py
  • cuprum/unittests/__snapshots__/test_maturin_build.ambr
  • cuprum/unittests/test_pipeline.py
  • cuprum/unittests/test_stage_stream_fds.py
  • docs/developers-guide.md
  • docs/execplans/4-1-1-performance-extension-foundation.md
  • typos.toml
🔗 Linked repositories identified

CodeRabbit considers these linked repositories for cross-repo context during reviews:

  • leynos/shared-actions (auto-detected)
  • leynos/pylint-pypy-shim (auto-detected)
  • leynos/whitaker (auto-detected)
🛑 Comments failed to post (1)
docs/developers-guide.md (1)

23-23: 📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Insert the missing commas before “so”.

  • docs/developers-guide.md#L23-L23: Change They exist so to They exist, so.
  • docs/developers-guide.md#L1077-L1077: Change must use it so to must use it, so.

Triage: [type:grammar]

As per path instructions, comments and documentation must follow en-GB-oxendict spelling and grammar.

🧰 Tools
🪛 LanguageTool

[uncategorized] ~23-~23: Use a comma before ‘so’ if it connects two independent clauses (unless they are closely connected and short).
Context: ...dently of sh.make wrapping. They exist so the command construction contract can b...

(COMMA_COMPOUND_SENTENCE_2)

📍 Affects 1 file
  • docs/developers-guide.md#L23-L23 (this comment)
  • docs/developers-guide.md#L1077-L1077
🤖 Prompt for AI Agents
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` at line 23, Update docs/developers-guide.md at
lines 23-23 and 1077-1077 by inserting the missing commas before “so”: change
“They exist so” to “They exist, so” and “must use it so” to “must use it, so”.

Sources: Path instructions, Linters/SAST tools

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Refactor: canonical pipeline stdio policy via _get_stage_stream_fds (remove dead helper + inline duplication)

2 participants