Skip to content

refactor(processors): centralize dry-run diff in AbstractProcessor - #1353

Merged
amimas merged 9 commits into
gitlabform:mainfrom
rickbrouwer:diff-logic
Aug 16, 2026
Merged

amimas merged 9 commits into
gitlabform:mainfrom
rickbrouwer:diff-logic

Conversation

@rickbrouwer

Copy link
Copy Markdown
Collaborator

Four processors carried near-identical _print_diff implementations (project_settings, merge_requests_approvals, project_security_settings, project_variables). This pulls the shared flow into AbstractProcessor and removes the TODO in merge_requests_approvals.py.

@rickbrouwer
rickbrouwer temporarily deployed to Integrate Pull Request July 11, 2026 14:06 — with GitHub Actions Inactive
@rickbrouwer
rickbrouwer temporarily deployed to Integrate Pull Request July 11, 2026 14:06 — with GitHub Actions Inactive
@rickbrouwer rickbrouwer changed the title WIP refactor(processors): centralize dry-run diff in AbstractProcessor refactor(processors): centralize dry-run diff in AbstractProcessor Jul 11, 2026
@rickbrouwer
rickbrouwer marked this pull request as ready for review July 11, 2026 14:45
Comment thread gitlabform/processors/abstract_processor.py Outdated
Signed-off-by: Rick Brouwer <[email protected]>
@rickbrouwer
rickbrouwer temporarily deployed to Integrate Pull Request July 14, 2026 18:43 — with GitHub Actions Inactive
@rickbrouwer
rickbrouwer temporarily deployed to Integrate Pull Request July 14, 2026 18:43 — with GitHub Actions Inactive

@amimas amimas left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks for looking into this @rickbrouwer . I think overall direction/structure is fine. Not sure if it's just me, but is it possible to make the change/logic for this a bit more easy to follow in the abstract processor?

I'm also wondering whether the abstract processor's __init__ function call the subclass function and save it as entity_in_gitlab. I think there are other areas where this can be used in future for reducing some of the boilerplates from the subclasses in future.

Comment thread gitlabform/processors/abstract_processor.py Outdated
@rickbrouwer

rickbrouwer commented Jul 19, 2026 •

Copy link
Copy Markdown
Collaborator Author

Thanks for looking into this @rickbrouwer . I think overall direction/structure is fine. Not sure if it's just me, but is it possible to make the change/logic for this a bit more easy to follow in the abstract processor?

I'm also wondering whether the abstract processor's __init__ function call the subclass function and save it as entity_in_gitlab. I think there are other areas where this can be used in future for reducing some of the boilerplates from the subclasses in future.

Yeah. Will refactor the extension mechanism to the template method pattern.

Signed-off-by: Rick Brouwer <[email protected]>
@rickbrouwer
rickbrouwer had a problem deploying to Integrate Pull Request July 19, 2026 07:53 — with GitHub Actions Error
@rickbrouwer
rickbrouwer had a problem deploying to Integrate Pull Request July 19, 2026 07:53 — with GitHub Actions Error
@rickbrouwer
rickbrouwer temporarily deployed to Integrate Pull Request July 19, 2026 08:38 — with GitHub Actions Inactive
@rickbrouwer
rickbrouwer temporarily deployed to Integrate Pull Request July 19, 2026 08:38 — with GitHub Actions Inactive
Comment thread gitlabform/processors/abstract_processor.py
Signed-off-by: Rick Brouwer <[email protected]>
@rickbrouwer
rickbrouwer temporarily deployed to Integrate Pull Request August 9, 2026 11:47 — with GitHub Actions Inactive
@rickbrouwer
rickbrouwer temporarily deployed to Integrate Pull Request August 9, 2026 11:47 — with GitHub Actions Inactive

@amimas amimas left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I think the latest update looks really good @rickbrouwer . Thanks for keep working on it. Left couple of minor comments.

Just one thing stands out I think that might need a bit more clarification. Does the raw responses from python-gitlab contain read-only API fields (id, created_at, project_id, _links, etc.). If _get_current_state returns raw API objects while _get_desired_state returns clean YAML data from gitlabform config, then _print_diff will show every extra API field as a "deletion" or "modification."

Comment thread gitlabform/processors/project/project_security_settings.py Outdated
Comment thread gitlabform/processors/project/project_variables_processor.py
Comment thread gitlabform/processors/abstract_processor.py
Signed-off-by: Rick Brouwer <[email protected]>
@amimas
amimas temporarily deployed to Integrate Pull Request August 16, 2026 14:46 — with GitHub Actions Inactive
@amimas
amimas temporarily deployed to Integrate Pull Request August 16, 2026 14:46 — with GitHub Actions Inactive

@amimas amimas left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks again for working on this @rickbrouwer . I feel this will make it really easy for other proecessors to consume this and show drift/diff in the dry-run.

@amimas
amimas enabled auto-merge (squash) August 16, 2026 14:48
@amimas
amimas merged commit 9ab386c into gitlabform:main Aug 16, 2026
23 checks passed
@rickbrouwer
rickbrouwer deleted the diff-logic branch August 16, 2026 15:08

This branch was previously deployed

1 inactive deployment
Integrate Pull Request — 56f9edea Deployed Aug 16, 2026 by amimas via Acceptance Tests / GitLab Ultimate #184
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