Skip to content

Document Ninja executable override (#83)#323

Draft
lodyai[bot] wants to merge 1 commit into
mainfrom
issue-83-support-overriding-ninja-executable
Draft

Document Ninja executable override (#83)#323
lodyai[bot] wants to merge 1 commit into
mainfrom
issue-83-support-overriding-ninja-executable

Conversation

@lodyai
Copy link
Copy Markdown
Contributor

@lodyai lodyai Bot commented May 31, 2026

Summary

This branch documents and verifies the NETSUKE_NINJA executable override for issue #83. It makes the user-facing variable discoverable, corrects stale internal documentation that referred to the Rust constant name, and adds binary-level coverage showing the verbose command log contains the resolved Ninja program.

Closes #83.

Review walkthrough

Validation

  • cargo test --test logging_stderr_tests verbose_build_logs -- --nocapture: passed.
  • make check-fmt: passed.
  • make lint: passed.
  • make test: passed.
  • make markdownlint: passed.
  • make nixie: passed.
  • coderabbit review --agent: attempted twice; both invocations stalled at sandbox preparation, and the second timed out after five minutes without findings.

Copy link
Copy Markdown
Contributor

@sourcery-ai sourcery-ai Bot left a comment

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
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 31, 2026

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 2522fb3f-f71c-4a7f-ab53-8e11790edae4

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch issue-83-support-overriding-ninja-executable

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

codescene-delta-analysis[bot]

This comment was marked as outdated.

@leynos
Copy link
Copy Markdown
Owner

leynos commented May 31, 2026

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

tests/logging_stderr_tests.rs

Comment on lines +244 to +260

fn verbose_build_logs_default_ninja_command(
    temp_with_minimal_manifest: Result<TempDir>,
) -> Result<()> {
    let temp = temp_with_minimal_manifest?;
    let ninja_temp = tempdir().context("create fake ninja dir")?;
    let ninja_path = ninja_temp.path().join(fake_ninja_name("ninja"));
    write_fake_ninja_script(&ninja_path, &[], None)?;

    let stderr =
        run_verbose_build_with_ninja_env(temp.path(), path_containing(ninja_temp.path())?, None)?;

    ensure!(
        stderr.contains("Executing command: ninja "),
        "default build should log the fallback ninja program, got:\n{stderr}"
    );
    Ok(())
}

❌ New issue: Code Duplication
The module contains 2 functions with similar structure: verbose_build_logs_default_ninja_command,verbose_build_logs_ninja_env_override

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 31, 2026

Tip

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

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
cat tests/logging_stderr_tests.rs

Length of output: 13381



File: tests/logging_stderr_tests.rs
Symbols: verbose_build_logs_default_ninja_command, verbose_build_logs_ninja_env_override


Fix

Extract a private helper that owns the shared setup and assertion logic; keep the two #[rstest] entry-points as thin delegates.

fn run_verbose_build_and_assert_ninja_log(
    temp_with_minimal_manifest: Result<TempDir>,
    ninja_stem: &str,
    use_env_override: bool,
) -> Result<()> {
    let temp = temp_with_minimal_manifest?;
    let ninja_temp = tempdir().context("create fake ninja dir")?;
    let ninja_path = ninja_temp.path().join(fake_ninja_name(ninja_stem));
    write_fake_ninja_script(&ninja_path, &[], None)?;

    let ninja_env = use_env_override.then_some(ninja_path.as_path());
    let stderr =
        run_verbose_build_with_ninja_env(temp.path(), path_containing(ninja_temp.path())?, ninja_env)?;

    let expected = if use_env_override {
        format!("Executing command: {} ", ninja_path.display())
    } else {
        format!("Executing command: {ninja_stem} ")
    };
    let description = if use_env_override {
        "override build should log the resolved ninja program"
    } else {
        "default build should log the fallback ninja program"
    };
    ensure!(
        stderr.contains(&expected),
        "{description}, got:\n{stderr}"
    );
    Ok(())
}

#[rstest]
fn verbose_build_logs_default_ninja_command(
    temp_with_minimal_manifest: Result<TempDir>,
) -> Result<()> {
    run_verbose_build_and_assert_ninja_log(temp_with_minimal_manifest, "ninja", false)
}

#[rstest]
fn verbose_build_logs_ninja_env_override(
    temp_with_minimal_manifest: Result<TempDir>,
) -> Result<()> {
    run_verbose_build_and_assert_ninja_log(temp_with_minimal_manifest, "custom-ninja", true)
}

AI coding-agent prompt

File: tests/logging_stderr_tests.rs
Symbols: verbose_build_logs_default_ninja_command, verbose_build_logs_ninja_env_override

Task
────
Eliminate the code duplication between `verbose_build_logs_default_ninja_command` and
`verbose_build_logs_ninja_env_override` by extracting a shared private helper function.

Steps
─────
1. Insert the following private helper immediately before
   `verbose_build_logs_default_ninja_command`:

       fn run_verbose_build_and_assert_ninja_log(
           temp_with_minimal_manifest: Result<TempDir>,
           ninja_stem: &str,
           use_env_override: bool,
       ) -> Result<()> {
           let temp = temp_with_minimal_manifest?;
           let ninja_temp = tempdir().context("create fake ninja dir")?;
           let ninja_path = ninja_temp.path().join(fake_ninja_name(ninja_stem));
           write_fake_ninja_script(&ninja_path, &[], None)?;

           let ninja_env = use_env_override.then_some(ninja_path.as_path());
           let stderr = run_verbose_build_with_ninja_env(
               temp.path(),
               path_containing(ninja_temp.path())?,
               ninja_env,
           )?;

           let expected = if use_env_override {
               format!("Executing command: {} ", ninja_path.display())
           } else {
               format!("Executing command: {ninja_stem} ")
           };
           let description = if use_env_override {
               "override build should log the resolved ninja program"
           } else {
               "default build should log the fallback ninja program"
           };
           ensure!(
               stderr.contains(&expected),
               "{description}, got:\n{stderr}"
           );
           Ok(())
       }

2. Replace the body of `verbose_build_logs_default_ninja_command` with:

       run_verbose_build_and_assert_ninja_log(temp_with_minimal_manifest, "ninja", false)

   The function signature and `#[rstest]` attribute must remain unchanged.

3. Replace the body of `verbose_build_logs_ninja_env_override` with:

       run_verbose_build_and_assert_ninja_log(temp_with_minimal_manifest, "custom-ninja", true)

   The function signature and `#[rstest]` attribute must remain unchanged.

4. Do not alter any other functions, imports, or attributes in the file.

Verification
────────────
Run `cargo test --test logging_stderr_tests verbose_build_logs` and confirm both
tests pass before committing.

Document `NETSUKE_NINJA` in the user and runner documentation so users can
find the portable Ninja executable override.

Add binary-level logging coverage for the default `ninja` fallback and an
explicit `NETSUKE_NINJA` path so verbose command traces show the resolved
program in both cases.
@lodyai lodyai Bot force-pushed the issue-83-support-overriding-ninja-executable branch from 6247da7 to f914024 Compare June 1, 2026 10:53
Copy link
Copy Markdown

@codescene-delta-analysis codescene-delta-analysis Bot left a comment

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
logging_stderr_tests.rs 1 advisory rule 10.00 → 9.39 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.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support overriding Ninja executable via NETSUKE_NINJA

1 participant