Skip to content

Allow multiple rule references#9

Merged
leynos merged 1 commit intomainfrom
codex/update-design-for-multiple-rules
Jul 13, 2025
Merged

Allow multiple rule references#9
leynos merged 1 commit intomainfrom
codex/update-design-for-multiple-rules

Conversation

@leynos
Copy link
Copy Markdown
Owner

@leynos leynos commented Jul 13, 2025

Summary

  • document that a target's rule can list multiple rules
  • update Recipe enum to accept a rule list
  • clarify StringOrList usage

Testing

  • make fmt
  • make lint
  • make test
  • make markdownlint
  • make nixie

https://chatgpt.com/codex/tasks/task_e_6873852dfb548322bcfb8fab0c5271f3

Summary by Sourcery

Enable multiple rule references per target by extending the rule field to accept lists, updating both code and documentation to reflect this flexibility

Enhancements:

  • Allow target's rule field to be a YAML list of rule names for sequential rule execution
  • Update Recipe enum's Rule variant to use StringOrList instead of a single string
  • Clarify StringOrList usage in documentation to include rule names alongside sources and dependencies

@sourcery-ai
Copy link
Copy Markdown
Contributor

sourcery-ai Bot commented Jul 13, 2025

Reviewer's Guide

This PR extends rule handling to allow multiple rule references per target by switching the Recipe::Rule variant to use the existing StringOrList enum, and updates the design documentation to reflect the new YAML list syntax and clarify StringOrList semantics.

File-Level Changes

Change Details Files
Document that a target’s rule field can accept multiple rules as a list
  • Updated the prose around rule to mention list syntax
  • Added a YAML example showing multiple rules in sequence
  • Expanded the StringOrList note to include rule names and reflowed paragraphs for consistency
docs/netsuke-design.md
Change Recipe::Rule to accept a StringOrList instead of a single string
  • Replaced rule: String with rule: StringOrList in the Recipe enum
  • Preserved the serde(alias = "rule") attribute for backward compatibility
  • Ensured JSON/YAML deserialization now supports both string and list inputs
src/ir.rs

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

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jul 13, 2025

Summary by CodeRabbit

  • Documentation
    • Improved readability and formatting throughout the design document, including clearer explanations and more consistent code examples.
    • Enhanced examples to show that rules can now be specified as a list, allowing multiple sequential rules for targets.
    • Expanded sections on templating integration, security considerations, and error handling for greater clarity and completeness.

Walkthrough

Apply extensive editorial and formatting improvements to the docs/netsuke-design.md document. Update code snippets for clarity, especially around YAML and Rust examples. Change the Recipe::Rule variant in Rust from a single String to a StringOrList for greater flexibility. Clarify explanations throughout, especially regarding parsing, templating, and security.

Changes

File(s) Change Summary
docs/netsuke-design.md Refine formatting, clarify explanations, reformat code snippets, expand rationale, and improve examples. Update Rust Recipe::Rule variant to use StringOrList instead of String. Standardise references and citations.

Poem

In lines now neat and code made clear,
The rules may list, not just appear,
With YAML crisp and Rust refined,
Each paragraph and thought aligned.
The docs now sing, concise and bright—
Well done on making prose take flight!
🦾📚

✨ Finishing Touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch codex/update-design-for-multiple-rules

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai auto-generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

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.

Hey @leynos - I've reviewed your changes and they look great!


Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 4

📜 Review details

Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 8f2c1dd and b4b017e.

📒 Files selected for processing (1)
  • docs/netsuke-design.md (32 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
docs/**/*.md

Instructions used from:

Sources:
📄 CodeRabbit Inference Engine

  • AGENTS.md
**/*.md

Instructions used from:

Sources:
📄 CodeRabbit Inference Engine

  • AGENTS.md

⚙️ CodeRabbit Configuration File

🧠 Learnings (1)
docs/netsuke-design.md (2)
Learnt from: CR
PR: leynos/netsuke#0
File: docs/netsuke-design.md:0-0
Timestamp: 2025-07-12T13:36:08.546Z
Learning: Applies to docs/**/Netsukefile : The Netsuke manifest file must be named 'Netsukefile' and use a YAML schema with top-level keys: netsuke_version, vars, macros, rules, targets, and defaults.
Learnt from: CR
PR: leynos/netsuke#0
File: docs/netsuke-design.md:0-0
Timestamp: 2025-07-12T13:36:08.546Z
Learning: Applies to docs/src/ast.rs : Fields in the AST that can be either a single string or a list of strings must use an enum with #[serde(untagged)] (e.g., StringOrList).
🪛 LanguageTool
docs/netsuke-design.md

[misspelling] ~24-~24: This word is normally spelled with a hyphen.
Context: ...fulfills this role. It provides a rich, user- friendly language (YAML with Jinja) for describi...

(EN_COMPOUNDS_USER_FRIENDLY)


[uncategorized] ~242-~242: Loose punctuation mark.
Context: ...build-local variables.[^3] - macros: An optional list of Jinja macro definit...

(UNLIKELY_OPENING_PUNCTUATION)


[uncategorized] ~562-~562: Possible missing comma found.
Context: ...nction would execute python --version or python3 --version using `std::proce...

(AI_HYDRA_LEO_MISSING_COMMA)


[grammar] ~563-~563: Please add a punctuation mark at the end of paragraph.
Context: ...ss::Command19, parse the output using the semver` crate 4, and compare it aga...

(PUNCTUATION_PARAGRAPH_END)


[style] ~593-~593: Consider using the typographical ellipsis character here instead.
Context: ...owerful but often opaque functions like $(shell...) and $(wildcard...). Netsuke achieve...

(ELLIPSIS)


[style] ~593-~593: Consider using the typographical ellipsis character here instead.
Context: ...opaque functions like $(shell...) and $(wildcard...). Netsuke achieves and surpasses this ...

(ELLIPSIS)


[misspelling] ~834-~834: This word is normally spelled with a hyphen.
Context: ..., Bash, sh, Fish), which is vital for a cross- platform build tool. It also correctly handles a...

(EN_COMPOUNDS_CROSS_PLATFORM)


[misspelling] ~861-~861: This word is normally spelled with a hyphen.
Context: ...ect shell quoting falls on the user, an error- prone task that requires specialized knowledg...

(EN_COMPOUNDS_ERROR_PRONE)


[typographical] ~1192-~1192: To join two clauses or introduce examples, consider using an em dash.
Context: ...-build.org/> [^2]: Ninja (build system) - Wikipedia, accessed on July 12, 2025, <h...

(DASH_RULE)


[typographical] ~1195-~1195: To join two clauses or introduce examples, consider using an em dash.
Context: ...Complete Guide To The Ninja Build System - Spectra - Mathpix, accessed on July 12, ...

(DASH_RULE)


[typographical] ~1195-~1195: To join two clauses or introduce examples, consider using an em dash.
Context: ...uide To The Ninja Build System - Spectra - Mathpix, accessed on July 12, 2025, <<<h...

(DASH_RULE)


[typographical] ~1199-~1199: To join two clauses or introduce examples, consider using an em dash.
Context: ...to-the-ninja-build-system> [^4]: semver - Rust, accessed on July 12, 2025, <<https...

(DASH_RULE)


[typographical] ~1202-~1202: To join two clauses or introduce examples, consider using an em dash.
Context: ...io/Agents/semver/index.html> Versioning - GitHub, accessed on July 12, 2025, <<<ht...

(DASH_RULE)


[typographical] ~1207-~1207: To join two clauses or introduce examples, consider using an em dash.
Context: ...r/latest/semver/> [^7]: How Ninja works - Fuchsia, accessed on July 12, 2025, <htt...

(DASH_RULE)


[typographical] ~1215-~1215: To join two clauses or introduce examples, consider using an em dash.
Context: .../c/34ebqOUxnXg> [^11]: Saphyr libraries - crates.io: Rust Pack...

(DASH_RULE)


[typographical] ~1224-~1224: To join two clauses or introduce examples, consider using an em dash.
Context: ...ttps://docs.rs/saphyr> [^15]: minijinja - crates.io: Rust Pack...

(DASH_RULE)


[typographical] ~1227-~1227: To join two clauses or introduce examples, consider using an em dash.
Context: ...s.io/crates/minijinja> [^16]: minijinja - Rust - Docs.rs, access...

(DASH_RULE)


[typographical] ~1227-~1227: To join two clauses or introduce examples, consider using an em dash.
Context: ...ates/minijinja> [^16]: minijinja - Rust - Docs.rs, accessed on J...

(DASH_RULE)


[typographical] ~1230-~1230: To join two clauses or introduce examples, consider using an em dash.
Context: ...://docs.rs/minijinja/> [^17]: minijinja - Rust, accessed on July 12, 2025, <<https...

(DASH_RULE)


[typographical] ~1243-~1243: To join two clauses or introduce examples, consider using an em dash.
Context: ...heck-python-version> [^22]: shell_quote - Rust - Docs.rs, access...

(DASH_RULE)


[typographical] ~1243-~1243: To join two clauses or introduce examples, consider using an em dash.
Context: ...thon-version> [^22]: shell_quote - Rust - Docs.rs, accessed on J...

(DASH_RULE)


[typographical] ~1249-~1249: To join two clauses or introduce examples, consider using an em dash.
Context: ...process/index.html> [^24]: std::process - Rust, accessed on July 12, 2025, <<https...

(DASH_RULE)


[typographical] ~1260-~1260: To join two clauses or introduce examples, consider using an em dash.
Context: ...-vs-snafu-2003> and Advanced Techniques - Technorely, accessed on July 12, 2025, <...

(DASH_RULE)


[typographical] ~1264-~1264: To join two clauses or introduce examples, consider using an em dash.
Context: ...ractical guide to Error Handling in Rust - Dev State, accessed on July 12, 2025, <h...

(DASH_RULE)


[typographical] ~1267-~1267: To join two clauses or introduce examples, consider using an em dash.
Context: ..._handling/> [^30]: thiserror and anyhow - Comprehensive Rust, accessed on July 12,...

(DASH_RULE)

🔇 Additional comments (1)
docs/netsuke-design.md (1)

1-1278: Run mdformat-all and markdownlint before merging.

Several minor lint issues (loose punctuation, missing commas) remain. Execute the documented formatting pipeline to catch any residual violations and keep docs consistent.

Comment thread docs/netsuke-design.md
Comment on lines +134 to +135
A `Netsukefile` file is a YAML mapping containing a set of well-defined top-
level keys.
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.

🧹 Nitpick (assertive)

Avoid mid-word line breaks in “top-level”.

Keep hyphenated compounds intact to satisfy MD013 and improve readability.

-A `Netsukefile` file is a YAML mapping containing a set of well-defined top-
-level keys.
+A `Netsukefile` file is a YAML mapping containing a set of well-defined top-level keys.
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
A `Netsukefile` file is a YAML mapping containing a set of well-defined top-
level keys.
A `Netsukefile` file is a YAML mapping containing a set of well-defined top-level keys.
🤖 Prompt for AI Agents
In docs/netsuke-design.md around lines 134 to 135, the phrase "top-level" is
broken across lines, which violates markdown lint rule MD013 and reduces
readability. Adjust the line break so that the hyphenated compound "top-level"
remains on the same line without splitting the word.

Comment thread docs/netsuke-design.md
Comment on lines +23 to +25
This design choice by Ninja's authors necessitates the existence of a higher-
level generator tool. Netsuke fulfills this role. It provides a rich, user-
friendly language (YAML with Jinja) for describing the *what* and *why* of
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.

🧹 Nitpick (assertive)

Join the broken “user-friendly” compound and apply en-GB spelling.

Breaking a hyphenated word across lines violates the style guide and confuses spell-checkers. Merge the lines and switch “fulfills” → “fulfils”.

-level generator tool. Netsuke fulfills this role. It provides a rich, user-
-friendly language (YAML with Jinja) for describing the *what* and *why* of
+level generator tool. Netsuke fulfils this role. It provides a rich, user-friendly language (YAML with Jinja) for describing the *what* and *why* of

Committable suggestion skipped: line range outside the PR's diff.

🧰 Tools
🪛 LanguageTool

[misspelling] ~24-~24: This word is normally spelled with a hyphen.
Context: ...fulfills this role. It provides a rich, user- friendly language (YAML with Jinja) for describi...

(EN_COMPOUNDS_USER_FRIENDLY)

🤖 Prompt for AI Agents
In docs/netsuke-design.md around lines 23 to 25, the phrase "user-friendly" is
broken across lines and uses en-US spelling. Merge the hyphenated word into a
single line and change "user-friendly" to "user-friendly" with en-GB spelling
conventions, and also change "fulfills" to "fulfils" to comply with the style
guide.

Comment thread docs/netsuke-design.md
Comment on lines +861 to +862
build systems, the burden of correct shell quoting falls on the user, an error-
prone task that requires specialized knowledge.
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.

🧹 Nitpick (assertive)

Unify the “error-prone” compound and switch to en-GB “specialised”.

-build systems, the burden of correct shell quoting falls on the user, an error-
-prone task that requires specialized knowledge.
+build systems, the burden of correct shell quoting falls on the user, an error-prone task that requires specialised knowledge.
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
build systems, the burden of correct shell quoting falls on the user, an error-
prone task that requires specialized knowledge.
build systems, the burden of correct shell quoting falls on the user, an error-prone task that requires specialised knowledge.
🧰 Tools
🪛 LanguageTool

[misspelling] ~861-~861: This word is normally spelled with a hyphen.
Context: ...ect shell quoting falls on the user, an error- prone task that requires specialized knowledg...

(EN_COMPOUNDS_ERROR_PRONE)

🤖 Prompt for AI Agents
In docs/netsuke-design.md around lines 861 to 862, unify the hyphenation of
"error-prone" to be consistent and change the spelling of "specialized" to the
en-GB variant "specialised". Update the text to use "error-prone" consistently
and replace "specialized" with "specialised" to match British English
conventions.

Comment thread docs/netsuke-design.md
Comment on lines +834 to +835
for multiple shell flavors (e.g., Bash, sh, Fish), which is vital for a cross-
platform build tool. It also correctly handles a wide variety of input types,
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.

🧹 Nitpick (assertive)

Fix the split “cross-platform” compound and adopt en-GB “flavours”.

-for multiple shell flavors (e.g., Bash, sh, Fish), which is vital for a cross-
-platform build tool. It also correctly handles a wide variety of input types,
+for multiple shell flavours (e.g., Bash, sh, Fish), which is vital for a cross-platform build tool. It also correctly handles a wide variety of input types,

Committable suggestion skipped: line range outside the PR's diff.

🧰 Tools
🪛 LanguageTool

[misspelling] ~834-~834: This word is normally spelled with a hyphen.
Context: ..., Bash, sh, Fish), which is vital for a cross- platform build tool. It also correctly handles a...

(EN_COMPOUNDS_CROSS_PLATFORM)

🤖 Prompt for AI Agents
In docs/netsuke-design.md around lines 834 to 835, fix the hyphenation of the
compound "cross-platform" by ensuring it is correctly split or formatted as a
single hyphenated term. Additionally, change the American English spelling
"flavors" to the British English "flavours" to maintain consistency with en-GB
usage.

@leynos leynos merged commit 3a89ca7 into main Jul 13, 2025
1 check passed
@leynos leynos deleted the codex/update-design-for-multiple-rules branch July 13, 2025 12:41
@coderabbitai coderabbitai Bot mentioned this pull request Jul 13, 2025
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.

1 participant