fix(regeneration): correct exception catch and subscriber member resolution

Merged
PO
4mo ago
+175-10

Summary

Two bug fixes on the regeneration selection primitives, stacked on top of the extraction refactor (#9928).

Jira: https://opsmill.atlassian.net/browse/IFC-2908

Fixes

Repository-diff lookup caught the wrong exception (spotted by Cubic)

The issue

The repository-diff lookup helper caught NodeNotFoundError from infrahub_sdk.exceptions, but the repository lookup raises infrahub.exceptions.NodeNotFoundError โ€” an unrelated class โ€” so the except never matched. A regeneration definition referencing a repository absent from the branch diff let the exception escape and abort the artifact/generator regeneration task instead of skipping that repository. This is preexisting.

What changed

The helper now catches the exception that is actually raised and degrades to None, with unit coverage over the absent-repository path.

Subscriber members resolved to None for generator instances

The issue

The shared member mapper read subscriber.object.id, which is populated for artifact subscribers but stays None for generator instances whose object peer is only reachable through the client store.

What changed

It now resolves through subscriber.object.peer.id, so both kinds map their member and generator narrowing works instead of rerunning whole groups after a merge.

๐Ÿค– Generated with Claude Code


Summary by cubic

Fix two regeneration selection bugs: correct repository diff lookup error handling and resolve subscriber member IDs for generators. Prevents task aborts when a repo is missing and restores generator-level narrowing after merges.

  • Bug Fixes
    • Repository diff lookup now catches infrahub.exceptions.NodeNotFoundError (not infrahub_sdk.exceptions.NodeNotFoundError) and returns None when the repo is absent; avoids task failures. Unit tests cover both present and missing repos.
    • Subscriber member mapping reads subscriber.object.peer.id, skipping unresolvable peers with a warning (catches ValueError/infrahub_sdk.exceptions.NodeNotFoundError) and peers with no id; fixes None IDs for generator instances. Tests cover mapping, orphan skip, and no-id cases.