Title¶
Standardizing Git Commit Validation using gitlint to Enforce Three-Tier Architectural Integrity.
Status¶
Proposed
Date¶
2026-01-10
Context¶
The Production Git Workflow Standards mandate a complex, conditional validation logic that standard regex-based tools cannot easily support. Specifically:
Tier 2 (Intent): Requires strict Conventional Commits formatting.
Tier 3 (Justification): Mandates an Architectural Tag (ArchTag) (e.g.,
TECHDEBT-PAYMENT) as the first line of the body only if the commit type isrefactor:,perf:, or aBREAKING CHANGE.ADR 26001 & ADR 26002 established a preference for Python-based, OOP-structured hooks managed by the
pre-commitframework to avoid Node.js dependencies.
Decision¶
We will adopt gitlint (https://
Integration:
gitlintwill be orchestrated via.pre-commit-config.yamlusing thepre-commit-msgstage.Custom Logic (Tier 3): We will utilize
gitlint’s User Defined Rules feature. Following the OOP standards of ADR 26001, we will implement a Python class (e.g.,ArchTagRule) that inspects the commit object and enforces the presence of tags based on the commit type.Branch Validation: Since
gitlintfocuses on commits, Tier 1 (Branch Naming) will be handled by a separaterepo: localhook or the nativepre-commitcheck-branch-namehook to ensure full compliance with the<prefix>/<ID>-<desc>format.
Consequences¶
Positive¶
Context-Aware Validation: Unlike simple regex tools,
gitlintallows Python-based logic to verify the relationship between a commit’s “Intent” (Header) and its “Justification” (Body ArchTag).Python Native: Zero Node.js or Ruby runtime requirements, maintaining a lean Linux/MLOps environment.
Detailed Feedback: Provides developers with clear, line-specific error messages, reducing friction during the “Check vs. Fix” cycle.
Full Automation: Supports the “Hard Gate” requirement for CI/CD blocking defined in the standards.
Negative¶
Orchestration Complexity: Requires maintaining a small Python script for custom rules. Mitigation: This aligns with ADR 26001’s requirement for tested, maintainable hook logic.
Dual-Tooling for Branches:
gitlintdoes not validate branch names. Mitigation: Use the existingpre-commitframework to add a 10-line branch validator, keeping the SVA (Smallest Viable Architecture) intact.
Alternatives¶
commit-check: Rejected because it lacks the native Python extensibility required to easily enforce the conditional Tier 3 ArchTag rules across multi-line commit bodies.commitlint(Node.js): Rejected due to the requirement for a Node.js toolchain, which violates our MLOps environment constraints.
References¶
ADR 26001: Use of Python and OOP for Git Hook Scripts
ADR 26002: Adoption of the Pre-commit Framework
Participants¶
Vadim Rudakov
Senior DevOps Systems Architect (Gemini)