Skip to content

Merge 'stable' into 'develop' with resolved conflicts#1078

Draft
ogenstad wants to merge 4 commits into
developfrom
pog-stable-to-develop20260612
Draft

Merge 'stable' into 'develop' with resolved conflicts#1078
ogenstad wants to merge 4 commits into
developfrom
pog-stable-to-develop20260612

Conversation

@ogenstad

@ogenstad ogenstad commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

Why

Resolve merge conflict between stable and develop

What changed

  • Everything from stable
  • Resolved merge conflict in infrahub_sdk/node/attribute.py

Conflict:

<<<<<<< HEAD
        return (
            hasattr(self.value, "is_resource_pool") and self.value.is_resource_pool()
        ) or self._from_pool is not None
=======
        return (isinstance(self.value, CoreNodeBase) and self.value.is_resource_pool()) or self._from_pool is not None

    def is_unresolved_pool_attribute(self) -> bool:
        """Return True when pool-backed but no concrete scalar value is available yet.

        A pool-backed attribute is unresolved when:
        - its value is a pool node object (the pool reference itself, not an allocated scalar), or
        - its value is None and the from_pool allocation dict is set.

        An attribute whose _from_pool dict is set but whose value has already been populated
        with the allocated scalar (e.g. after a prior save) is considered resolved.
        """
        if isinstance(self.value, CoreNodeBase) and self.value.is_resource_pool():
            return True
        return self._from_pool is not None and self.value is None
>>>>>>> stable

Resolution:

    def is_from_pool_attribute(self) -> bool:
        """Check whether this attribute's value is sourced from a resource pool.

        Returns:
            True if the attribute value is a resource pool node or was explicitly allocated from a pool.

        """
        return (
            hasattr(self.value, "is_resource_pool") and self.value.is_resource_pool()
        ) or self._from_pool is not None

    def is_unresolved_pool_attribute(self) -> bool:
        """Return True when pool-backed but no concrete scalar value is available yet.

        A pool-backed attribute is unresolved when:
        - its value is a pool node object (the pool reference itself, not an allocated scalar), or
        - its value is None and the from_pool allocation dict is set.

        An attribute whose _from_pool dict is set but whose value has already been populated
        with the allocated scalar (e.g. after a prior save) is considered resolved.
        """
        if hasattr(self.value, "is_resource_pool") and self.value.is_resource_pool():
            return True
        return self._from_pool is not None and self.value is None

Summary by cubic

Fixes upsert when a node’s HFID includes a CoreNumberPool-sourced attribute and makes repository detection work in Git worktrees. Users now get a clear ValidationError instead of an opaque backend error, and CLI flows work from worktrees.

  • Bug Fixes
    • Upsert guard: when allow_upsert=True and the HFID uses a pool-backed attribute, raise ValidationError before sending a request. Adds Attribute.is_unresolved_pool_attribute() and _validate_upsert() in InfrahubNode, used by save()/create(). Docs updated and tests added. Addresses Linear IHS-119.
    • Repository: handle .git as a file (gitlink) or directory so an existing repo is opened instead of re-initialized in worktrees. Includes a new test for worktree setups.

Written for commit f219cd8. Summary will update on new commits.

Review in cubic

petercrocker and others added 4 commits May 16, 2026 15:45
GitRepoManager.initialize_repo() checked for `.git` with `.is_dir()`, which
misses git worktrees (`.git` is a file containing `gitdir: ...`). The
existing-repo branch was skipped and `Repo.init` then crashed with
`FileExistsError` trying to mkdir the gitlink file. This made `infrahubctl
transform` (and any other CLI relying on branch auto-detection) unusable from
a worktree.

Switch the check to `.exists()` — dulwich's `Repo(path)` already resolves
the gitlink to the real controldir, and `porcelain.active_branch` returns
the worktree's branch correctly.
fix(repository): detect existing repo when .git is a worktree gitlink
@github-actions github-actions Bot added the type/documentation Improvements or additions to documentation label Jun 12, 2026
@codecov

codecov Bot commented Jun 12, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

@@             Coverage Diff             @@
##           develop    #1078      +/-   ##
===========================================
- Coverage    82.25%   81.88%   -0.38%     
===========================================
  Files          135      135              
  Lines        11970    11701     -269     
  Branches      1789     1770      -19     
===========================================
- Hits          9846     9581     -265     
  Misses        1573     1573              
+ Partials       551      547       -4     
Flag Coverage Δ
integration-tests 41.63% <63.15%> (-0.82%) ⬇️
python-3.10 55.26% <68.42%> (-0.68%) ⬇️
python-3.11 55.25% <68.42%> (-0.68%) ⬇️
python-3.12 55.26% <68.42%> (-0.68%) ⬇️
python-3.13 55.26% <68.42%> (-0.68%) ⬇️
python-3.14 55.24% <68.42%> (-0.68%) ⬇️
python-filler-3.12 22.40% <15.78%> (+0.01%) ⬆️

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

Files with missing lines Coverage Δ
infrahub_sdk/node/attribute.py 100.00% <100.00%> (ø)
infrahub_sdk/node/node.py 87.42% <100.00%> (+0.53%) ⬆️
infrahub_sdk/repository.py 100.00% <100.00%> (ø)

... and 2 files with indirect coverage changes

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

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

No issues found across 9 files

Re-trigger cubic

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type/documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants