Skip to content

Conversation

@SatyendraGollaFacets
Copy link

@SatyendraGollaFacets SatyendraGollaFacets commented Jul 14, 2025

This PR introduces schema validation for the iac block in facets.yaml, adds corresponding tests, and updates the documentation with usage instructions.

Summary by CodeRabbit

  • Documentation
    • Added a new section to the README explaining how to manage new Terraform files generated by the MCP server in the configuration.
  • New Features
    • Introduced support for an "iac" block with a "validated_files" list in the configuration schema.
  • Tests
    • Added unit tests to validate the structure and content of the "iac" block and its "validated_files" property in configuration files.

@coderabbitai
Copy link

coderabbitai bot commented Jul 14, 2025

Walkthrough

A new "iac" block with a "validated_files" array property was added to the YAML schema and documented in the README. The README now instructs users to add new MCP server-generated Terraform files to this list. Unit tests were introduced to validate the structure and error handling for the "iac" block in the YAML configuration.

Changes

File(s) Change Summary
README.md Added documentation for the "iac" block and instructions for handling MCP server-generated .tf files.
ftf_cli/schema.py Added "iac" object with "validated_files" array property to the YAML schema.
tests/test_utils_validation.py Introduced tests for validating the "iac" block and its "validated_files" property in the YAML config.

Poem

In the warren of code, a new block appears,
"iac" hops in, putting schema in gear.
Validated files, now listed with care,
Terraform bunnies, aware and prepared!
With tests to ensure our configs stay neat,
This update’s a treat—oh, what a feat!
🐇✨

✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 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 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

@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: 0

🧹 Nitpick comments (3)
ftf_cli/schema.py (1)

97-106: Schema structure looks good, but consider adding title and description fields.

The iac property is well-defined as an object with a validated_files array of strings. The additionalProperties: True allows for future extensibility, which is good design.

However, for consistency with other top-level properties and better documentation, consider adding title and description fields:

 "iac": {
     "type": "object",
+    "title": "Infrastructure as Code Configuration",
+    "description": "Configuration for IaC-related settings and file validation",
     "properties": {
         "validated_files": {
             "type": "array",
+            "title": "Validated Files",
+            "description": "List of Terraform files that have been validated by the MCP server",
             "items": {"type": "string"}
         }
     },
     "additionalProperties": True
 },
README.md (1)

413-425: Good documentation, but specify the language for the fenced code block.

The documentation clearly explains when and how to use the iac.validated_files configuration. The example is helpful and shows the expected structure well.

Apply this fix to specify the language for the fenced code block:

 Any new tf file created by the mcp server needs to be added to `facets.yaml` in this block:

-```
+```yaml
 iac:
   validated_files:
     - variables.tf
     - tekton.tf
     # ...add any new files here

</blockquote></details>
<details>
<summary>tests/test_utils_validation.py (1)</summary><blockquote>

`4-7`: **Remove unused imports to clean up the code.**

The imports `os`, `tempfile`, and `yaml` are not used in the test code and should be removed for cleaner code.

```diff
 import pytest
 import click
 from ftf_cli.utils import check_no_array_or_invalid_pattern_in_spec, check_conflicting_ui_properties
-import os
-import tempfile
-import yaml
 from ftf_cli.utils import validate_yaml
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 8885f24 and 3882282.

📒 Files selected for processing (3)
  • README.md (1 hunks)
  • ftf_cli/schema.py (1 hunks)
  • tests/test_utils_validation.py (2 hunks)
🧰 Additional context used
🧠 Learnings (2)
ftf_cli/schema.py (1)
Learnt from: vishnukv-facets
PR: Facets-cloud/module-development-cli#0
File: :0-0
Timestamp: 2025-05-26T13:13:07.039Z
Learning: All user-facing properties in spec must have both 'title' and 'description' fields. Properties with 'x-ui-override-disable': true are considered internal and skip this validation, while properties with 'x-ui-overrides-only': true are still user-facing and require validation. This is enforced by the check_properties_have_required_fields() function in ftf_cli/utils.py.
tests/test_utils_validation.py (1)
Learnt from: vishnukv-facets
PR: Facets-cloud/module-development-cli#0
File: :0-0
Timestamp: 2025-05-26T13:13:07.039Z
Learning: All user-facing properties in spec must have both 'title' and 'description' fields. Properties with 'x-ui-override-disable': true are considered internal and skip this validation, while properties with 'x-ui-overrides-only': true are still user-facing and require validation. This is enforced by the check_properties_have_required_fields() function in ftf_cli/utils.py.
🧬 Code Graph Analysis (1)
tests/test_utils_validation.py (1)
ftf_cli/utils.py (1)
  • validate_yaml (421-449)
🪛 markdownlint-cli2 (0.17.2)
README.md

417-417: Fenced code blocks should have a language specified

(MD040, fenced-code-language)

🪛 Ruff (0.11.9)
tests/test_utils_validation.py

4-4: os imported but unused

Remove unused import: os

(F401)


5-5: tempfile imported but unused

Remove unused import: tempfile

(F401)


6-6: yaml imported but unused

Remove unused import: yaml

(F401)

🔇 Additional comments (1)
tests/test_utils_validation.py (1)

253-316: Excellent test coverage for the new iac block validation.

The test suite comprehensively covers all validation scenarios for the iac block:

  1. ✅ Valid iac block with proper structure
  2. ✅ Invalid iac field (not an object)
  3. ✅ Invalid validated_files (not an array)
  4. ✅ Invalid validated_files elements (non-strings)

The tests use consistent data structures, proper error assertions, and follow good testing practices. The test names are descriptive and the error message assertions ensure proper validation behavior.

README.md Outdated
- aws_security_group.sg (with for_each)
```

## Note on MCP Server Generated Files
Copy link
Contributor

Choose a reason for hiding this comment

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

We don't need this in the README, you can remove this

@anujhydrabadi anujhydrabadi merged commit bfde8a8 into main Jul 14, 2025
6 checks passed
@anujhydrabadi anujhydrabadi deleted the iac-schema-validation branch July 14, 2025 09:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants