Skip to content

Implement Netsukefile YAML parser#31

Merged
leynos merged 2 commits intomainfrom
codex/implement-yaml-parsing-for-netsukemanifest
Jul 26, 2025
Merged

Implement Netsukefile YAML parser#31
leynos merged 2 commits intomainfrom
codex/implement-yaml-parsing-for-netsukemanifest

Conversation

@leynos
Copy link
Copy Markdown
Owner

@leynos leynos commented Jul 25, 2025

Summary

  • load Netsukefiles via new manifest module
  • document manifest loader design
  • mark roadmap tasks as done
  • test manifest parsing via rstest and cucumber
  • add manifest YAML fixtures and broaden tests

Testing

  • make fmt
  • make lint
  • make test
  • make markdownlint
  • make nixie (fails: FileNotFound copying files)

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

Summary by Sourcery

Introduce a new manifest module to parse Netsukefile YAML via from_str and from_path helper functions, replace raw serde_yaml usage throughout tests and Cucumber steps, and broaden test coverage with YAML fixtures and BDD scenarios while updating related documentation and dependencies.

New Features:

  • Add manifest module with from_str and from_path functions for loading and validating Netsukefile YAML

Enhancements:

  • Replace direct serde_yaml deserialization in unit tests and Cucumber steps with the manifest loader
  • Add tests/data fixtures and expand rstest and Cucumber scenarios to cover valid and invalid manifest files
  • Update Cargo.toml to include anyhow for error handling and expose the manifest module in lib.rs

Build:

  • Add anyhow dependency to Cargo.toml for manifest module error handling

Documentation:

  • Update netsuke-design.md to document loader helpers and fixtures, and mark YAML parser tasks done in roadmap.md
  • Fix minor spacing in rust-doctest-dry-guide.md

Tests:

  • Extend ast_tests.rs with file-based loading tests and error cases via manifest::from_path
  • Add BDD step for verifying the first rule name and new scenarios in manifest.feature

@sourcery-ai
Copy link
Copy Markdown
Contributor

sourcery-ai Bot commented Jul 25, 2025

Reviewer's Guide

This PR introduces a dedicated manifest module with YAML parsing and file-loading helpers wrapped in anyhow for robust error handling, refactors existing tests and Cucumber steps to leverage these helpers, adds new fixtures and scenarios to cover valid/invalid manifests, and updates documentation and configuration to reflect the new loader design.

Entity relationship diagram for manifest YAML parsing

erDiagram
    NETSUKE_MANIFEST ||--o{ TARGETS : contains
    NETSUKE_MANIFEST {
        string netsuke_version
        Target[] targets
    }
    TARGETS {
        string name
        Recipe recipe
        bool phony
        bool always
    }
    TARGETS }o--|| RECIPE : has
    RECIPE {
        string kind
        string command
    }
Loading

Flow diagram for manifest loading from file or string

flowchart TD
    A[User or Test] -->|YAML string| B[from_str]
    A -->|File path| C[from_path]
    C --> D[Read file contents]
    D --> B
    B --> E[NetsukeManifest]
    B -->|Error| F[anyhow::Error]
    C -->|Error| F
Loading

File-Level Changes

Change Details Files
Add manifest parsing module and expose it
  • Implement from_str and from_path wrapping serde_yml with context
  • Add manifest module to lib.rs
  • Add anyhow dependency
src/manifest.rs
src/lib.rs
Cargo.toml
Refactor unit and integration tests to use manifest API
  • Replace direct serde_yml::from_str calls with manifest::from_str
  • Add tests for loading from file and missing file errors
  • Add rstest cases for example and invalid manifests
tests/ast_tests.rs
Enhance Cucumber steps and feature definitions
  • Switch step implementation to manifest::from_path
  • Add step for validating first rule name
  • Extend feature scenarios for rules and invalid cases
tests/steps/manifest_steps.rs
tests/features/manifest.feature
Introduce YAML fixtures for valid and invalid manifests
  • Add sample manifests covering rules, unknown fields, version errors, missing recipes
tests/data/rules.yml
tests/data/unknown_field.yml
tests/data/invalid_version.yml
tests/data/missing_recipe.yml
Update documentation and roadmap for manifest loader
  • Document manifest helpers in design doc
  • Mark parsing tasks done in roadmap
  • Minor fix in doctest guide formatting
docs/netsuke-design.md
docs/roadmap.md
docs/rust-doctest-dry-guide.md

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 25, 2025

Summary by CodeRabbit

  • New Features

    • Introduced helper functions for loading and parsing manifest files, supporting both string and file path inputs.
    • Added new test scenarios and data files to cover manifest parsing, validation, and error handling, including cases for rules, unknown fields, invalid versions, and missing recipes.
    • Added public module for manifest parsing to the library exports.
  • Bug Fixes

    • Improved test coverage for manifest validation, ensuring robust error detection for invalid or malformed manifests.
  • Documentation

    • Updated design and roadmap documentation to clarify parsing strategies, error handling, and mark completed tasks.
    • Cleaned up duplicated references and improved formatting in documentation.
  • Refactor

    • Refactored test and step definitions to use new manifest parsing APIs, simplifying error handling and test logic.

Walkthrough

Update the manifest parsing infrastructure by introducing a new manifest module with helper functions for loading and parsing manifests using anyhow-based error handling. Refactor tests and documentation to use these helpers, add new test cases and fixtures for manifest validation, and expose the module in the public API.

Changes

File(s) Change Summary
Cargo.toml Add anyhow crate as a new dependency.
src/lib.rs Expose new manifest module publicly.
src/manifest.rs Add new module with from_str and from_path functions for manifest loading and error handling.
tests/ast_tests.rs Refactor tests to use manifest helpers; add file-based loading tests; update error handling.
tests/steps/manifest_steps.rs Refactor to use manifest::from_path; add step to check first rule's name.
docs/netsuke-design.md Clarify deserialisation strategy, document new helpers, update test suite description.
docs/roadmap.md Mark three CLI and manifest parsing tasks as completed.
docs/rust-doctest-dry-guide.md Remove duplicated reference lines; tidy up formatting.
tests/features/manifest.feature Add five new scenarios for manifest parsing, including positive and negative cases.
tests/data/rules.yml Add new YAML fixture for rules and targets.
tests/data/unknown_field.yml Add YAML fixture with unknown field for negative testing.
tests/data/invalid_version.yml Add YAML fixture with invalid version for negative testing.
tests/data/missing_recipe.yml Add YAML fixture missing a recipe for negative testing.

Sequence Diagram(s)

sequenceDiagram
    participant Test as Test Suite
    participant Manifest as manifest module
    participant FS as Filesystem
    participant Serde as serde_yml
    participant AST as NetsukeManifest

    Test->>Manifest: from_path(path)
    Manifest->>FS: Read file
    FS-->>Manifest: File contents (YAML)
    Manifest->>Manifest: from_str(yaml)
    Manifest->>Serde: Deserialize YAML
    Serde-->>Manifest: NetsukeManifest or error
    Manifest-->>Test: Result<NetsukeManifest, anyhow::Error>
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~18 minutes

Possibly related PRs

  • Implement initial AST structures #23: Defines the initial AST data structures and exposes the ast module. This PR is related as it provides the foundation upon which the new manifest parsing helpers operate.

Poem

New helpers arrive with a cheer,
Manifest loading is now crystal clear.
Tests and docs all join the parade,
With YAML fixtures carefully laid.
From path or string, errors handled with grace—
Netsuke marches on, keeping a brisk pace!
🦀✨


📜 Recent review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 202e395 and da48640.

📒 Files selected for processing (5)
  • docs/rust-doctest-dry-guide.md (2 hunks)
  • src/lib.rs (1 hunks)
  • src/manifest.rs (1 hunks)
  • tests/data/missing_recipe.yml (1 hunks)
  • tests/data/rules.yml (1 hunks)
🧰 Additional context used
📓 Path-based instructions (3)
**/*.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 using Arc to reduce the amount of data returned.
Document public APIs using Rustdoc comments (///) so documentation can be generated with cargo doc.
Every module must begin with a module level (//!) comment explaining the module's purpose and utility.
Prefer immutable data and avoid unnecessary mut bindings.
Handle errors with the Result type instead of panicking where feasible.
Avoid unsafe code unless absolutely necessary and document any usage clearly.
Place function attributes after doc comments.
Do not use return in 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.
Prefer expect over allow.
Prefer .expect() over .unwrap().

Files:

  • src/lib.rs
  • src/manifest.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 return in single-line functions.

  • Move conditionals with >2 branches into a predicate function.

  • Avoid unsafe unless 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 rstest fixtures for shared setup and to avoid repetition between tests.

  • Replace duplicated tests with #[rstest(...)] parameterised cases.

  • Prefer mockall for 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/lib.rs
  • src/manifest.rs
docs/**/*.md

📄 CodeRabbit Inference Engine (AGENTS.md)

docs/**/*.md: Use the markdown files within the docs/ directory as a knowledge base and source of truth for project requirements, dependency choices, and architectural decisions.
Proactively update the relevant file(s) in the docs/ directory to reflect the latest state when new decisions are made, requirements change, libraries are added/removed, or architectural patterns evolve.
Documentation must use en-GB-oxendict spelling and grammar (with the exception of 'license' which is to be left unchanged for community consistency).

Files:

  • docs/rust-doctest-dry-guide.md
**/*.md

📄 CodeRabbit Inference Engine (AGENTS.md)

**/*.md: Validate Markdown files using make markdownlint.
Run make fmt after any documentation changes to format all Markdown files and fix table markup.
Validate Mermaid diagrams in Markdown files by running make 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.

Files:

  • docs/rust-doctest-dry-guide.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:

  • docs/rust-doctest-dry-guide.md
🪛 YAMLlint (1.37.1)
tests/data/missing_recipe.yml

[error] 4-4: too many blank lines (1 > 0)

(empty-lines)

tests/data/rules.yml

[error] 13-13: too many blank lines (1 > 0)

(empty-lines)

🔇 Additional comments (9)
tests/data/rules.yml (1)

1-12: Well-structured test fixture for rule validation.

The YAML structure correctly defines a build rule and target relationship, providing good test coverage for manifest parsing scenarios.

src/lib.rs (2)

3-4: Documentation accurately reflects the library's expanded scope.

The updated description correctly captures both CLI definitions and manifest parsing capabilities.


8-8: Manifest module properly exposed in public API.

Adding the manifest module to the public interface follows standard Rust library patterns.

docs/rust-doctest-dry-guide.md (2)

648-648: Good cleanup of redundant footnote text.

Removing the duplicated "accessed on July 15, 2025" improves documentation readability.


657-657: Consistent footnote formatting maintained.

The text cleanup aligns with the formatting pattern used elsewhere in the document.

src/manifest.rs (4)

1-6: Excellent module documentation following guidelines.

The module-level comment clearly explains the purpose and utility, adhering to the requirement that every module must begin with a //! doc comment.


7-9: Clean and appropriate imports.

The imports are well-organised and include only necessary dependencies. Using anyhow for error handling aligns with modern Rust practices.


11-35: Well-implemented function with improved documentation.

The from_str function correctly wraps serde_yml::from_str with proper error context. The multi-line raw string literal in the example significantly improves readability compared to single-line strings, addressing previous feedback.


37-56: Robust file handling with proper error context.

The from_path function correctly handles file I/O errors and delegates parsing to from_str. The error context includes the file path for better diagnostics. The no_run attribute on the example is appropriate since it references a file that may not exist.

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch codex/implement-yaml-parsing-for-netsukemanifest

🪧 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 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 found some issues that need to be addressed.


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.

@leynos
Copy link
Copy Markdown
Owner Author

leynos commented Jul 26, 2025

@coderabbitai review

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jul 26, 2025

✅ Actions performed

Review triggered.

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.

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: 1

🔭 Outside diff range comments (4)
tests/data/missing_recipe.yml (1)

1-4: Terminate file with a newline.

End the fixture with a trailing newline to comply with POSIX text-file conventions and avoid diff-noise in future edits.

-  - name: hi
+  - name: hi
+
tests/data/rules.yml (1)

1-13: Add trailing newline for consistency.

Mirror the convention used by other fixture files.

-      rule: compile
-
+      rule: compile
+
src/lib.rs (1)

1-5: Update crate-level doc comment to reflect new public surface.

The comment still claims the library "only exposes the command line interface". With manifest now re-exported this statement is stale. Amend to mention manifest helpers to keep docs trustworthy.

docs/rust-doctest-dry-guide.md (1)

648-658: Remove dangling comma after “accessed on July 15, 2025”.

The comma is unnecessary and breaks the flow of the footnote entry. Drop it to match preceding citations.

-    accessed on July 15, 2025,
+    accessed on July 15, 2025
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 9405778 and 202e395.

⛔ Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (13)
  • Cargo.toml (1 hunks)
  • docs/netsuke-design.md (1 hunks)
  • docs/roadmap.md (1 hunks)
  • docs/rust-doctest-dry-guide.md (2 hunks)
  • src/lib.rs (1 hunks)
  • src/manifest.rs (1 hunks)
  • tests/ast_tests.rs (16 hunks)
  • tests/data/invalid_version.yml (1 hunks)
  • tests/data/missing_recipe.yml (1 hunks)
  • tests/data/rules.yml (1 hunks)
  • tests/data/unknown_field.yml (1 hunks)
  • tests/features/manifest.feature (1 hunks)
  • tests/steps/manifest_steps.rs (2 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
**/*.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:

  • docs/rust-doctest-dry-guide.md
  • docs/roadmap.md
  • docs/netsuke-design.md
**/*.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 return in single-line functions.

  • Move conditionals with >2 branches into a predicate function.

  • Avoid unsafe unless 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 rstest fixtures for shared setup and to avoid repetition between tests.

  • Replace duplicated tests with #[rstest(...)] parameterised cases.

  • Prefer mockall for 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/lib.rs
  • tests/steps/manifest_steps.rs
  • src/manifest.rs
  • tests/ast_tests.rs
🧬 Code Graph Analysis (1)
tests/steps/manifest_steps.rs (2)
tests/ast_tests.rs (1)
  • parse_manifest (8-10)
src/manifest.rs (1)
  • from_path (44-49)
🔇 Additional comments (20)
Cargo.toml (1)

11-11: Remove the suggested feature override for anyhow. The crate’s default features include only std and backtrace is opt-in, so disabling defaults and re-enabling std is redundant.

Likely an incorrect or invalid review comment.

src/lib.rs (1)

6-9: Confirm module-level doc comment in src/manifest.rs

Leading //! header verified in the first 5 lines of src/manifest.rs. No action required.

tests/data/invalid_version.yml (1)

1-7: LGTM - Valid test fixture for invalid version scenario.

The fixture correctly demonstrates an invalid netsuke_version format ("1" instead of semantic versioning like "1.0.0") for testing parser validation logic.

tests/data/unknown_field.yml (1)

1-8: LGTM - Valid test fixture for unknown field scenario.

The fixture correctly includes an extra field that should trigger serde's deny_unknown_fields validation during parsing.

docs/roadmap.md (1)

27-28: LGTM - Roadmap updates accurately reflect completed tasks.

The marked items correctly correspond to the implemented manifest parsing functionality with semver validation and YAML deserialisation logic.

Also applies to: 35-36

tests/features/manifest.feature (1)

21-36: LGTM - Comprehensive test coverage for manifest parsing scenarios.

The new scenarios effectively cover both positive (rules parsing) and negative (unknown fields, invalid versions, missing recipes) test cases, providing thorough validation of the manifest parsing functionality.

tests/steps/manifest_steps.rs (3)

5-5: LGTM - Import updated to include manifest module.

The import correctly adds the manifest module to support the refactored parsing logic.


13-13: LGTM - Refactored to use centralised manifest parsing.

The change from manual file reading and YAML deserialisation to manifest::from_path improves code maintainability and ensures consistent error handling across the codebase.


75-84: LGTM - New test step supports expanded feature scenarios.

The first_rule_name step function correctly implements the assertion logic for verifying rule names in parsed manifests, supporting the new BDD scenarios.

src/manifest.rs (3)

1-6: Module documentation follows coding guidelines correctly.

The module begins with //! doc comments as required and clearly explains the module's purpose and utility. The documentation is concise and follows en-GB spelling conventions.


7-9: Import organisation is clean and appropriate.

The imports are minimal and focused, bringing in only the necessary dependencies for the module's functionality.


30-49: File loading function is well-implemented with proper error context.

The from_path function correctly handles file I/O errors with meaningful context using with_context. The path handling using AsRef<Path> is idiomatic and flexible. The function properly chains the file reading with the YAML parsing through from_str.

docs/netsuke-design.md (2)

596-600: Documentation accurately reflects the new manifest parsing functionality.

The text correctly describes the convenience functions in src/manifest.rs and their return type (anyhow::Result). The description of "straightforward error handling" aligns with the implementation. The British spelling of "artefacts" is correct per the coding guidelines.


607-610: Testing section update is comprehensive and accurate.

The documentation correctly describes the new test fixtures under tests/data/ and their usage in the test suite. The mention of both valid and invalid permutations aligns with the actual test files, and the description of using the new parsing API instead of direct serde_yml calls is accurate.

tests/ast_tests.rs (6)

3-3: Import update is correct and minimal.

The addition of the manifest module to the imports is appropriate and necessary for the updated test functionality.


7-10: Test helper function updated correctly.

The parse_manifest helper now properly delegates to manifest::from_str and returns anyhow::Result<NetsukeManifest>, which aligns with the new API. The function maintains its role as a convenience wrapper whilst adopting the new error handling approach.


21-21: All existing tests updated to use new manifest API consistently.

The systematic replacement of direct serde_yml calls with manifest::from_str throughout the test suite is thorough and correct. This ensures all tests benefit from the improved error handling and consistency provided by the new manifest module.

Also applies to: 51-51, 56-56, 65-65, 79-79, 90-90, 99-99, 108-108, 121-121, 139-139, 155-155, 181-181, 202-202, 247-247, 260-260


362-375: File loading tests provide good coverage of the new functionality.

The tests for manifest::from_path correctly verify both successful loading and error handling for missing files. The tests appropriately use expect for successful cases and verify error conditions for failures.


377-389: Parameterised tests efficiently cover multiple manifest examples.

The use of rstest to parameterise tests for different manifest files is excellent. The test verifies that different manifest types can be loaded and that their first target names match expectations, providing good coverage with minimal code duplication.


391-399: Invalid manifest tests ensure proper error handling.

The parameterised tests for invalid manifests correctly verify that parsing fails for various error conditions. This provides important coverage for the error handling paths in the manifest parsing code.

Comment thread src/manifest.rs
@leynos leynos merged commit f4214e9 into main Jul 26, 2025
2 checks passed
@leynos leynos deleted the codex/implement-yaml-parsing-for-netsukemanifest branch July 26, 2025 14:19
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