Component
Git Integration
Infrahub version
Not specified by reporter (observed via the recurring git_repositories_sync flow; traceback below).
Current Behavior
The recurring git_repositories_sync flow records each branch's commit through update_commit_value → CoreRepositoryUpdate. When a git branch still present on the remote (here description-field) maps to an Infrahub branch that has already been merged (and is therefore read-only), the mutation is rejected:
Branch 'description-field' has been merged and is read-only. No modifications are allowed.
The resulting GraphQLError is not among the exceptions collect_pending_imports isolates per branch (RepositoryError, CommitNotFoundError, GitCommandError, ValueError), and none of the enclosing frames catch it either (sync_git_repo_with_origin_and_tag_on_failure and sync_repository_from_origin catch only RepositoryError/CommitNotFoundError; sync_remote_repositories has no per-repo guard). So a single merged-but-undeleted git branch:
- aborts collection for all other branches of the same repository that cycle, and
- propagates unhandled to the top of the flow, aborting the entire flow run — every repository iterated after the failing one is skipped that cycle.
Because this is the per-minute cron and the git branch persists until deleted, the failure recurs every cycle: git-sync is effectively frozen for the affected repository (and all later-ordered repositories) until the branch is removed from the remote.
Expected Behavior
A git branch that maps to a merged/read-only Infrahub branch should not break the recurring sync. Either the sync skips recording commits for merged/read-only branches, or the read-only-branch rejection is isolated per branch (like the other per-branch failures) so the remaining branches and repositories still sync.
Steps to Reproduce
- Register a read-write
CoreRepository and let it sync.
- Create a working branch (e.g.
description-field) that exists both on the git remote and as an Infrahub branch.
- Merge that Infrahub branch (it becomes read-only) without deleting the corresponding branch on the git remote.
- Let the per-minute
git_repositories_sync flow run.
- The flow fails with the
GraphQLError above; sync for that repository (and any repository iterated after it) no longer progresses.
Additional Information
Traceback
infrahub_sdk.exceptions.GraphQLError: An error occurred while executing the GraphQL Query
mutation ($repository_id: String!, $commit: String!) {
CoreRepositoryUpdate(data: { id: $repository_id, commit: { is_protected: true, source: $repository_id, value: $commit } }) {
ok
object { commit { value } }
}
}
, [{'message': "Branch 'description-field' has been merged and is read-only. No modifications are allowed.",
'locations': [{'line': 3, 'column': 9}], 'path': ['CoreRepositoryUpdate'],
'extensions': {'code': 'UNDEFINED_ERROR', 'http_status': 400, 'data': {}}}]
File ".../infrahub/git/tasks.py", sync_remote_repositories
File ".../infrahub/git/tasks.py", sync_repository_from_origin
File ".../infrahub/git/tasks.py", sync_git_repo_with_origin_and_tag_on_failure
File ".../infrahub/git/sync.py", RepositorySyncer.sync -> collect_pending_imports
File ".../infrahub/git/repository.py", collect_pending_imports -> update_commit_value
File ".../infrahub/git/base.py", update_commit_value -> sdk.repository_update_commit
(Reporter's traceback line numbers correspond to an earlier release; the code path is unchanged on the current stable line: collect_pending_imports in backend/infrahub/git/repository.py calls update_commit_value, and the GraphQLError it raises falls outside the isolated exception tuple.)
References
Component
Git Integration
Infrahub version
Not specified by reporter (observed via the recurring
git_repositories_syncflow; traceback below).Current Behavior
The recurring
git_repositories_syncflow records each branch's commit throughupdate_commit_value→CoreRepositoryUpdate. When a git branch still present on the remote (heredescription-field) maps to an Infrahub branch that has already been merged (and is therefore read-only), the mutation is rejected:The resulting
GraphQLErroris not among the exceptionscollect_pending_importsisolates per branch (RepositoryError, CommitNotFoundError, GitCommandError, ValueError), and none of the enclosing frames catch it either (sync_git_repo_with_origin_and_tag_on_failureandsync_repository_from_origincatch onlyRepositoryError/CommitNotFoundError;sync_remote_repositorieshas no per-repo guard). So a single merged-but-undeleted git branch:Because this is the per-minute cron and the git branch persists until deleted, the failure recurs every cycle: git-sync is effectively frozen for the affected repository (and all later-ordered repositories) until the branch is removed from the remote.
Expected Behavior
A git branch that maps to a merged/read-only Infrahub branch should not break the recurring sync. Either the sync skips recording commits for merged/read-only branches, or the read-only-branch rejection is isolated per branch (like the other per-branch failures) so the remaining branches and repositories still sync.
Steps to Reproduce
CoreRepositoryand let it sync.description-field) that exists both on the git remote and as an Infrahub branch.git_repositories_syncflow run.GraphQLErrorabove; sync for that repository (and any repository iterated after it) no longer progresses.Additional Information
Traceback
(Reporter's traceback line numbers correspond to an earlier release; the code path is unchanged on the current stable line:
collect_pending_importsinbackend/infrahub/git/repository.pycallsupdate_commit_value, and theGraphQLErrorit raises falls outside the isolated exception tuple.)References