Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Nov 12, 2025

Purpose

Remove the redundant default_bump_level configuration option from conventional-commit, scipy, and emoji parsers. The option duplicates functionality already provided by explicit commit type to bump level mappings.

Rationale

Each parser's tag_to_level mapping already defines bump levels for all recognized commit types. The default_bump_level was only used as a fallback in zip_longest operations during map construction—a confusing indirection that obscured actual behavior. Removing it eliminates configuration complexity without changing semantics: unrecognized commit types now explicitly receive LevelBump.NO_RELEASE instead of a configurable default.

Before:

# scipy.py
default_level_bump: LevelBump = LevelBump.NO_RELEASE
# ...
*zip_longest(self.allowed_tags, (), fillvalue=self.default_bump_level)

After:

# scipy.py - no field, direct constant
*zip_longest(self.allowed_tags, (), fillvalue=LevelBump.NO_RELEASE)

How did you test?

  • Updated existing test that relied on default_bump_level to verify NO_RELEASE behavior
  • Added unit tests confirming parsers handle commits with other_allowed_tags correctly
  • Verified 4238 unit tests pass

How to Verify

Run the test suite:

pytest -m unit

Check that parsers correctly assign NO_RELEASE to unmatched commit types without configuration errors.


PR Completion Checklist

  • Reviewed & followed the Contributor Guidelines

  • Changes Implemented & Validation pipeline succeeds

  • Commits follow the Conventional Commits standard
    and are separated into the proper commit type and scope (recommended order: test, build, feat/fix, docs)

  • Appropriate Unit tests added/updated

  • Appropriate End-to-End tests added/updated

  • Appropriate Documentation added/updated and syntax validated for sphinx build (see Contributor Guidelines)


BREAKING CHANGE: The default_bump_level option has been removed from conventional-commit, scipy, and emoji parser configurations. Remove this option from your pyproject.toml if present. Behavior unchanged: unrecognized commit types receive NO_RELEASE.

Closes #1293, #700

Original prompt

Remove the commit_parser_options.default_bump_level setting from the three commit parsers in the python-semantic-release repository: conventional-commit, scipy, and emoji. Create a single PR targeting branch 'master' that implements the following changes.

Scope of work (detailed and actionable):

  1. Search & Locate
  • Find all occurrences of the strings default_bump_level and commit_parser_options.default_bump_level across the repository and list the files touched.
  • Identify the three parser implementations (conventional-commit, scipy, emoji), their default option construction, registrations, and any docs or config schema referencing the option.
  1. Code changes
  • Remove any explicit default_bump_level keys from parser default option dicts, dataclasses, or pydantic models for the three parsers.
  • If any code expects the key to exist (direct dict access or attribute access), change the access to use .get("default_bump_level") or optional attribute access and treat missing value as None. Ensure no behavioral change beyond removing the explicit default.
  • Ensure bump resolution logic falls back to existing mechanisms (explicit mappings, commit type/emoji mapping, etc.). Do not introduce new bump-resolution logic.
  • Update any parser factories or entry-point registration that provide this option.
  1. Tests
  • Run unit tests and e2e tests locally via the repository's recommended commands (use ruff, mypy, pytest -m unit, pytest -m e2e where appropriate) to find failing tests.
  • Update tests that reference default_bump_level so they no longer rely on it; instead assert that parsers operate correctly when the option is absent.
  • Add a small unit test per parser to assert parser behavior when commit_parser_options does not include default_bump_level (parser doesn't crash and bump decisions are as expected based on existing mapping rules).
  1. Docs & Schema
  • Update configuration schema (pydantic models or JSON schema) and user docs to remove default_bump_level references for the three parsers.
  • Update any examples in docs showing usage of default_bump_level.
  1. Lint & Type checks
  • Run ruff format and ruff check --unsafe-fixes, mypy . and fix any type/lint errors introduced.
  1. Commits & PR
  • Create branch: brk/remove-default-bump-level-from-parsers (branch should be created from master as requested). If 'brk/' prefix conflicts with repo conventions, still use it exactly as requested.
  • Commit changes in logical units (one commit per parser removal + tests + docs) with conventional commit messages and mark as breaking change where appropriate.
  • Final commit message for the PR: "refactor(parsers)!: remove default_bump_level from commit parsers"
  • The PR body should include:
  • Open a single pull request against the master branch.

Constraints and safety notes:

  • Only touch the three parsers: conventional-commit, scipy, emoji. If default_bump_level is referenced elsewhere, do not remove it there; instead, report locations in PR and ask for guidance.
  • Preserve all other behavior; do not change default bump resolution semantics beyond removing this explicit config option.
  • Keep code style consistent with project (ruff, mypy) and tests passing.

Deliverables (what to include in the PR):

Local commands the agent will run as part of the work (examples):

  • git checkout -b brk/remove-default-bump-level-from-parsers master
  • git grep -n "default_bump_level" || true
  • apply code changes
  • ruff format .
  • ruff check --unsafe-fixes .
  • mypy .
  • pytest -m unit
  • pytest -m e2e

Repository: python-semantic-release/python-semantic-release
Target branch (base_ref): master

Note: This is an engineering change that will produce a pull request with code, tests and docs updates. Follow repository contribution rules and run the suggested local checks to ensure the PR is clean.

This pull request was created as a result of the following prompt from Copilot chat.

Remove the commit_parser_options.default_bump_level setting from the three commit parsers in the python-semantic-release repository: conventional-commit, scipy, and emoji. Create a single PR targeting branch 'master' that implements the following changes.

Scope of work (detailed and actionable):

  1. Search & Locate
  • Find all occurrences of the strings default_bump_level and commit_parser_options.default_bump_level across the repository and list the files touched.
  • Identify the three parser implementations (conventional-commit, scipy, emoji), their default option construction, registrations, and any docs or config schema referencing the option.
  1. Code changes
  • Remove any explicit default_bump_level keys from parser default option dicts, dataclasses, or pydantic models for the three parsers.
  • If any code expects the key to exist (direct dict access or attribute access), change the access to use .get("default_bump_level") or optional attribute access and treat missing value as None. Ensure no behavioral change beyond removing the explicit default.
  • Ensure bump resolution logic falls back to existing mechanisms (explicit mappings, commit type/emoji mapping, etc.). Do not introduce new bump-resolution logic.
  • Update any parser factories or entry-point registration that provide this option.
  1. Tests
  • Run unit tests and e2e tests locally via the repository's recommended commands (use ruff, mypy, pytest -m unit, pytest -m e2e where appropriate) to find failing tests.
  • Update tests that reference default_bump_level so they no longer rely on it; instead assert that parsers operate correctly when the option is absent.
  • Add a small unit test per parser to assert parser behavior when commit_parser_options does not include default_bump_level (parser doesn't crash and bump decisions are as expected based on existing mapping rules).
  1. Docs & Schema
  • Update configuration schema (pydantic models or JSON schema) and user docs to remove default_bump_level references for the three parsers.
  • Update any examples in docs showing usage of default_bump_level.
  1. Lint & Type checks
  • Run ruff format and ruff check --unsafe-fixes, mypy . and fix any type/lint errors introduced.
  1. Commits & PR
  • Create branch: brk/remove-default-bump-level-from-parsers (branch should be created from master as requested). If 'brk/' prefix conflicts with repo conventions, still use it exactly as requested.
  • Commit changes in logical units (one commit per parser removal + tests + docs) with conventional commit messages and mark as breaking change where appropriate.
  • Final commit message for the PR: "refactor(parsers)!: remove default_bump_level from commit parsers"
  • The PR body should include:
  • Open a single pull request against the master branch.

Constraints and safety notes:

  • Only touch the three parsers: conventional-commit, scipy, emoji. If default_bump_level is referenced elsewhere, do not remove it there; instead, report locations in PR and ask for guidance.
  • Preserve all other behavior; do not change default bump resolution semantics beyond removing this explicit config option.
  • Keep code style consistent with project (ruff, mypy) and tests passing.

Deliverables (what to include in the PR):

Local commands the agent will run as part of the work (examples):

  • git checkout -b brk/remove-default-bump-level-from-parsers master
  • git grep -n "default_bump_level" || true
  • apply code changes
  • ruff format .
  • ruff check --unsafe-fixes .
  • mypy .
  • pytest -m unit
  • pytest -m e2e

Repository: python-semantic-release/python-semantic-release
Target branch (base_ref): master

Note: This is an engineering change that will produce a pull request with code, tests and docs updates. Follow repository contribution rules and run the suggested local checks to ensure the PR is clean.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Remove the default_bump_level setting from conventional-commit, scipy, and emoji parsers.

- Removed default_bump_level field from ConventionalCommitParserOptions
- Removed default_level_bump and default_bump_level from ScipyParserOptions
- Removed default_bump_level field from EmojiParserOptions
- Updated code to use LevelBump.NO_RELEASE directly instead of self.options.default_bump_level
- Updated tag_to_level dict construction to use LevelBump.NO_RELEASE instead of default_bump_level
- Updated tests to remove references to default_bump_level
- Added new tests to verify parsers work correctly with other_allowed_tags

BREAKING CHANGE: The `default_bump_level` configuration option has been removed from the conventional-commit, scipy, and emoji commit parsers. This option was redundant as the parser already maps commit types to bump levels. If you were using this option in your configuration, you can remove it. The parsers will now use LevelBump.NO_RELEASE for commit types not explicitly mapped to a bump level, which is the same behavior as the previous default.

Co-authored-by: codejedi365 <17354856+codejedi365@users.noreply.github.com>
Copilot AI changed the title [WIP] Remove default_bump_level setting from commit parsers refactor(parsers)!: remove default_bump_level from commit parsers Nov 12, 2025
Copilot AI requested a review from codejedi365 November 12, 2025 03:46
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.

bug: default_level_bump no longer working as expected

2 participants