Skip to content

feat: strategies decline with a status that names the rule that applied - #98

Merged
lesnik512 merged 1 commit into
mainfrom
feat/strategy-decline
Oct 4, 2026
Merged

lesnik512 merged 1 commit into
mainfrom
feat/strategy-decline

Conversation

@lesnik512

Copy link
Copy Markdown
Member

Closes #97.

A strategy's no-bump answer used to be one fixed status and reason per strategy, so it could say something false:

  • conventional-commits reported a valid non-bumping commit (ci: ..., docs: ...) as no_conforming_commit, "No conforming Conventional Commits type found in commit message."
  • branch-prefix reported a merge commit from an unmapped branch (Merge branch 'docs/typo' into main) as no_merge_commit, "Latest commit on default branch is not a merge commit."

BumpStrategy.decide now returns Bump | Decline(status, reason), so each rule names itself, and the use case turns a Decline into the NoBump outcome. The no_bump_status / no_bump_reason class attributes are gone, and so is Bump.NONE: a decline is now the only way to say "no bump", so a strategy can't return a value the version computation can't handle. The wire bump field still reads "none".

Strategy When Status Reason
conventional-commits subject doesn't match the grammar no_conforming_commit Commit subject is not a Conventional Commit.
conventional-commits valid commit, type not in minor_types/patch_types no_bumping_type (new) Commit type is not configured to bump.
branch-prefix not a merge commit, patch_on_non_merge_commit off no_merge_commit Latest commit on default branch is not a merge commit.
branch-prefix merge commit, no configured prefix in its subject unmapped_branch_prefix (new) Merge commit's source branch has no configured prefix.

Decisions (from the triage grilling on #97):

  • New tokens, not just new reasons. A status token never changes meaning, but new ones may be added; keeping a token that says something false isn't what "frozen" should protect. schema_version stays "1.0". action.yml maps every non-created status to no-bump, so Action users see no change. A JSON consumer matching no_conforming_commit or no_merge_commit exactly will see the new tokens for those inputs; 0.10.0's release notes will carry an Upgrading note.
  • Reasons are fixed strings. They never quote the commit type or branch prefix, which keeps reason semvertag-controlled text (see the field audit pinned in test: pin RunResult's fields so a new one forces a redaction audit #92).
  • ADR-0002 is amended in place. It called the wire "a frozen machine contract of fixed status tokens and reasons", contradicting CONTEXT.md (only status tokens frozen) and the no_tags reason rewordings already shipped in feat: read v-prefixed tags and keep their prefix on the next tag #93 and feat: say how many tags were skipped when no_tags fires on a tagged repo #95. action.yml never reads reason. The ADR now says only status tokens are frozen and reason is human-facing; the rest of its decision (renderings stay split) stands.
  • CONTEXT.md adds Decline and updates Strategy and Outcome to match.

Also updated: both strategy pages name each decline status; the provider guides mention unmapped_branch_prefix; the GitHub outputs table's no-bump description; and the action.yml comment now says "any other status" instead of keeping a second copy of every token.

Tests go through decide for each table row and through SemvertagUseCase.__call__ with a stub strategy returning a Decline (checked to fail with the mapping removed). Existing Bump.NONE assertions now assert the specific decline.

Verified with just lint-ci, just test-ci (500 passed, 100% coverage), just adr-check and just docs-build.

@lesnik512
lesnik512 merged commit 5e97dca into main Oct 4, 2026
14 checks passed
@lesnik512
lesnik512 deleted the feat/strategy-decline branch October 4, 2026 10:14
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.

conventional-commits reports a valid non-bumping commit as non-conforming

1 participant