From e1f312d401ae511a644954ff8248e06c039f8b7a Mon Sep 17 00:00:00 2001 From: Sal Date: Wed, 2 Sep 2026 22:28:57 +0100 Subject: [PATCH] feat(ci): relax the branch check to a type shape Validate Issue Link is registered in the main ruleset now that it has been observed on a real pull request, so ADR-0022's ordering is satisfied and the branch check can stop standing in for traceability. The pattern becomes a shape check: - with an optional slug, which stays valid and recommended, or / over the decisions/0003 Conventional Commits types plus feature, bug and hotfix. next keeps its persistent-integration exemption. Record the amendment in ADR-0019 beside the clause it changes, and state the traceability rule in AGENTS.md, so the pointer and the enforcement it describes arrive together. Note that 'code' is not in the decisions/0003 type set, so code/ branches are still rejected. That was the accepted scope; widening the type set is a separate decision. Steps 4 to 6 of #595. z-shell/zi carries the same job and follows separately. Refs #595 --- .github/workflows/commit-lint.yml | 8 +++++++- AGENTS.md | 1 + decisions/0019-trunk-on-main-default.md | 5 +++++ scripts/test-commit-lint-policy.sh | 11 ++++++++++- 4 files changed, 23 insertions(+), 2 deletions(-) diff --git a/.github/workflows/commit-lint.yml b/.github/workflows/commit-lint.yml index 3b8e0f038..6049ad2f2 100644 --- a/.github/workflows/commit-lint.yml +++ b/.github/workflows/commit-lint.yml @@ -146,7 +146,13 @@ jobs: # As above: an empty pattern would match every branch name and turn # this job into a silent pass. - : "${BRANCH_PATTERN:=^(feature|bug|hotfix)-[1-9][0-9]*(-[a-z0-9]+)*$}" + # decisions/0022: a shape check, not an identifier check. + # Traceability moved to Validate Issue Link. Either + # - with an optional slug, which stays the + # recommended form, or / over the + # decisions/0003 Conventional Commits types plus + # feature, bug and hotfix. + : "${BRANCH_PATTERN:=^((feature|bug|hotfix)-[1-9][0-9]*(-[a-z0-9]+)*|(feat|fix|perf|refactor|docs|test|build|ci|style|chore|revert|feature|bug|hotfix)/[a-z0-9]+(-[a-z0-9]+)*)$}" if echo "$BRANCH" | grep -qE "$AUTOMATION_BRANCH_PATTERN" || \ { [ "$REPOSITORY" = "z-shell/zi" ] && [ "$BRANCH" = "next" ]; }; then diff --git a/AGENTS.md b/AGENTS.md index d2a1b6c09..93a03318a 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -74,6 +74,7 @@ When working in z-shell repositories, optimize for: - **Commits and PR titles:** Conventional Commits. See `decisions/0003-conventional-commits.md`. - **Commit trailers:** `Co-authored-by` crediting a real human, including the PR author crediting themselves, is fine. Never credit a bot, AI agent, or automation as a co-author. `z-shell/.github` and `z-shell/zi` enforce this in CI. Other repositories remain author-enforced until their own verified caller is live; do not infer enforcement from organization policy alone. - **Branch selection:** Follow `decisions/0019-trunk-on-main-default.md` and verify the live state of the owning repository; `zi` is the named persistent-integration exception. +- **Issue traceability:** Per `decisions/0022-issue-traceability-on-pull-requests.md`, every pull request closes or references an issue, or carries the `meta:no-issue` label a maintainer applies. Branch names carry a type shape; the issue identifier in a branch name is recommended, not required. - **Worktrees:** Treat `git worktree list --porcelain` as the authoritative inventory. Use the owning repository's declared helper and stable worktree root; do not create worktrees in `/tmp` or another ad hoc location. Do not use a linked superproject checkout for work that needs initialized submodules. Follow `runbooks/worktrees.md`. - **Documentation placement:** keep long-form docs in the wiki when practical; keep repo-local docs focused on policy, workflow, and source-adjacent guidance. - **Workflow files:** follow the org workflow conventions and keep permissions explicit, actions pinned, and concurrency defined. diff --git a/decisions/0019-trunk-on-main-default.md b/decisions/0019-trunk-on-main-default.md index 3c669a790..eb04cdc2c 100644 --- a/decisions/0019-trunk-on-main-default.md +++ b/decisions/0019-trunk-on-main-default.md @@ -40,6 +40,11 @@ The decision was re-evaluated in Use trunk-based development on `main` as the organization default: +> **Amended by `decisions/0022-issue-traceability-on-pull-requests.md`.** +> The issue identifier below is no longer mandatory. Traceability is +> enforced on the pull request instead, and the branch check verifies a +> type shape. The identifier form remains valid and recommended. + - branch short-lived `feature-`, `bug-`, `hotfix-`, and dependency-update branches from current `main`; - open pull requests into `main`; diff --git a/scripts/test-commit-lint-policy.sh b/scripts/test-commit-lint-policy.sh index 11d8042b8..dadd9f2ef 100755 --- a/scripts/test-commit-lint-policy.sh +++ b/scripts/test-commit-lint-policy.sh @@ -154,9 +154,18 @@ check_branch_cases() { assert_branch codex/learning-capture-publication allow assert_branch next allow + # decisions/0022 relaxed this to a shape check, so a Conventional Commits + # type prefix now passes without an identifier. + assert_branch fix/labeler-audit-reject-malformed allow + assert_branch docs/adr-0022-rollout allow + assert_branch chore/tidy-workflows allow + assert_branch feature/no-identifier allow + + # 'code' is not in the decisions/0003 type set, so it is still rejected. assert_branch code/promotion-precondition-ancestry reject - assert_branch fix/labeler-audit-reject-malformed reject assert_branch ss-o-govern-plugin-standard reject + assert_branch fix/Bad-Caps reject + assert_branch fix/ reject assert_branch feature-0 reject assert_branch feature- reject assert_branch feature-505- reject