Skip to content

Conversation

@gmazoyer
Copy link
Contributor

@gmazoyer gmazoyer commented Sep 22, 2025

Summary by CodeRabbit

  • New Features

    • Added support for an optional “display label” on schemas, allowing clearer, user-friendly labels without impacting existing behavior. Backward compatible.
  • Tests

    • Updated unit tests and fixtures to cover the new display label field and ensure compatibility.

@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Sep 22, 2025

Deploying infrahub-sdk-python with  Cloudflare Pages  Cloudflare Pages

Latest commit: 54c6624
Status: ✅  Deploy successful!
Preview URL: https://e27c8bc6.infrahub-sdk-python.pages.dev
Branch Preview URL: https://gma-20250922-ifc1820.infrahub-sdk-python.pages.dev

View logs

@coderabbitai
Copy link

coderabbitai bot commented Sep 22, 2025

Walkthrough

The change adds an optional field display_label: str | None = None to BaseSchema in infrahub_sdk/schema/main.py. Test data in tests/unit/sdk/conftest.py updates the rfile_schema fixture, renaming the key from display_label to display_labels. This expands the BaseSchema’s attributes while adjusting the fixture input shape used in tests. No other logic, function signatures, or modules are modified in the described diff.

Pre-merge checks and finishing touches

❌ Failed checks (2 warnings)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
Title Check ⚠️ Warning The title “IHS-163 Add required change for IFC-1820 (display_label)” references internal ticket numbers and uses the vague phrase “required change,” which obscures the actual update of adding an optional display_label field to the BaseSchema. While it mentions display_label, it does not clearly and concisely describe the main change in a way that teammates scanning history would immediately understand. The inclusion of multiple ticket IDs and the generic wording reduce clarity and focus. Please simplify the title to directly state the change, for example: “Add optional display_label field to BaseSchema,” removing internal ticket references and vague terms to improve clarity and conciseness.
✅ Passed checks (1 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
✨ Finishing touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch gma-20250922-ifc1820

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
🧪 Early access (Sonnet 4.5): enabled

We are currently testing the Sonnet 4.5 model, which is expected to improve code review quality. However, this model may lead to increased noise levels in the review comments. Please disable the early access features if the noise level causes any inconvenience.

Note:

  • Public repositories are always opted into early access features.
  • You can enable or disable early access features from the CodeRabbit UI or by updating the CodeRabbit configuration file.

Comment @coderabbitai help to get the list of available commands and usage tips.

@codecov
Copy link

codecov bot commented Sep 22, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.

@@                 Coverage Diff                  @@
##           infrahub-develop     #556      +/-   ##
====================================================
- Coverage             75.97%   75.73%   -0.25%     
====================================================
  Files                   100      100              
  Lines                  9345     8946     -399     
  Branches               1835     1757      -78     
====================================================
- Hits                   7100     6775     -325     
+ Misses                 1754     1689      -65     
+ Partials                491      482       -9     
Flag Coverage Δ
integration-tests 34.86% <0.00%> (-1.32%) ⬇️
python-3.10 48.30% <0.00%> (-1.30%) ⬇️
python-3.11 48.30% <0.00%> (-1.28%) ⬇️
python-3.12 48.25% <0.00%> (-1.33%) ⬇️
python-3.13 48.25% <0.00%> (-1.33%) ⬇️
python-3.9 46.89% <0.00%> (-1.12%) ⬇️
python-filler-3.12 25.07% <100.00%> (+0.76%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
infrahub_sdk/schema/main.py 89.49% <100.00%> (+0.03%) ⬆️

... and 8 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@gmazoyer gmazoyer marked this pull request as ready for review September 26, 2025 12:01
@gmazoyer gmazoyer requested a review from a team September 26, 2025 12:01
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 (2)
infrahub_sdk/schema/main.py (1)

270-271: New display_label field looks fine; clarify precedence vs display_labels.

With both display_label (str|None) and display_labels (list[str]|None), consumers may be unsure which to use when both are set. Please confirm intended precedence and consider exposing a normalized accessor.

Suggested helper (non-breaking):

# Inside BaseSchema
@property
def effective_display_labels(self) -> list[str] | None:
    if self.display_labels:
        return self.display_labels
    if self.display_label:
        return [self.display_label]
    return None

Alternatively, document that display_label is a backward‑compat input and display_labels is canonical.

Reference: infrahub_sdk/protocols_base.py Line 29 indicates a display_label on instances, which is distinct from schema but similar naming may confuse readers.

tests/unit/sdk/conftest.py (1)

823-823: Verify the path used in display_labels.

You set display_labels to ["label__value"] for TransformJinja2, but the fixture’s attributes don’t define a label attribute. Is this intended (e.g., inherited attribute) or should it be ["name__value"] like other schemas?

If it’s a typo, apply:

-        "display_labels": ["label__value"],
+        "display_labels": ["name__value"],
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 0a1d3eb and 54c6624.

📒 Files selected for processing (2)
  • infrahub_sdk/schema/main.py (1 hunks)
  • tests/unit/sdk/conftest.py (1 hunks)
🧰 Additional context used
📓 Path-based instructions (3)
**/*.py

📄 CodeRabbit inference engine (CLAUDE.md)

When implementing Infrahub checks, subclass InfrahubCheck and override validate(data); do not implement or rely on a check() method

Files:

  • infrahub_sdk/schema/main.py
  • tests/unit/sdk/conftest.py
tests/unit/**/*.py

📄 CodeRabbit inference engine (CLAUDE.md)

Place and write unit tests under tests/unit/ (isolated component tests)

Files:

  • tests/unit/sdk/conftest.py
tests/**/*.py

📄 CodeRabbit inference engine (CLAUDE.md)

Use the custom pytest plugin (infrahub_sdk.pytest_plugin) fixtures for clients, configuration, and Infrahub-specific testing

Files:

  • tests/unit/sdk/conftest.py
🧬 Code graph analysis (1)
infrahub_sdk/schema/main.py (1)
infrahub_sdk/protocols_base.py (1)
  • display_label (30-30)

@gmazoyer gmazoyer changed the title Add required change for IFC-1820 (display_label) IHS-163 Add required change for IFC-1820 (display_label) Sep 30, 2025
@gmazoyer gmazoyer merged commit f7b39f0 into infrahub-develop Oct 7, 2025
20 checks passed
@gmazoyer gmazoyer deleted the gma-20250922-ifc1820 branch October 7, 2025 11:38
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.

2 participants