From e96f63cb40282049be75a73b0c284ab1dac08d20 Mon Sep 17 00:00:00 2001 From: emil User Date: Wed, 26 Aug 2026 18:03:57 +0000 Subject: [PATCH] DEVX-165: fix: accept deps: as valid conventional commit type Co-authored-by: emil User --- docs/specs/DEVX-165.md | 31 ++++++++++++++++++++++++++ src/devx/ci/validate_commit_msg.py | 2 +- src/devx/config.py | 2 +- src/devx/translations.json | 14 ++++++------ tests/unit/test_config.py | 1 + tests/unit/test_validate_commit_msg.py | 1 + 6 files changed, 42 insertions(+), 9 deletions(-) create mode 100644 docs/specs/DEVX-165.md diff --git a/docs/specs/DEVX-165.md b/docs/specs/DEVX-165.md new file mode 100644 index 0000000..5f4424c --- /dev/null +++ b/docs/specs/DEVX-165.md @@ -0,0 +1,31 @@ +# DEVX-165: Accept deps: as valid conventional commit type + +## Problem +The commit validator rejects `deps:` as a conventional commit type, causing +post-merge CI failures on grm and sso-bridge repos where automated dependency +bump PRs use `deps: bump devx...` as the commit message. + +## Approach +REQ-1: Add `deps` to `CONVENTIONAL_RE` in `src/devx/config.py` +REQ-2: Update the allowed types list in the error message in + `src/devx/ci/validate_commit_msg.py` +REQ-3: Add test coverage for `deps:` type in `tests/unit/test_config.py` + and `tests/unit/test_validate_commit_msg.py` + +## Test Plan +- `make pytest-cov` passes with 100% coverage +- `make lint-all` passes + +## Deploy Plan +- Merge to master → post-merge auto-publishes new devx version +- grm and sso-bridge bump devx version to pick up the fix + +## Rollback Plan +- Revert the merge commit + +## Acceptance Criteria +- [x] REQ-1: Add `deps` to `CONVENTIONAL_RE` in `src/devx/config.py` +- [x] REQ-2: Update the allowed types list in the error message in + `src/devx/ci/validate_commit_msg.py` +- [x] REQ-3: Add test coverage for `deps:` type in `tests/unit/test_config.py` + and `tests/unit/test_validate_commit_msg.py` diff --git a/src/devx/ci/validate_commit_msg.py b/src/devx/ci/validate_commit_msg.py index 71a266d..a2424ca 100644 --- a/src/devx/ci/validate_commit_msg.py +++ b/src/devx/ci/validate_commit_msg.py @@ -118,7 +118,7 @@ def main(commit_msg_file: str | None, branch: str | None, from_git: bool) -> Non " Expected: : \n" " Got: {subject}\n" " Allowed types: feat, fix, chore, docs, style, refactor,\n" - " perf, test, ci, build, revert, BREAKING CHANGE", + " perf, test, ci, build, deps, revert, BREAKING CHANGE", subject=subject, ) ) diff --git a/src/devx/config.py b/src/devx/config.py index 931fa46..55d0725 100644 --- a/src/devx/config.py +++ b/src/devx/config.py @@ -93,4 +93,4 @@ RETRY_BACKOFF_BASE = 2 # seconds: 2, 4, 8 RETRY_STATUS_CODES = {429, 500, 502, 503, 504} # Conventional commit regex — used by validate_commit_msg.py -CONVENTIONAL_RE = re.compile(r"^(feat|fix|chore|docs|style|refactor|perf|test|ci|build|revert)(\(.+\))?: .+") +CONVENTIONAL_RE = re.compile(r"^(feat|fix|chore|docs|style|refactor|perf|test|ci|build|revert|deps)(\(.+\))?: .+") diff --git a/src/devx/translations.json b/src/devx/translations.json index 811c753..1e8d2c3 100644 --- a/src/devx/translations.json +++ b/src/devx/translations.json @@ -2999,13 +2999,13 @@ "PR number for label check": "PR number for label check", "Repo (owner/name) for label check": "Repo (owner/name) for label check" }, - "Oops! Commit message must follow conventional commit format.\n Expected: : \n Got: {subject}\n Allowed types: feat, fix, chore, docs, style, refactor,\n perf, test, ci, build, revert, BREAKING CHANGE": { - "bg": "Опа! Съобщението за commit трябва да следва конвенционален формат.\n Очаква се: : \n Получено: {subject}\n Разрешени типове: feat, fix, chore, docs, style, refactor,\n perf, test, ci, build, revert, BREAKING CHANGE", - "de": "Ups! Commit-Nachricht muss dem konventionellen Commit-Format folgen.\n Erwartet: : \n Erhalten: {subject}\n Erlaubte Typen: feat, fix, chore, docs, style, refactor,\n perf, test, ci, build, revert, BREAKING CHANGE", - "en": "Oops! Commit message must follow conventional commit format.\n Expected: : \n Got: {subject}\n Allowed types: feat, fix, chore, docs, style, refactor,\n perf, test, ci, build, revert, BREAKING CHANGE", - "pl": "Ups! Wiadomość commit musi być w formacie conventional commit.\n Oczekiwano: : \n Otrzymano: {subject}\n Dozwolone typy: feat, fix, chore, docs, style, refactor,\n perf, test, ci, build, revert, BREAKING CHANGE", - "ru": "Ой! Сообщение коммита должно соответствовать формату conventional commit.\n Ожидается: : \n Получено: {subject}\n Допустимые типы: feat, fix, chore, docs, style, refactor,\n perf, test, ci, build, revert, BREAKING CHANGE", - "zh": "哎呀!提交消息必须遵循 conventional commit 格式。\n 预期格式: : \n 实际: {subject}\n 允许的类型: feat, fix, chore, docs, style, refactor,\n perf, test, ci, build, revert, BREAKING CHANGE", + "Oops! Commit message must follow conventional commit format.\n Expected: : \n Got: {subject}\n Allowed types: feat, fix, chore, docs, style, refactor,\n perf, test, ci, build, deps, revert, BREAKING CHANGE": { + "bg": "Опа! Съобщението за commit трябва да следва конвенционален формат.\n Очаква се: : \n Получено: {subject}\n Разрешени типове: feat, fix, chore, docs, style, refactor,\n perf, test, ci, build, deps, revert, BREAKING CHANGE", + "de": "Ups! Commit-Nachricht muss dem konventionellen Commit-Format folgen.\n Erwartet: : \n Erhalten: {subject}\n Erlaubte Typen: feat, fix, chore, docs, style, refactor,\n perf, test, ci, build, deps, revert, BREAKING CHANGE", + "en": "Oops! Commit message must follow conventional commit format.\n Expected: : \n Got: {subject}\n Allowed types: feat, fix, chore, docs, style, refactor,\n perf, test, ci, build, deps, revert, BREAKING CHANGE", + "pl": "Ups! Wiadomość commit musi być w formacie conventional commit.\n Oczekiwano: : \n Otrzymano: {subject}\n Dozwolone typy: feat, fix, chore, docs, style, refactor,\n perf, test, ci, build, deps, revert, BREAKING CHANGE", + "ru": "Ой! Сообщение коммита должно соответствовать формату conventional commit.\n Ожидается: : \n Получено: {subject}\n Допустимые типы: feat, fix, chore, docs, style, refactor,\n perf, test, ci, build, deps, revert, BREAKING CHANGE", + "zh": "哎呀!提交消息必须遵循 conventional commit 格式。\n 预期格式: : \n 实际: {subject}\n 允许的类型: feat, fix, chore, docs, style, refactor,\n perf, test, ci, build, deps, revert, BREAKING CHANGE", "PR number for label check": "PR number for label check", "Repo (owner/name) for label check": "Repo (owner/name) for label check" }, diff --git a/tests/unit/test_config.py b/tests/unit/test_config.py index e1962f3..1bb338e 100644 --- a/tests/unit/test_config.py +++ b/tests/unit/test_config.py @@ -38,6 +38,7 @@ class TestConfigConstants: def test_conventional_re(self) -> None: assert CONVENTIONAL_RE.match("feat: add feature") assert CONVENTIONAL_RE.match("fix(scope): bug fix") + assert CONVENTIONAL_RE.match("deps: bump devx from v0.50.2 to v0.51.0") assert not CONVENTIONAL_RE.match("random message") assert not CONVENTIONAL_RE.match("feat:") assert not CONVENTIONAL_RE.match("BREAKING CHANGE: something") diff --git a/tests/unit/test_validate_commit_msg.py b/tests/unit/test_validate_commit_msg.py index cb251ee..045e5d1 100644 --- a/tests/unit/test_validate_commit_msg.py +++ b/tests/unit/test_validate_commit_msg.py @@ -30,6 +30,7 @@ class TestHelpers: assert CONVENTIONAL_RE.match("test: add tests") assert CONVENTIONAL_RE.match("ci: update workflow") assert CONVENTIONAL_RE.match("build: update deps") + assert CONVENTIONAL_RE.match("deps: bump devx from v0.50.2 to v0.51.0") assert CONVENTIONAL_RE.match("revert: undo change") def test_conventional_re_allows_scope(self) -> None: