Skip to content

[ci:fix] Prevent circular import in changelog bot Commitizen validation #669

Description

@pushpitkamboj

Issue Description

  • The changelog bot can fail at runtime while validating generated commit messages against the OpenWISP Commitizen rules.
  • The failure happens in generate_changelog.py when it imports OpenWispCommitizen from openwisp_utils.releaser.commitizen.
  • That module imports commitizen.cz.base, which triggers Commitizen plugin discovery.
  • Since openwisp-utils already registers OpenWispCommitizen as a commitizen.plugin entry point, Commitizen tries to import the same module again during initialization.
  • This leads to a circular import and raises an error similar to:
    • AttributeError: partially initialized module 'openwisp_utils.releaser.commitizen' has no attribute 'OpenWispCommitizen'
  • As a result, the GitHub Action for changelog generation can fail before posting the generated suggestion.
  • see https://github.com/openwisp/openwisp-controller/actions/runs/25575877428/job/75082832879

Expected behavior

  • The changelog bot should be able to reuse the OpenWISP Commitizen validation rules without triggering Commitizen plugin auto-discovery.

Proposed direction

  • Avoid normal importing of openwisp_utils.releaser.commitizen inside the changelog action.
  • Load only the plugin class and validation logic in a way that does not initialize Commitizen’s plugin registry.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions