Skip to content

IHS-75: Fix cardinality many error message#1044

Open
solababs wants to merge 2 commits into
stablefrom
sb-25052026-fix-cardinality-many-error-ihs-75
Open

IHS-75: Fix cardinality many error message#1044
solababs wants to merge 2 commits into
stablefrom
sb-25052026-fix-cardinality-many-error-ihs-75

Conversation

@solababs
Copy link
Copy Markdown
Contributor

@solababs solababs commented May 25, 2026

Why

Improve error message now names the relationship, states that a list is required, and shows the correction.

Closes #174

Checklist

  • Tests added/updated

Summary by cubic

Improves the error shown when a single value is passed to a cardinality-many relationship. The message now names the relationship, says a list is required, shows the received type, and gives an example fix (e.g., tags=[value]).

  • Bug Fixes
    • Update relationship.py to raise a clear ValueError in both async and sync constructors when non-list data is provided to a many relationship.
    • Add unit tests to confirm single values are rejected and lists are accepted.

Written for commit 329c647. Summary will update on new commits. Review in cubic

@solababs solababs requested a review from a team as a code owner May 25, 2026 11:24
@cloudflare-workers-and-pages
Copy link
Copy Markdown

Deploying infrahub-sdk-python with  Cloudflare Pages  Cloudflare Pages

Latest commit: 329c647
Status: ✅  Deploy successful!
Preview URL: https://5ebfa5af.infrahub-sdk-python.pages.dev
Branch Preview URL: https://sb-25052026-fix-cardinality.infrahub-sdk-python.pages.dev

View logs

Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-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.

No issues found across 3 files

Re-trigger cubic

@codecov
Copy link
Copy Markdown

codecov Bot commented May 25, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

@@            Coverage Diff             @@
##           stable    #1044      +/-   ##
==========================================
+ Coverage   81.54%   81.58%   +0.03%     
==========================================
  Files         134      134              
  Lines       11468    11468              
  Branches     1735     1735              
==========================================
+ Hits         9352     9356       +4     
+ Misses       1569     1567       -2     
+ Partials      547      545       -2     
Flag Coverage Δ
integration-tests 41.71% <0.00%> (ø)
python-3.10 54.60% <100.00%> (+0.01%) ⬆️
python-3.11 54.62% <100.00%> (+0.03%) ⬆️
python-3.12 54.60% <100.00%> (+0.01%) ⬆️
python-3.13 54.60% <100.00%> (+0.01%) ⬆️
python-3.14 54.61% <100.00%> (+0.03%) ⬆️
python-filler-3.12 22.67% <0.00%> (ø)

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

Files with missing lines Coverage Δ
infrahub_sdk/node/relationship.py 81.86% <100.00%> (+2.19%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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.

bug: confusing error message when you provide a single node as argument for a relationship of cardinality many

1 participant