Advanced Usage: 3.13.2 docs, tests, and roadmap completed#283
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (1)
OverviewImplements roadmap item 3.13.2 by adding an "Advanced usage" chapter to the user guide, delivering BDD and rstest integration tests for the chapter, and hardening the BDD test harness and developer documentation around environment‑handling semantics. Changes are additive and include an ExecPlan, docs, tests, and test‑harness improvements. ExecPlan and Design
User Documentation
Behavioural Tests (BDD)
Test Harness, Fixtures & Unit Tests
Integration Tests
Test-support API & Dev Dependencies
Environment Handling: Races, Locking & Fixes
Developer Documentation
Acceptance Evidence & Follow‑ups
WalkthroughAdd an "Advanced usage" docs chapter and tests for Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant TW as TestWorld
participant Builder as build_netsuke_command
participant Host as HostEnv
participant Cmd as assert_cmd::Command
participant Netsuke as netsuke process
TW->>Builder: request command with args + env_vars_forward
Builder->>Host: read host PATH
Host-->>Builder: return PATH
Builder->>Cmd: env_clear()
Builder->>Cmd: set PATH (from Host)
Builder->>Cmd: inject env_vars_forward entries
Builder->>Cmd: set program to netsuke_executable()
Cmd->>Netsuke: spawn process
Netsuke-->>Cmd: return stdout, stderr, exit status
Cmd-->>Builder: return execution result
Builder-->>TW: return stdout/stderr/status
Poem
🚥 Pre-merge checks | ✅ 6 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (6 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
Reviewer's GuideImplements the first part of ExecPlan 3.13.2 by adding an Advanced Usage chapter to the user guide, introducing new BDD feature and step definitions plus a small feature file for advanced workflows, tightening the BDD manifest command harness to use assert_cmd with explicit PATH and env propagation, and documenting the plan and design linkages in a new execplan and minor doc edits. Sequence diagram for BDD advanced usage manifest streaming workflowsequenceDiagram
actor Developer
participant BddRunner
participant TestWorld
participant AdvancedUsageSteps
participant ManifestCommandSteps
participant AssertCmdCommand
participant NetsukeBinary
participant NinjaTool
Developer->>BddRunner: run bdd_tests advanced_usage
BddRunner->>TestWorld: create TestWorld fixture
BddRunner->>AdvancedUsageSteps: execute Given a minimal Netsuke workspace
AdvancedUsageSteps->>ManifestCommandSteps: reuse workspace_setup_steps
ManifestCommandSteps->>TestWorld: create_workspace_with_manifest()
BddRunner->>AdvancedUsageSteps: execute When netsuke is run with args "manifest -"
AdvancedUsageSteps->>TestWorld: set_env_from_world()
TestWorld->>AssertCmdCommand: build_command_with_explicit_path()
AssertCmdCommand->>AssertCmdCommand: inherit_NINJA_ENV()
AssertCmdCommand->>AssertCmdCommand: apply_world_environment_overrides()
AssertCmdCommand->>NetsukeBinary: spawn_with_env_and_path()
NetsukeBinary->>NinjaTool: optional_ninja_invocation()
NinjaTool-->>NetsukeBinary: build_status
NetsukeBinary-->>AssertCmdCommand: exit_code_stdout_stderr
AssertCmdCommand-->>TestWorld: store_process_output()
BddRunner->>AdvancedUsageSteps: execute Then stdout should contain Ninja_manifest
AdvancedUsageSteps->>TestWorld: assert_stdout_contains_manifest_markers()
BddRunner->>AdvancedUsageSteps: execute And stderr should be empty
AdvancedUsageSteps->>TestWorld: assert_stderr_empty()
BddRunner-->>Developer: scenario_passes
Class diagram for updated BDD steps, env handling, and test worldclassDiagram
class TestWorld {
+Path workspace_dir
+HashMap~String,String~ env_overrides
+Output stdout
+Output stderr
+i32 exit_code
+set_env_var(name: String, value: String) void
+apply_env_to_command(command: AssertCmdCommand) void
+store_output(output: CommandOutput) void
}
class ManifestCommandSteps {
+given_minimal_workspace(world: TestWorld) void
+given_empty_workspace(world: TestWorld) void
+when_netsuke_run_with_args(world: TestWorld, args: Vec~String~) void
+when_netsuke_run_without_args(world: TestWorld) void
+then_command_should_succeed(world: TestWorld) void
+then_command_should_fail(world: TestWorld) void
+stdout_should_contain(world: TestWorld, fragment: String) void
+stderr_should_contain(world: TestWorld, fragment: String) void
+stdout_should_be_empty(world: TestWorld) void
+stderr_should_be_empty(world: TestWorld) void
-build_command(world: TestWorld, args: Vec~String~) AssertCmdCommand
-attach_env_and_path(world: TestWorld, command: AssertCmdCommand) AssertCmdCommand
}
class AdvancedUsageSteps {
+given_workspace_with_config_setting(world: TestWorld, key: String, value: String) void
+given_env_var_set(world: TestWorld, name: String, value: String) void
+stdout_should_contain_dot_graph(world: TestWorld) void
+stderr_should_be_valid_diagnostics_json(world: TestWorld) void
+stderr_should_not_contain(world: TestWorld, fragment: String) void
}
class EnvSupport {
+set_var(name: String, value: String) VarGuard
+remove_var(name: String) VarGuard
+restore_many(vars: HashMap~String,Option~String~~) void
+acquire_env_lock() EnvLock
}
class EnvLock {
+lock() void
+unlock() void
}
class VarGuard {
-String name
-Option~String~ original
+new(name: String, original: Option~String~) VarGuard
+drop() void
}
class AssertCmdCommand {
+env(name: String, value: String) AssertCmdCommand
+env_remove(name: String) AssertCmdCommand
+env_clear() AssertCmdCommand
+current_dir(path: Path) AssertCmdCommand
+assert() CommandOutput
}
class JsonDiagnosticsSteps {
+stderr_should_be_valid_diagnostics_json(world: TestWorld) void
+stderr_diagnostics_code_should_be(world: TestWorld, code: String) void
}
ManifestCommandSteps --> TestWorld : uses
AdvancedUsageSteps --> TestWorld : uses
AdvancedUsageSteps --> ManifestCommandSteps : reuses
ManifestCommandSteps --> AssertCmdCommand : builds
TestWorld --> AssertCmdCommand : applies_env
EnvSupport --> EnvLock : manages
EnvSupport --> VarGuard : returns
ManifestCommandSteps --> EnvSupport : uses_for_env_management
AdvancedUsageSteps --> EnvSupport : uses_for_env_management
JsonDiagnosticsSteps --> TestWorld : reads_stderr
Flow diagram for validation and testing pipeline introduced by ExecPlan 3_13_2flowchart TD
A["Edit docs and tests for Advanced Usage"] --> B["Run make fmt"]
B --> C["Run make markdownlint"]
C --> D["Run make nixie"]
D --> E["Run cargo test --test bdd_tests advanced_usage"]
E --> F["Run cargo test --test advanced_usage_tests"]
F --> G["Run make check-fmt"]
G --> H["Run make lint"]
H --> I["Run make test"]
I --> J["All gates pass, roadmap 3_13_2 can be marked done"]
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
|
@coderabbitai Have the following now been resolved? Annul any requirements that violate the en-GB-oxendict spelling (-ize / -yse / -our) conventions (for example a request to replace "normalize" with "normalise" or "artefact" with "artifact"), or where the requirement unnecessarily increases cyclomatic complexity. |
|
@coderabbitai Please suggest a fix for the following test failures and provide an AI coding agent prompt for the fix: |
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
|
@coderabbitai Please suggest a fix for the following concern and provide an AI coding agent prompt for the fix: Overall comment —
|
This comment was marked as resolved.
This comment was marked as resolved.
|
@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. ❌ Failed checks (2 warnings)
|
|
@coderabbitai I'm concerned that we are using imperative environment manipulation rather than using env_lock (https://docs.rs/env-lock/latest/env_lock/) and RAII for this. |
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
…y docs
- Add descriptive scenario names to rstest config-precedence cases so
failure output shows meaningful labels instead of numeric indices
- Tighten clean-without-prior-build fallback assertion to check for
specific diagnostic strings ("missing build file", ".ninja_log")
rather than the overly broad "build" substring
- Remove spurious comma before "because" clause in developers-guide
(en-GB-oxendict convention)
- Clarify that the BDD sequence diagram applies to e2e behavioural
tests, not code-level unit or integration tests
- Document that run_netsuke_in_with_env automatically forwards PATH
alongside NETSUKE_NINJA
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@docs/developers-guide.md`:
- Line 456: Insert a comma after the word "steps" in the sentence mentioning the
TestWorld fixture (the phrase "The `TestWorld` fixture coordinates state across
steps while") so it reads "across steps, while" to improve readability and
conform to en-GB punctuation; update the sentence in the
docs/developers-guide.md where `TestWorld` is described.
🪄 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
Run ID: 99c08222-0a21-4eab-af58-7bb325fa9dcd
📒 Files selected for processing (2)
docs/developers-guide.mdtests/advanced_usage_tests.rs
|
@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. ❌ Failed checks (1 warning)
|
This comment was marked as resolved.
This comment was marked as resolved.
…lity - Update all GitHub workflow actions from shared-actions SHA 7f4cc57326d14b55f7eea300e0454653636fb6a1 to 6b13b519f99c5b461be8cc21ecf19c2ec5907b9c - Add comma after "steps" in developers-guide BDD sequence diagram figure caption to improve readability and follow en-GB punctuation conventions Affected workflows: ci.yml, netsukefile-test.yml, build-and-package.yml, release.yml Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@docs/developers-guide.md`:
- Around line 362-477: Update the earlier docs to match the new BDD env
contract: add env_vars_forward to the TestWorld field groups table and adjust
its Purpose to mention "forwarding map for child commands"; update the TestWorld
method docs for track_env_var(key, previous) to the new signature
track_env_var(key, previous, new_value) and explain it records the restoration
value in env_vars and the forwarding value in env_vars_forward; and document the
new non-consuming accessors EnvGuard::original_ref() and
NinjaEnvGuard::original_ref() (in the EnvVarGuard or TestWorld methods section)
so readers know they can inspect captured original values without consuming the
guard.
🪄 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
Run ID: e1a9fb60-546f-4b20-9ee8-34137c42c3f0
📒 Files selected for processing (5)
.github/workflows/build-and-package.yml.github/workflows/ci.yml.github/workflows/netsukefile-test.yml.github/workflows/release.ymldocs/developers-guide.md
Update documentation for test infrastructure improvements: 1. Correct `track_env_var` signature to show three-argument form and explain `env_vars_forward` side-effect for child process environment forwarding. 2. Add `env_vars_forward` to Environment state row in TestWorld field groups table with clarified column descriptions. 3. Document `original_ref()` accessor on environment guards (`NinjaEnvGuard` and `EnvGuard<E>`) with usage example showing how BDD steps obtain prior values without consuming guards prematurely. 4. Document `given_config_file_with_setting` BDD step and `toml = "0.8"` dev-dependency, including TOML value coercion rules and extension policy. All changes are documentation-only. No Rust source files modified. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Fix `run_netsuke_with_env` to correctly pass `NETSUKE_NINJA` to child
processes via explicit environment forwarding instead of host-process guards:
1. Remove the host-process `override_ninja_env` guard that was ineffective
because `run_netsuke_in_with_env` calls `env_clear()`.
2. Build a merged environment vector that includes caller-supplied `extra_env`
entries plus a `("NETSUKE_NINJA", path_str)` entry when `ninja_env` is
`Some`, mirroring the pattern already used in `run_netsuke`.
3. Replace `ninja_env::NINJA_ENV` constant references with string literal
`"NETSUKE_NINJA"` to avoid taking a dependency on the `ninja_env` crate
from integration tests.
4. Remove unused `use test_support::env::{SystemEnv, override_ninja_env};`
import.
This ensures that configuration-layering tests using `run_netsuke_with_env`
correctly forward the fake ninja path to child processes in the isolated
environment created by `env_clear()`.
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@docs/developers-guide.md`:
- Around line 446-448: Replace the British '-ise' spelling in the phrase
containing "toml = \"0.8\"" and the word "serialisation" with the Oxford '-ize'
form: change "serialisation" to "serialization" in the sentence that mentions
the `toml = "0.8"` dev-dependency and the `toml` crate so the documentation
follows the repo's en-GB-oxendict convention.
- Around line 152-156: The sentence in the docs paragraph explaining how to
inspect the environment before the guard is activated contains an incorrect
comma before the essential "because" clause; edit the paragraph (the one
referencing track_env_var and consuming original(self)) to remove the comma
immediately before "because" so the restrictive clause reads correctly, matching
the same fix applied at the other location (commit 02874ce).
🪄 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
Run ID: 3f98781f-8979-4806-9370-f139c40767da
📒 Files selected for processing (2)
docs/developers-guide.mdtests/advanced_usage_tests.rs
Update the default WiX extension version from '6' to '7' in GitHub Actions workflows for Windows MSI packaging: - Update `release.yml` input default and fallback resolution logic - Update `build-and-package.yml` input default This ensures that Windows installer builds use WiX Toolset 7.x when the version is not explicitly specified by workflow callers. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
Fix English punctuation and spelling in developer documentation: 1. Remove comma before restrictive "because" clause in the `original_ref()` documentation (line 154), matching the fix applied in commit 02874ce. 2. Change "serialisation" to "serialization" (line 447) to follow the repo's en-GB-oxendict convention, which uses Oxford -ize spellings. These changes improve conformity to the project's established documentation style without altering technical content. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In @.github/workflows/build-and-package.yml:
- Line 59: The workflow sets WiX Toolset default to '7' but WiX v7 changes path
semantics and removes Heat; update the build to ensure .wxs Files element paths
are correct (paths are now relative to the .wxs source directory) and
remove/replace any Heat.exe or Heat MSBuild usage—migrate harvesting steps to
WiX Files or Payloads elements instead; search for references to "default: '7'",
"Heat.exe", "Heat", "Files element", and any .wxs harvesting scripts and adjust
path references and harvesting logic accordingly.
In `@docs/developers-guide.md`:
- Around line 160-164: The example call to world.track_env_var passes
ninja_path.as_os_str().to_owned() directly but the method expects new_value:
Option<OsString>; update the call to wrap the third argument in Some(...), e.g.
pass Some(ninja_path.as_os_str().to_owned()), leaving the first two args
(ninja_env::NINJA_ENV.to_owned(), previous) unchanged so the call to
world.track_env_var matches the documented signature.
- Around line 155-169: The docs incorrectly reference a consuming guard method
named original(self); update the API text and examples to document and call
into_original(self) -> Option<OsString> instead. Locate the example using
override_ninja_env, let guard, and
guard.original_ref()/world.track_env_var/world.ninja_env_guard and replace
mentions of original(self) with into_original(self), and update any signature
text at the earlier API reference to show into_original(self) ->
Option<OsString> so readers know the consuming method name and return type.
🪄 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
Run ID: 758de11a-80a6-4dfe-be5c-dccc8b196e34
📒 Files selected for processing (3)
.github/workflows/build-and-package.yml.github/workflows/release.ymldocs/developers-guide.md
…d name Fix two inaccuracies in the `original_ref()` documentation section: 1. Wrap the `new_value` argument to `track_env_var` in `Some(...)` to match the documented signature `Option<OsString>`. Previously the example passed a bare `OsString` which would not compile. 2. Replace references to the consuming method `original(self)` with the canonical name `into_original(self) -> Option<OsString>`, matching the method as defined on `EnvGuard<E>` in `test_support::env_guard`. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
|
Tip For best results, initiate chat on the files or code changes. 🧩 Analysis chain🏁 Script executed: Length of output: 2954
Developer Documentation ✅ ResolvedBoth prose corrections are confirmed in the live file:
Module-Level Documentation ✅ ResolvedAll three files open with
No further work is required. |
Summary
Changes
docs/execplans/3-13-2-user-documentation-advanced-usage-chapter.mddetailing the complete plan for an Advanced Usage chapter, BDD scenarios, integration tests, design decisions, and roadmap updates.docs/users-guide.mdto introduce Section 12 "Advanced Usage" with subsections 12.1–12.5, detailing usage ofclean,graph,manifest, configuration layering, and JSON diagnostics, including worked examples and cross-references.tests/features/advanced_usage.featurewith eight scenarios covering manifest streaming, manifest to stdout/file, clean, graph, configuration layering with environment/CLI overrides, and JSON diagnostics on error.tests/bdd/steps/advanced_usage.rscontaining new step definitions for the advanced usage workflows (config file setup, environment variables, and graph output checks).tests/bdd/steps/mod.rsto register the newadvanced_usagemodule.tests/advanced_usage_tests.rs(rstest-based) to cover edge cases and unhappy paths not reached by BDD.tests/bdd/steps/manifest_command.rsupdated to locate the netsuke executable and to support environment variable handling and robust command execution, including explicit PATH handling.tests/bdd/steps/manifest_command.rsnow preservesNINJA_ENVand applies environment variables from the test world to netsuke invocations.tests/bdd/fixtures/mod.rsextended with anenv_vars_forwardmap and related wiring to forward scenario-controlled environment variables to child processes.test_supportupdates:test_support/src/env.rsandtest_support/src/env_guard.rsgainoriginal_ref()helpers to peek at captured original values without consuming the guard.tests/bdd/helpers/env_mutation.rsupdated to propagate forward-env values and preserve isolation guarantees.docs/netsuke-design.mdupdated to reflect the design decision that advanced usage documentation is backed by behavioural tests.docs/roadmap.mdupdated to reflect the 3.13.2 milestone as completed.docs/developers-guide.mdadjusted to clarify BDD command helpers and environment handling changes (in-line with the updated test harness).tests/features/advanced_usage.featureadded.tests/advanced_usage_tests.rsadded with rstest-based integration tests for edge/unhappy paths.tests/bdd/steps/manifest_command_tests.rsadded to provide unit coverage for environment handling helpers.Plan of work (Stage A–F) – status update
docs/users-guide.mdas Section 12.tests/features/advanced_usage.featureandtests/bdd/steps/advanced_usage.rs.tests/advanced_usage_tests.rs.Acceptance criteria
tests/features/advanced_usage.featurevalidates documented workflows.rstestintegration tests cover edge cases and unhappy paths.Artefacts and notes
Key artefacts introduced by this plan:
docs/execplans/3-13-2-user-documentation-advanced-usage-chapter.md(new planning doc)docs/users-guide.md,docs/netsuke-design.md, anddocs/roadmap.md(plan documented in ExecPlan)Validation and acceptance
To verify locally:
make check-fmt,make lint,make test,make markdownlint,make nixie.Idempotence and rollback
All stages are additive and self-contained. If a stage fails, revert only the affected changes using git.
Generated by the updated plan and work items for Advanced Usage documentation and test coverage.
📎 Task: https://www.devboxer.com/task/05a40bb2-4c56-466d-b742-6e351fbaf2ce