Skip to content

Decouple runner process execution from Cli (#339) - #371

Merged
leynos merged 12 commits into
mainfrom
issue-339-decouple-process-from-cli
Aug 22, 2026
Merged

Decouple runner process execution from Cli (#339)#371
leynos merged 12 commits into
mainfrom
issue-339-decouple-process-from-cli

Conversation

@leynos

@leynos leynos commented Jun 12, 2026

Copy link
Copy Markdown
Owner

Summary

Closes #339

The subprocess adapter in src/runner/process/mod.rs accepted &Cli in
configure_ninja_base, both request structs, and the public entry points,
coupling the process layer to the parser/config domain type.

Changes

  • src/runner/process/mod.rs: new NinjaProcessOptions (working directory,
    job count, stderr suppression) — the narrow execution type the issue
    proposes. configure_ninja_*, NinjaBuildRequest, and NinjaToolRequest
    consume it; the module no longer imports Cli.

  • src/runner/mod.rs: ninja_process_options(&Cli) performs the CLI-to-process
    translation at the orchestration boundary; run_ninja/run_ninja_tool keep
    their public &Cli signatures as thin wrappers, so existing behaviour,
    callers, and tests are unchanged.

Replacing the boolean stderr flag with an explicit policy type is
#340, designed together with
this change and stacked on it.

Validation

  • make check-fmt / make lint / make test — pass (37 suites; runner
    behaviour covered by existing tests, unchanged)

🤖 Generated with Claude Code

Summary by Sourcery

Decouple Ninja process execution from CLI configuration by introducing parser-independent process options while retaining existing public wrappers and behavior.

New Features:

  • Introduce NinjaProcessOptions and validated NinjaJobCount for configuring Ninja process execution independently of CLI parsing state.

Enhancements:

  • Decouple Ninja process request and configuration APIs from Cli while preserving the existing CLI-facing convenience wrappers.
  • Centralize CLI-to-process option translation at the runner boundary, including validation of working-directory encoding and job-count limits.
  • Preserve and strengthen command execution status and operation-label diagnostics across build and tool invocations.

Documentation:

  • Update developer, design, user, and migration documentation to describe parser-independent Ninja process requests and the new options API.

Tests:

  • Add coverage for option translation, job-count validation, working-directory execution, command configuration, operation labels, exit diagnostics, and explicit stderr routing.

Enhancements:

  • Introduce a NinjaProcessOptions struct encapsulating working directory, job
    count, and stderr suppression for invoking Ninja processes.

  • Refactor process-layer Ninja build and tool invocation functions to depend on
    NinjaProcessOptions instead of the Cli type, removing the parser/config
    dependency from the subprocess module.

  • Add runner-level helpers that translate Cli into NinjaProcessOptions and
    delegate to the process-layer Ninja execution functions, preserving existing
    public CLI-facing APIs.

  • Adjust status-reporting build and tool paths to construct and reuse
    NinjaProcessOptions when invoking process-layer functions.

References

@coderabbitai

coderabbitai Bot commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

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

Summary

  • Decouple the Ninja process layer from Cli.
  • Add NinjaProcessOptions and validated NinjaJobCount.
  • Translate CLI settings at the runner::ninja_process_adapter boundary.
  • Preserve the existing run_ninja and run_ninja_tool APIs and command ordering.
  • Share command execution and exit-status handling between builds and tools.
  • Report non-UTF-8 working directories as InvalidData.
  • Add tests for execution context, operation labels, logging, stderr routing, and exit-status diagnostics.
  • Update user, developer, migration, and design documentation.
  • Address CodeScene findings without adding unnecessary abstractions.

Validation

  • Keep the process layer free of direct Cli dependencies.
  • Pass formatting, lint, and test validation.

Walkthrough

Separate CLI translation from Ninja process execution. Add NinjaProcessOptions and NinjaJobCount. Route build and tool requests through shared execution. Update tests and documentation.

Changes

Ninja process decoupling

Layer / File(s) Summary
Process options and CLI adapter
src/runner/process/request.rs, src/runner/process/job_count.rs, src/runner/ninja_process_adapter.rs, src/runner/mod.rs
Use validated NinjaProcessOptions for process requests. Translate CLI values at the runner boundary. Reject non-UTF-8 working directories with InvalidData.
Shared Ninja execution path
src/runner/process/*
Configure build and tool commands from process options. Validate command ordering, operation labels, stderr handling, working directories, and exit-status diagnostics.
Integration and contract documentation
tests/*, docs/*
Update request construction, environment tests, compile fixtures, BDD steps, guides, and process-boundary documentation.

Possibly related PRs

  • leynos/netsuke#497: Both PRs modify Ninja process request and environment APIs.
  • leynos/netsuke#553: Both PRs modify Ninja request and wrapper APIs with explicit StderrMode handling.

Suggested labels: Issue

Suggested reviewers: codescene-access

Poem

Translate CLI values at the gate,
Pass process options through the route.
Share build and tool execution,
Check status and log each action.
Keep environment handling separate.


Important

Pre-merge checks failed

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

❌ Failed checks (2 warnings, 5 inconclusive)

Check name Status Explanation Resolution
Developer Documentation ⚠️ Warning NinjaBuildRequest and NinjaToolRequest now use NinjaProcessOptions, but docs/developers-guide.md lines 35–37 still say they borrow CLI settings. Update the developer guide overview to describe NinjaProcessOptions, its working directory and job-count fields, and the parser-independent request boundary.
Testing (Property / Proof) ⚠️ Warning The PR introduces the 1..=64 NinjaJobCount invariant, but adds only boundary examples; no property test or bounded proof covers the full input range. Add a proptest for arbitrary usize values that asserts acceptance exactly for 1..=64, preserves the value, and returns InvalidInput otherwise.
User-Facing Documentation ❓ Inconclusive Investigation has not started; no verdict is submitted yet. Inspect the pull request diff and user-facing documentation before deciding.
Testing (Unit And Behavioural) ❓ Inconclusive Investigation has not started; no verdict evidence is available. Inspect the pull-request diff and the added unit, behavioural, and integration tests.
Unit Architecture ❓ Inconclusive Placeholder only; evidence gathering is still in progress. Review the actual changed code and tests.
Domain Architecture ❓ Inconclusive Investigation continues; no verdict yet. Gather implementation and diff evidence before deciding.
Concurrency And State ❓ Inconclusive Investigation in progress; no verdict submitted yet. Inspect the pull-request diff and process execution paths before deciding.
✅ Passed checks (13 passed)
Check name Status Explanation
Linked Issues check ✅ Passed The changes satisfy issue #339 by removing Cli from the process layer, adding process options, translating at the runner boundary, and preserving behaviour.
Out of Scope Changes check ✅ Passed The changes remain within the linked issue scope, including option validation, stderr policy, diagnostics, tests, and related documentation.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Testing (Overall) ✅ Passed Accept: tests cover CLI translation errors and valid jobs, command ordering, working-directory execution, both request paths, stream routing, and exit diagnostics with meaningful assertions.
Module-Level Documentation ✅ Passed Keep the check passing: every changed Rust module has a //! block stating its purpose, function, and component relationship where needed, including the new adapter and process modules.
Testing (Compile-Time / Ui) ✅ Passed Accept this check: the PR updates the direct-rustc UI harness fixture for NinjaProcessOptions, and focused tracing assertions cover structured output without requiring brittle snapshots.
Observability ✅ Passed No changes are visible in the working tree; the observability check has no evidenced changed behaviour to assess.
Security And Privacy ✅ Passed I am still investigating the pull-request changes and have not reached a final assessment.
Performance And Resource Use ✅ Passed Pass this check: the diff adds only bounded option validation and one per-invocation path conversion; Ninja execution, streaming, and I/O behaviour remain unchanged.
Architectural Complexity And Maintainability ✅ Passed Keep the design: the adapter isolates CLI translation, NinjaProcessOptions enforces process inputs, and the existing internal helper removes build/tool duplication without new dependencies or cycles.
Rust Compiler Lint Integrity ✅ Passed The available PR diff only reorders imports and module declarations; it adds no broad lint suppression, artificial usage, or clone, and leaves the existing narrow #[expect] unchanged.
Title check ✅ Passed The title accurately describes decoupling runner process execution from Cli and references the linked issue (#339).
Description check ✅ Passed The description directly explains the Cli decoupling, new process options, preserved wrappers, validation, and related documentation and tests.
✨ 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-339-decouple-process-from-cli

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

@sourcery-ai

sourcery-ai Bot commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

Reviewer's Guide

Decouples the runner subprocess layer from the Cli type by introducing a narrow NinjaProcessOptions struct and performing Cli-to-process translation at the runner orchestration boundary, keeping public runner APIs unchanged while updating internal request/command configuration plumbing.

Sequence diagram for run_ninja decoupled call flow

sequenceDiagram
    participant Caller
    participant runner as runner
    participant process as process
    participant cmd as Command

    Caller->>runner: run_ninja(program, cli, build_file, targets)
    runner->>runner: ninja_process_options(cli)
    runner->>process: run_ninja(program, options, build_file, targets)
    process->>cmd: configure_ninja_build_command(cmd, options, build_file, targets)
    process->>process: run_command_and_stream(cmd, status_observer, options.suppress_stderr)
    process-->>runner: io::Result
    runner-->>Caller: io::Result
Loading

File-Level Changes

Change Details Files
Introduce NinjaProcessOptions as the narrow configuration interface for the subprocess layer and remove direct Cli usage from process::run_ninja / run_ninja_tool and related helpers.
  • Add NinjaProcessOptions struct carrying working_dir, jobs, and suppress_stderr flags for ninja invocation.
  • Update configure_ninja_base / configure_ninja_build_command / configure_ninja_tool_command to consume NinjaProcessOptions instead of Cli.
  • Change NinjaBuildRequest and NinjaToolRequest to hold &NinjaProcessOptions and rewrite run_ninja / run_ninja_tool signatures and internal helpers to use options.suppress_stderr instead of cli.resolved_diag_json().
src/runner/process/mod.rs
Perform Cli-to-NinjaProcessOptions translation at the runner orchestration layer and keep existing public runner APIs stable while adapting status-reporting paths.
  • Add ninja_process_options(&Cli) helper that maps Cli.directory, Cli.jobs, and Cli.resolved_diag_json() into NinjaProcessOptions.
  • Introduce new public run_ninja and run_ninja_tool wrappers in runner::mod that accept &Cli, construct NinjaProcessOptions, and delegate to process::run_ninja / run_ninja_tool.
  • Update handle_build and handle_ninja_tool progress-enabled branches to construct NinjaProcessOptions once and pass references via NinjaBuildRequest / NinjaToolRequest instead of &Cli.
src/runner/mod.rs

Assessment against linked issues

Issue Objective Addressed Explanation
#339 src/runner/process/* no longer accepts or depends on &Cli; instead it uses a narrow execution/options type containing only the needed fields.
#339 Perform CLI-to-process translation at the runner orchestration boundary (e.g., in src/runner/mod.rs), mapping Cli into the narrow process options type.
#339 Preserve existing runner behaviour (including stderr suppression semantics) and keep tests/CI passing.

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

@codescene-delta-analysis codescene-delta-analysis 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.

Gates Failed
Enforce advisory code health rules (1 file with Code Duplication)

Our agent can fix these. Install it.

Gates Passed
5 Quality Gates Passed

Reason for failure
Enforce advisory code health rules Violations Code Health Impact
mod.rs 1 advisory rule 9.39 → 9.10 Suppress

See analysis details in CodeScene

Quality Gate Profile: Pay Down Tech Debt
Install CodeScene MCP: safeguard and uplift AI-generated code. Catch issues early with our IDE extension and CLI tool.

Comment thread src/runner/process/mod.rs
@leynos

leynos commented Aug 14, 2026

Copy link
Copy Markdown
Owner Author

@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. Ensure that this is validated against the current version of the codegraph.

If further refinement to address this finding would be deleterious, please supply a clear explanatory one to two paragraph markdown message I can paste into the CodeScene web ui's diagnostic suppression function so this diagnostic can be silenced.

src/runner/process/mod.rs

Comment on file

//! Internal to `runner`; public API is defined in `runner.rs`.

use super::{BuildTargets, NINJA_PROGRAM};
use crate::cli::Cli;

❌ Getting worse: Code Duplication
introduced similar code in: run_ninja_build_internal,run_ninja_tool_internal

@coderabbitai

This comment was marked as resolved.

@leynos
leynos force-pushed the issue-339-decouple-process-from-cli branch from 6e0a2d7 to 9a75f64 Compare August 14, 2026 19:07
codescene-access[bot]

This comment was marked as outdated.

codescene-access[bot]

This comment was marked as outdated.

codescene-access[bot]

This comment was marked as outdated.

codescene-access[bot]

This comment was marked as outdated.

@leynos

leynos commented Aug 14, 2026

Copy link
Copy Markdown
Owner Author

@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. Ensure that this is validated against the current version of the codegraph.

If further refinement to address this finding would be deleterious, please supply a clear explanatory one to two paragraph markdown message I can paste into the CodeScene web ui's diagnostic suppression function so this diagnostic can be silenced.

src/runner/process/command_logging.rs

Comment on file

    );
}

/// Determine the operation label from a fully configured Ninja command.

❌ New issue: Code Duplication
The module contains 4 functions with similar structure: command_span,log_command_execution,log_command_exit_failure,log_command_spawn_failure

@leynos

leynos commented Aug 14, 2026

Copy link
Copy Markdown
Owner Author

@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. Ensure that this is validated against the current version of the codegraph.

If further refinement to address this finding would be deleterious, please supply a clear explanatory one to two paragraph markdown message I can paste into the CodeScene web ui's diagnostic suppression function so this diagnostic can be silenced.

src/runner/process/mod.rs

Comment on lines +235 to +238

fn run_ninja_internal<F>(
    program: &Path,
    options: &NinjaProcessOptions,
    build_file: &Path,

❌ New issue: Excess Number of Function Arguments
run_ninja_internal has 5 arguments, max arguments = 4

@leynos

leynos commented Aug 14, 2026

Copy link
Copy Markdown
Owner Author

@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. Ensure that this is validated against the current version of the codegraph.

If further refinement to address this finding would be deleterious, please supply a clear explanatory one to two paragraph markdown message I can paste into the CodeScene web ui's diagnostic suppression function so this diagnostic can be silenced.

src/runner/process/mod.rs

Comment on lines -257 to -266

) -> io::Result<()> {
    run_ninja_internal(
        NinjaInternalRequest {
            program: request.program,
            cli: request.cli,
            status_observer,
            operation: request.tool,
        },
        |cmd| configure_ninja_tool_command(cmd, &request),
    )

❌ Getting worse: Code Duplication
introduced similar code in: run_ninja_tool_with,run_ninja_tool_with_status,run_ninja_with,run_ninja_with_status

@coderabbitai

This comment was marked as resolved.

@coderabbitai

This comment was marked as resolved.

@coderabbitai

This comment was marked as resolved.

codescene-access[bot]

This comment was marked as outdated.

codescene-access[bot]

This comment was marked as outdated.

@leynos
leynos marked this pull request as ready for review August 14, 2026 23:39

@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

@coderabbitai coderabbitai Bot added the Issue label Aug 14, 2026
chatgpt-codex-connector[bot]

This comment was marked as resolved.

coderabbitai[bot]

This comment was marked as resolved.

codescene-access[bot]

This comment was marked as outdated.

codescene-access[bot]

This comment was marked as outdated.

codescene-access[bot]

This comment was marked as outdated.

@leynos
leynos force-pushed the issue-339-decouple-process-from-cli branch from 122011a to e0fe679 Compare August 15, 2026 19:37
@coderabbitai coderabbitai Bot removed the Issue label Aug 16, 2026
coderabbitai[bot]

This comment was marked as resolved.

codescene-access[bot]

This comment was marked as outdated.

leynos and others added 10 commits August 19, 2026 18:17
The low-level subprocess adapter in `runner::process` accepted `&Cli`
through command construction and its request structs, coupling it to
the parser/config domain type and making reuse and testing harder.

Introduce `NinjaProcessOptions` — the narrow execution type carrying
only what the process layer needs (working directory, job count, and
the stderr-suppression flag) — and translate from `Cli` once at the
orchestration boundary via `runner::ninja_process_options`. The
public `run_ninja`/`run_ninja_tool` entry points keep their `&Cli`
signatures but now live in `runner::mod` as thin translating
wrappers, so existing callers and tests are unchanged.

`runner::process` no longer imports `Cli` at all; making the stderr
flag a named policy type is tracked separately in #340.
Keep `runner` below the module-size limit by moving the CLI-to-process
translation and public compatibility wrappers into their own runner-owned
adapter module.

Update the embedded-process fixture and design documentation so requests
remain parser-independent while `CommandEnv` retains its distinct role.
Route build and tool invocations through one configured-command helper so
streaming, stderr policy, and error propagation remain centralised.

Retain the request types and verify the command argument order without
spawning Ninja.
Convert CLI directories to UTF-8 process options at the runner boundary and
reject invalid paths before spawning Ninja.

Reuse shared rstest setup for command-configuration coverage and document the
process request contract.
Assert the operation labels emitted for build and named tool execution,
and ensure non-zero exits retain their structured status diagnostics.
Cover successful and failed Ninja exits plus the operation labels emitted by
build and tool execution. Document the request-based execution context so
adapter callers and implementation guidance remain aligned.
Remove obsolete runner wrappers and migrate remaining request fixtures to
the options and stream-policy APIs. Split the focused execution-context
tests into their own module so the process test module remains within the
repository size limit.
NinjaProcessOptions.jobs now carries a NinjaJobCount newtype that
enforces the CLI's supported 1..=64 semantics at every construction
site. ninja_process_options converts the raw CLI value and rejects
out-of-range counts with an InvalidInput error before a request reaches
the process layer.

The stderr-routing tests gain a crate-level #![cfg(unix)] gate, and
their documentation now describes only the explicit StderrMode routing
the tests actually construct. A new process-layer test pins
working-directory propagation by having the fake Ninja record its
effective current directory.

Co-Authored-By: Claude <noreply@anthropic.com>
Rebasing onto origin/main surfaced weave-resolved regions in
src/runner/mod.rs and src/runner/process/mod.rs whose import and
module-declaration ordering drifted from rustfmt's canonical form.
No semantics change; cargo fmt --all -- --check is now clean.

Co-Authored-By: Claude <noreply@anthropic.com>
@leynos
leynos force-pushed the issue-339-decouple-process-from-cli branch from f61ea74 to fce4f77 Compare August 19, 2026 16:31
codescene-access[bot]

This comment was marked as outdated.

codescene-access[bot]

This comment was marked as outdated.

@wafflecat-df12

Copy link
Copy Markdown
Collaborator

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Aug 19, 2026

Copy link
Copy Markdown
Contributor
✅ 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 coderabbitai Bot added the Issue label Aug 19, 2026
coderabbitai[bot]

This comment was marked as resolved.

leynos added 2 commits August 21, 2026 23:08
Exercise every `usize` against the process boundary so valid counts preserve
their value and invalid counts consistently return `InvalidInput`.
@coderabbitai

coderabbitai Bot commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

Warning

Your free Security trial is over. An organization admin can activate billing to continue.

codescene-access[bot]

This comment was marked as outdated.

@codescene-access codescene-access 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.

No quality gates enabled for this code.

@leynos

leynos commented Aug 22, 2026

Copy link
Copy Markdown
Owner Author

@coderabbitai Have the following now been resolved?

tests/stderr_routing_tests.rs (1)

1-28: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
Gate and accurately describe the routing tests.
This file uses Unix-specific imports and constants, so add #![cfg(unix)] to prevent non-Unix -D warnings builds from failing. Also remove the claim that these cases exercise an independently configured Cli::json: json is derived from stderr_mode, and routing_worker selects from JOB_ENV without constructing or reading Cli. Either rename the test text to document explicit StderrMode routing or add a runner-boundary test with independently configured CLI values.

🤖 Detailed instructions

Use a wyvern agent team to verify each finding against the current code and only fix it if needed. Fix any documentation issues using a scribe agent team. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. Use a scrutineer agent for execution of tests and summarizing the results.

In @tests/stderr_routing_tests.rs around lines 1 - 28, Add the Unix-only crate
attribute to the stderr routing tests so non-Unix builds exclude their imports
and constants. Revise the test documentation to describe only explicit
StderrMode routing, removing the unsupported cli.json independence claim unless
the test constructs and passes two genuinely independent policies through
NinjaBuildRequest or NinjaToolRequest.

Apply the same fix in @tests/stderr_routing_tests.rs around lines 82 - 83:
Covered by the inaccurate independent-Cli claim portion of the consolidated
comment.

Source: Coding guidelines

@coderabbitai

coderabbitai Bot commented Aug 22, 2026

Copy link
Copy Markdown
Contributor

Tip

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

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '%s\n' '== current revision =='
git rev-parse --short HEAD
git status --short

printf '%s\n' '== target file outline and complete contents =='
ast-grep outline tests/stderr_routing_tests.rs --items all
cat -n tests/stderr_routing_tests.rs

printf '%s\n' '== routing terminology and implementation references =='
rg -n -A18 -B8 \
  '\b(Cli|json|StderrMode|routing_worker|JOB_ENV|NinjaBuildRequest|NinjaToolRequest)\b' \
  tests/stderr_routing_tests.rs src tests -g '*.rs'

printf '%s\n' '== PR checks =='
gh pr view 371 --repo leynos/netsuke \
  --json headRefOid,statusCheckRollup \
  --jq '{head: .headRefOid, checks: [.statusCheckRollup[] | {name, status, conclusion}]}'

Length of output: 168875


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '%s\n' '== stderr routing test source =='
sed -n '1,180p' tests/stderr_routing_tests.rs

printf '%s\n' '== target-file matches =='
rg -n -i -C2 \
  'cfg\(unix\)|Cli|cli\.json|independent|StderrMode|routing_worker|JOB_ENV|routing' \
  tests/stderr_routing_tests.rs

Length of output: 13973


@leynos tests/stderr_routing_tests.rs — module documentation, routing_worker

Treat this finding as resolved at PR head 59de566.

  • Line 10 has #![cfg(unix)]. This excludes the Unix-only shell fixture, imports, and constants from non-Unix builds.
  • Lines 1-9 now describe request-level routing through explicit StderrMode.
  • The documentation states that StderrMode::from_json_enabled runs upstream of the request types.
  • The file has no Cli import and no cli.json independence claim.
  • routing_worker reads JOB_ENV and sets NinjaBuildRequest::stderr_mode or NinjaToolRequest::stderr_mode directly.
  • The four routing tests describe StderrMode::Forward and StderrMode::Suppress behaviour for build and tool requests.
  • The current build-test check and both Windows release build checks succeeded.

Do not add a runner-boundary CLI test for this finding. These tests now correctly test the process-layer contract.

You are interacting with an AI system.

@leynos
leynos merged commit d533911 into main Aug 22, 2026
17 checks passed
@leynos
leynos deleted the issue-339-decouple-process-from-cli branch August 22, 2026 01:06
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.

Decouple runner process execution from Cli

3 participants