Skip to content

Conversation

@vishnukv-facets
Copy link
Contributor

@vishnukv-facets vishnukv-facets commented May 24, 2025

  • Introduced a new function check_properties_have_required_fields to ensure that all user-facing properties in the spec have both title and description fields.
  • Updated the validate_yaml function to include this new validation check.
  • Added comprehensive unit tests to cover various scenarios, including missing title, description, and both fields, as well as handling of override-disabled properties.

Summary by CodeRabbit

  • New Features
    • Enhanced schema validation to ensure all user-facing properties include both a title and description, improving documentation standards.
  • Tests
    • Expanded test coverage for validation functions, including nested properties, override flags, and error handling for missing or empty fields.

@vishnukv-facets
Copy link
Contributor Author

this fix is because if title was not present in the spec properties UI nor the backend threw error stating title is missing and the form never rendered

@vishnukv-facets
Copy link
Contributor Author

@CodeRabbit

@coderabbitai
Copy link

coderabbitai bot commented May 26, 2025

Tip

For best results, initiate chat on the files or code changes.

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Get PR information and list of changed files
echo "=== PR Information ==="
gh pr view 48 --json title,body,files --repo Facets-cloud/module-development-cli

echo -e "\n=== Changed Files ==="
gh pr diff 48 --name-only --repo Facets-cloud/module-development-cli

echo -e "\n=== PR Diff ==="
gh pr diff 48 --repo Facets-cloud/module-development-cli

Length of output: 17752


@vishnukv-facets Thank you for the detailed explanation! I can see this is an excellent fix for a critical UX issue.

Problem you solved:

  • When spec properties were missing title or description fields, neither the UI nor backend provided clear validation errors
  • This caused forms to fail to render, leaving users confused about what went wrong

Your solution:

  • Added check_properties_have_required_fields() function that recursively validates all user-facing properties have both title and description
  • Integrated this validation into the existing validate_yaml() pipeline
  • Smart handling of different property types:
    • ✅ Validates regular properties
    • ✅ Validates x-ui-overrides-only properties (still user-facing)
    • ⏭️ Skips x-ui-override-disable properties (internal/system properties)
  • Provides clear, actionable error messages with exact property paths

Implementation quality:

  • Comprehensive test coverage (334+ lines of tests)
  • Proper error messaging that guides users to the exact issue
  • Recursive validation for nested object properties
  • Clean integration with existing validation system

This will significantly improve the developer experience by catching these issues early with clear feedback instead of silent form rendering failures.


✏️ Learnings added
Learnt from: vishnukv-facets
URL: https://github.com/Facets-cloud/module-development-cli/pull/48

Timestamp: 2025-05-26T13:13:07.010Z
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.

Note: Learnings are effective only in the context of similar code segments. To apply general coding guidelines, please configure review instructions. You can manage existing learnings in the app.

@vishnukv-facets
Copy link
Contributor Author

@CodeRabbit full review

@coderabbitai
Copy link

coderabbitai bot commented May 26, 2025

✅ Actions performed

Full review triggered.

@coderabbitai
Copy link

coderabbitai bot commented May 26, 2025

"""

Walkthrough

A new recursive validation function is introduced to ensure that all properties in a schema have both title and description fields unless explicitly excluded by an override flag. This check is integrated into the YAML validation process. Comprehensive tests are added to verify correct enforcement and handling of override flags and nested properties.

Changes

File(s) Change Summary
ftf_cli/utils.py Added check_properties_have_required_fields for recursive property validation; integrated into validate_yaml.
tests/test_utils_validation.py Added extensive tests for property field validation, including override flags, nesting, and error handling.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant CLI
    participant Utils

    User->>CLI: Run YAML validation command
    CLI->>Utils: validate_yaml(spec_obj)
    Utils->>Utils: Schema validation
    Utils->>Utils: check_properties_have_required_fields(spec_obj)
    alt All properties valid
        Utils-->>CLI: Validation passes
    else Missing title/description
        Utils-->>CLI: Raise click.UsageError
    end
    CLI-->>User: Output result or error
Loading

Poem

In the warren of code, we now inspect,
Each property’s title and description we must detect.
If an override flag says “hop along,”
We skip that field and move right on.
With tests that burrow deep and wide,
Our validation’s now bona fide!
🐇✨
"""


📜 Recent review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 6a6e732 and 3236cba.

📒 Files selected for processing (1)
  • ftf_cli/utils.py (3 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • ftf_cli/utils.py
✨ Finishing Touches
  • 📝 Generate Docstrings

🪧 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: 2

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between e912811 and 8343be6.

📒 Files selected for processing (2)
  • ftf_cli/utils.py (2 hunks)
  • tests/test_utils_validation.py (2 hunks)
🧰 Additional context used
🧠 Learnings (2)
ftf_cli/utils.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.010Z
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.

- Introduced a new function `check_properties_have_required_fields` to ensure that all user-facing properties in the spec have both title and description fields.
- Updated the `validate_yaml` function to include this new validation check.
- Added comprehensive unit tests to cover various scenarios, including missing title, description, and both fields, as well as handling of override-disabled properties.
… objects

- Updated `check_properties_have_required_fields` to include a `skip_validation` parameter, allowing validation to be skipped for properties marked with `x-ui-override-disable`.
- Added a new test case to ensure that nested properties under override-disabled objects are correctly skipped during validation.
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