Conversation
Switch the CLI subcommand to `manifest` and cover it with `assert_cmd` integration tests. Also test the `--emit` build option via `assert_cmd` and update documentation and fixtures.
Reviewer's GuideThis PR renames the Sequence diagram for the new 'manifest' subcommand executionsequenceDiagram
actor User
participant CLI
participant Runner
participant FileSystem
User->>CLI: netsuke manifest FILE
CLI->>Runner: run(Manifest { file })
Runner->>Runner: generate_ninja(cli)
Runner->>FileSystem: write_and_log(file, ninja)
FileSystem-->>Runner: Success
Runner-->>CLI: Ok
CLI-->>User: Command completes
Class diagram for updated CLI Commands enumclassDiagram
class Commands {
+Graph
+Manifest(file: PathBuf)
}
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
|
Note Other AI code review bot(s) detectedCodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review. Summary by CodeRabbit
WalkthroughRename the CLI subcommand and related enum variant from Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant CLI
participant Runner
participant FileSystem
User->>CLI: netsuke manifest FILE
CLI->>Runner: Commands::Manifest { file: FILE }
Runner->>FileSystem: Write Ninja manifest to FILE
FileSystem-->>Runner: File created
Runner-->>CLI: Success
CLI-->>User: Command completes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Possibly related PRs
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (4)
🧰 Additional context used📓 Path-based instructions (1)**/*.rs📄 CodeRabbit Inference Engine (AGENTS.md)
Files:
⚙️ CodeRabbit Configuration File
Files:
🧠 Learnings (3)📚 Learning: applies to **/*.md : validate mermaid diagrams in markdown files by running `make nixie`....Applied to files:
📚 Learning: applies to **/*.md : validate markdown mermaid diagrams using the make nixie....Applied to files:
📚 Learning: applies to **/*.md : validate mermaid diagrams in markdown files by running make nixie....Applied to files:
🔇 Additional comments (7)
✨ Finishing Touches
🧪 Generate unit tests
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Hey @leynos - I've reviewed your changes and they look great!
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location> `src/cli.rs:103` </location>
<code_context>
- /// Emit the Ninja manifest to the specified file without running Ninja.
- Emit {
+ /// Write the Ninja manifest to the specified file without invoking Ninja.
+ Manifest {
/// Output path for the generated Ninja file.
#[arg(value_name = "FILE")]
</code_context>
<issue_to_address>
Add or update both behavioural and unit tests for the Manifest command.
You have renamed the Emit command to Manifest and changed its description. Ensure that both behavioural and unit tests cover the Manifest command, including its new name and any altered behaviour. Update or add tests as necessary to reflect this change.
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
There was a problem hiding this comment.
Actionable comments posted: 2
🔭 Outside diff range comments (1)
src/cli.rs (1)
102-107: Provide a backwards-compatibility alias foremit.Renaming a public CLI subcommand is a breaking change for existing scripts. Restore compatibility by adding an alias:
- /// Write the Ninja manifest to the specified file without invoking Ninja. - Manifest { + /// Write the Ninja manifest to the specified file without invoking Ninja. + #[command(alias = "emit")] + Manifest {This keeps new naming while preventing sudden breakage.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
⛔ Files ignored due to path filters (1)
Cargo.lockis excluded by!**/*.lock
📒 Files selected for processing (10)
Cargo.toml(1 hunks)README.md(1 hunks)docs/netsuke-design.md(2 hunks)src/cli.rs(1 hunks)src/runner.rs(1 hunks)tests/assert_cmd_tests.rs(1 hunks)tests/cli_tests.rs(1 hunks)tests/features/cli.feature(1 hunks)tests/runner_tests.rs(2 hunks)tests/steps/cli_steps.rs(2 hunks)
🧰 Additional context used
📓 Path-based instructions (4)
**/*.rs
📄 CodeRabbit Inference Engine (AGENTS.md)
**/*.rs: Clippy warnings MUST be disallowed.
Fix any warnings emitted during tests in the code itself rather than silencing them.
Where a function is too long, extract meaningfully named helper functions adhering to separation of concerns and CQRS.
Where a function has too many parameters, group related parameters in meaningfully named structs.
Where a function is returning a large error consider usingArcto reduce the amount of data returned.
Write unit and behavioural tests for new functionality. Run both before and after making any change.
Every module must begin with a module level (//!) comment explaining the module's purpose and utility.
Document public APIs using Rustdoc comments (///) so documentation can be generated with cargo doc.
Prefer immutable data and avoid unnecessarymutbindings.
Handle errors with theResulttype instead of panicking where feasible.
Avoidunsafecode unless absolutely necessary and document any usage clearly.
Place function attributes after doc comments.
Do not usereturnin single-line functions.
Use predicate functions for conditional criteria with more than two branches.
Lints must not be silenced except as a last resort.
Lint rule suppressions must be tightly scoped and include a clear reason.
Preferexpectoverallow.
Prefer.expect()over.unwrap().
Useconcat!()to combine long string literals rather than escaping newlines with a backslash.
Prefer semantic error enums: Derivestd::error::Error(via thethiserrorcrate) for any condition the caller might inspect, retry, or map to an HTTP status.
Use an opaque error only at the app boundary: Useeyre::Reportfor human-readable logs; these should not be exposed in public APIs.
Never export the opaque type from a library: Convert to domain enums at API boundaries, and toeyreonly in the mainmain()entrypoint or top-level async task.
Files:
src/runner.rstests/cli_tests.rssrc/cli.rstests/assert_cmd_tests.rstests/runner_tests.rstests/steps/cli_steps.rs
⚙️ CodeRabbit Configuration File
**/*.rs: * Seek to keep the cyclomatic complexity of functions no more than 12.
Adhere to single responsibility and CQRS
Place function attributes after doc comments.
Do not use
returnin single-line functions.Move conditionals with >2 branches into a predicate function.
Avoid
unsafeunless absolutely necessary.Every module must begin with a
//!doc comment that explains the module's purpose and utility.Comments and docs must follow en-GB-oxendict (-ize / -our) spelling and grammar
Lints must not be silenced except as a last resort.
#[allow]is forbidden.- Only narrowly scoped
#[expect(lint, reason = "...")]is allowed.- No lint groups, no blanket or file-wide suppression.
- Include
FIXME:with link if a fix is expected.Use
rstestfixtures for shared setup and to avoid repetition between tests.Replace duplicated tests with
#[rstest(...)]parameterised cases.Prefer
mockallfor mocks/stubs.Prefer
.expect()over.unwrap()Ensure that any API or behavioural changes are reflected in the documentation in
docs/Ensure that any completed roadmap steps are recorded in the appropriate roadmap in
docs/Files must not exceed 400 lines in length
- Large modules must be decomposed
- Long match statements or dispatch tables should be decomposed by domain and collocated with targets
- Large blocks of inline data (e.g., test fixtures, constants or templates) must be moved to external files and inlined at compile-time or loaded at run-time.
Files:
src/runner.rstests/cli_tests.rssrc/cli.rstests/assert_cmd_tests.rstests/runner_tests.rstests/steps/cli_steps.rs
**/*.md
📄 CodeRabbit Inference Engine (AGENTS.md)
**/*.md: Documentation must use en-GB-oxendict spelling and grammar, except for the naming of the "LICENSE" file.
Validate Markdown files usingmake markdownlint.
Runmake fmtafter any documentation changes to format all Markdown files and fix table markup.
Validate Mermaid diagrams in Markdown files by runningmake nixie.
Markdown paragraphs and bullet points must be wrapped at 80 columns.
Code blocks in Markdown must be wrapped at 120 columns.
Tables and headings in Markdown must not be wrapped.
Use dashes (-) for list bullets in Markdown.
Use GitHub-flavoured Markdown footnotes ([^1]) for references and footnotes.
Files:
README.mddocs/netsuke-design.md
⚙️ CodeRabbit Configuration File
**/*.md: * Avoid 2nd person or 1st person pronouns ("I", "you", "we")
- Use en-GB-oxendict (-ize / -our) spelling and grammar
- Paragraphs and bullets must be wrapped to 80 columns, except where a long URL would prevent this (in which case, silence MD013 for that line)
- Code blocks should be wrapped to 120 columns.
- Headings must not be wrapped.
- Documents must start with a level 1 heading
- Headings must correctly increase or decrease by no more than one level at a time
- Use GitHub-flavoured Markdown style for footnotes and endnotes.
- Numbered footnotes must be numbered by order of appearance in the document.
Files:
README.mddocs/netsuke-design.md
Cargo.toml
📄 CodeRabbit Inference Engine (AGENTS.md)
Cargo.toml: Use explicit version ranges inCargo.tomland keep dependencies up-to-date.
Mandate caret requirements for all dependencies: All crate versions specified inCargo.tomlmust use SemVer-compatible caret requirements (e.g.,some-crate = "1.2.3").
Prohibit unstable version specifiers: The use of wildcard (*) or open-ended inequality (>=) version requirements is strictly forbidden. Tilde requirements (~) should only be used where a dependency must be locked to patch-level updates for a specific, documented reason.
Files:
Cargo.toml
docs/**/*.md
📄 CodeRabbit Inference Engine (AGENTS.md)
docs/**/*.md: Use the markdown files within thedocs/directory as a knowledge base and source of truth for project requirements, dependency choices, and architectural decisions.
Proactively update the relevant file(s) in thedocs/directory to reflect the latest state when new decisions are made, requirements change, libraries are added/removed, or architectural patterns evolve.
Files:
docs/netsuke-design.md
🧬 Code Graph Analysis (1)
tests/runner_tests.rs (3)
tests/steps/cli_steps.rs (1)
manifest_path(104-107)src/runner.rs (1)
run(71-108)tests/steps/process_steps.rs (1)
run(81-122)
🪛 GitHub Check: build-test
tests/assert_cmd_tests.rs
[warning] 33-33:
Diff in /home/runner/work/netsuke/netsuke/tests/assert_cmd_tests.rs
🪛 GitHub Actions: CI
tests/assert_cmd_tests.rs
[error] 33-33: Prettier formatting check failed. Diff detected in line 33. Run 'cargo fmt --all' to fix code style issues.
🔇 Additional comments (14)
Cargo.toml (1)
67-67: Adhere to caret-semver – all good.
assert_cmd = "2.0.17"follows the mandated caret requirement style and stays within an up-to-date minor.
No action needed.src/runner.rs (1)
94-98: Rename handled cleanly.
Commands::Manifestmirrors the previousEmitlogic and keeps side-effects limited to file generation. Implementation is sound.README.md (1)
150-158: Documentation aligns with code.The CLI synopsis now lists
manifestprecisely as implemented. Good update.tests/features/cli.feature (1)
33-37: LGTM! Consistent command renaming reflected in feature tests.The scenario correctly updates both the command name and assertions to match the
emittomanifestsubcommand renaming.docs/netsuke-design.md (2)
390-393: Documentation correctly updated for command rename.The
Manifestcommand documentation properly reflects the CLI change whilst maintaining the same functional behavior.
1425-1427: Command description accurately updated.The description correctly states that
manifest FILEwrites the Ninja file without invoking Ninja, consistent with the renamed command.tests/runner_tests.rs (3)
137-137: Function name appropriately updated.The test function name correctly reflects the command rename from
emittomanifest.
146-154: Variable and command structure consistently updated.The variable rename from
emit_pathtooutput_pathand theCommands::Manifestvariant usage properly reflect the subcommand changes.
159-159: Assertion correctly uses updated variable.The test assertion properly verifies the existence of the output file using the renamed variable.
tests/assert_cmd_tests.rs (3)
1-6: Excellent module documentation.The doc comment clearly explains the purpose and scope of these integration tests.
13-26: Solid integration test for manifest subcommand.The test properly sets up a temporary environment, isolates PATH, and verifies file creation without invoking Ninja.
28-49: Comprehensive test for build with emit functionality.The test correctly sets up a fake ninja environment and verifies the emit functionality works as expected.
tests/steps/cli_steps.rs (2)
90-97: Step definition correctly updated for command rename.The function name and Cucumber annotation properly reflect the change from
emittomanifest, and the pattern match correctly handles the newCommands::Manifestvariant.
148-155: Path extraction step definition properly updated.The function name, step expression, and match arm are all consistently updated to handle the
manifestcommand path extraction.
Summary
emitsubcommand withmanifest--emitbuild flag withassert_cmdtestsTesting
make fmtmake lintmake testmake markdownlintmake nixie(fails: too many arguments)https://chatgpt.com/codex/tasks/task_e_6892a963da54832290c55b0150ec0538
Summary by Sourcery
Rename the
emitsubcommand tomanifestthroughout the codebase and introduce end-to-end CLI tests usingassert_cmdto validate both the newmanifestsubcommand and the existing--emitbuild flag.New Features:
manifestsubcommand and the--emitbuild option.Enhancements:
emittomanifestacross code, documentation, and tests.Build:
assert_cmddependency to Cargo.toml for integration testing.Tests:
manifestsubcommand and add new end-to-end tests in tests/assert_cmd_tests.rs.