Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow useof HFID to create a related node on generic relationship #292

Merged
merged 1 commit into from
Mar 4, 2025

Conversation

LucasG0
Copy link
Contributor

@LucasG0 LucasG0 commented Mar 3, 2025

No description provided.

@LucasG0 LucasG0 marked this pull request as draft March 3, 2025 14:27
Copy link

codecov bot commented Mar 3, 2025

Codecov Report

Attention: Patch coverage is 66.66667% with 1 line in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
infrahub_sdk/node.py 66.66% 0 Missing and 1 partial ⚠️
@@            Coverage Diff             @@
##           stable     #292      +/-   ##
==========================================
+ Coverage   70.32%   70.35%   +0.03%     
==========================================
  Files          81       81              
  Lines        7507     7510       +3     
  Branches     1464     1465       +1     
==========================================
+ Hits         5279     5284       +5     
+ Misses       1846     1842       -4     
- Partials      382      384       +2     
Flag Coverage Δ
integration-tests 22.51% <66.66%> (+0.08%) ⬆️
python-3.10 45.48% <33.33%> (-0.01%) ⬇️
python-3.11 45.48% <33.33%> (-0.01%) ⬇️
python-3.12 45.48% <33.33%> (-0.01%) ⬇️
python-3.9 44.31% <33.33%> (-0.01%) ⬇️
python-filler-3.12 23.98% <0.00%> (-0.01%) ⬇️

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

Files with missing lines Coverage Δ
infrahub_sdk/testing/schemas/animal.py 97.05% <ø> (ø)
infrahub_sdk/node.py 77.84% <66.66%> (+0.25%) ⬆️

@LucasG0 LucasG0 force-pushed the lgu-set-generic-rel-with-hfid branch from 54e0880 to c9cc008 Compare March 3, 2025 15:14
@LucasG0 LucasG0 marked this pull request as ready for review March 3, 2025 16:19
@LucasG0 LucasG0 requested a review from a team March 3, 2025 16:19
@@ -255,6 +256,9 @@ def _generate_input_data(self, allocate_from_pool: bool = False) -> dict[str, An
data["id"] = self.id
elif self.hfid is not None:
data["hfid"] = self.hfid
if self._kind is not None:
# We might need `kind` for https://github.com/opsmill/infrahub/issues/4649
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think it is sustainable to add comments referencing GH issues
if we're worried about someone removing this line and breaking some piece of functionality, then we should have a unit test that covers it
for me, this seems like a simple enough change that a comment is not necessary at all

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Agree referencing issues should be either within dedicated test or for bigger changes, I'll remove this one

@@ -80,6 +80,8 @@ def schema_cat(self) -> NodeSchema:
namespace=NAMESPACE,
include_in_menu=True,
inherit_from=[TESTING_ANIMAL],
# Different hfid than Animal one, for testing https://github.com/opsmill/infrahub-sdk-python/issues/277
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd say this comment should be in the test that uses it and the test can have an assert cat_luna.hfid == ... if you're concerned about someone changing this and invalidating the test
but I don't think we can add a comment every time we alter a fixture

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Makes sense!

@LucasG0 LucasG0 force-pushed the lgu-set-generic-rel-with-hfid branch from c9cc008 to 6901418 Compare March 4, 2025 09:13
@LucasG0 LucasG0 merged commit 0988b2b into stable Mar 4, 2025
18 checks passed
@LucasG0 LucasG0 deleted the lgu-set-generic-rel-with-hfid branch March 4, 2025 09:39
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