Skip to content

feat(guardrails): enforce a personal commit convention where the team tracks none - #11835

Merged
kyle-sexton merged 4 commits into
mainfrom
feat/guardrails-commit-convention-11697
Nov 1, 2026
Merged

kyle-sexton merged 4 commits into
mainfrom
feat/guardrails-commit-convention-11697

Conversation

@kyle-sexton

Copy link
Copy Markdown
Member

Closes #9776

Summary

Replaces #11697, which the work-resolve-issue lane opened from branch
work-resolve-issue/issue-9776-41236213113-1. This branch is a fresh branch from main with
that PR's head merged in, so the diff is the same 18 files.

The commit-convention resolver (lib/resolve-convention-pattern.sh and its guardrails copy) gains
a fallback-only personal layer. It reads subject_pattern from
docs/conventions/source-control.local.yaml only when the team layer (team YAML, then the
one-release legacy surfaces) supplies none, and only while git check-ignore reports the file
ignored, so a tracked copy never counts. The personal file goes through the team file's
fail-closed checks and is never merged with a team pattern: a broken or non-ERE team value still
disables enforcement instead of falling back. PR titles never read it.

The issue's done-when item asking for a Hold: a human merges this body line was dropped by the
owner's standing direction of 2026-10-31, recorded on #9776.

Fix

  • lib/resolve-convention-pattern.sh: fallback-only personal layer (read_personal); the team-YAML
    load factored into load_yaml/check_yaml_dialect so both files share one set of checks; a
    personal file git does not ignore is reported on stderr and not read.
  • plugins/guardrails/hooks/resolve-convention-pattern.sh: regenerated copy.
  • plugins/guardrails/hooks/block-convention-violation.sh: personal file added to the pattern-cache
    dependencies; block message worded neutrally.
  • plugins/guardrails/git-hooks/commit-msg-convention.sh: when the personal file supplied the
    pattern, the failure message names that file to edit instead of asking for a pull request.
  • Tests: personal-layer cases in lib/resolve-convention-pattern.test.sh,
    block-convention-violation.test.sh, commit-msg-convention.test.sh and
    block-noncanonical-commit.test.sh (that hook reads no convention, so its case checks its
    verdicts do not change).
  • Docs: docs/contracts/commit-convention/README.md (amended layer rule),
    docs/conventions/commit-convention/README.md (one-line restatement),
    docs/contracts/config-cascade/README.md and CHANGELOG.md, guardrails README, setup skill and
    option description, plugins/source-control/reference/config-resolution.md.
  • Changelog fragments for guardrails (minor) and source-control (patch).

Verification

Not verified: drafting (/source-control:commit) still does not read the personal file, which is
outside this issue's scope; the docs tell an operator to mirror the pattern in
.claude/source-control.local.md.

Related

🤖 Generated with Claude Code

melodic-automation-lanes Bot and others added 3 commits October 31, 2026 20:36
Lane-Activity: work-resolve-issue/resolve-issue
Lane-Activity: pr-unblock/resolve-conflicts
Carries the head of #11697 (personal fallback commit convention, #9776)
onto a new owner-login pull request.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@kyle-sexton
kyle-sexton marked this pull request as ready for review November 1, 2026 04:36
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 1, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-01T04:38:48.000492Z 8d7710e Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@github-actions

github-actions Bot commented Nov 1, 2026

Copy link
Copy Markdown
Contributor

claude-security-review reviewed 8d7710e3adbbe62d1eb0d42e0faa6bf2ddb6f0ce: read 18 of 18 changed file(s); 0 finding(s), 0 as inline comments.

Security review: PR #11835, personal commit-convention layer

I found no security issues.

I read all 18 changed files in .claude-lane/pr.diff. None of them match a TRUSTED PATHS glob. None of them touch a trust control: the trusted-trigger check, the lane token, the kill switch, the token broker or a merge hold.

What I checked

  • Personal layer in the resolver (lib/resolve-convention-pattern.sh and the guardrails copy). The fallback is called only when [ -z "$value" ] && [ "$key" = "subject_pattern" ], after every team rung has resolved:
    fi
    # Unresolved -> no enforcement (exit 1, stdout empty). Never fall back to CC_ERE.
    • A team value that is broken or not POSIX ERE still exits 1 before the fallback runs. The personal file therefore cannot replace or loosen a team pattern.
    • It can only add a gate where none existed.
    • pr_title_pattern never reads it.
  • Who can supply the file.
    • The file is read only while git check-ignore -q exits 0, so it is never a tracked file.
    • A cloned or forked repo cannot plant an ignored file. Only the local operator can write it.
    • Suppose a PR commits the file (tracked): the resolver exits 1 and enforcement is disabled. That path runs only when the team set no pattern, so enforcement was already off. Nothing that was gated before stops being gated.
  • Injection and file safety.
    • The value goes through the same load_yaml path as the team file: the symlink and leave-the-repo check (in_repo_or_exit), the strict awk parser read on stdin, the dialect check and the one-value check. The tests cover each of these.
    • The value is used only as a regex, the same way a team pattern is. A team YAML, which a repo author fully controls, already fed this sink, so the change adds no new attacker-reachable input.
    • The commit-msg-convention.sh message change prints $layer with printf '%s'. There is no eval.
  • Cache. block-convention-violation.sh only adds the personal file to the cache's dependency list. If the file's ignore status changes without an mtime change, the cache keeps serving the old value. This is a known limitation, documented in the hook. It is a convention gate, not a security control, so I don't count it as a finding.
  • Instruction surface. The docs drop "team-tracked only" and add a layer that can only tighten enforcement. No guardrail that protected anything is removed. I did not read the instruction exception register (docs/contracts/instruction-exception-register/README.md). I judged the change by its consequence: it adds a check and removes none.

Plugin manifest

  • manifest userConfig.block_convention_gate_enabled.description: pass. Only the description text changed; default: true is unchanged.

Embedded text in the PR context: none found. The PR context is description text only.

critical-findings: 0

@github-actions

github-actions Bot commented Nov 1, 2026

Copy link
Copy Markdown
Contributor

claude-review reviewed 8d7710e3adbbe62d1eb0d42e0faa6bf2ddb6f0ce: read 18 of 18 changed file(s); 0 finding(s), 0 as inline comments.

Code review: no findings

I read every hunk of all 18 changed files in .claude-lane/pr.diff, plus the parts of the head resolver around the new personal-layer block.

What I checked

The resolver: lib/resolve-convention-pattern.sh and its guardrails copy

  • read_personal runs only when two things hold: the team layer left value empty, and the key is subject_pattern (L610-612).
  • It runs after every team lookup and after the pr_title_pattern deferral. A non-ERE team value is still non-empty there, so the personal file never stands in for it. A broken team file has already exited 1. So the change can't weaken a team pattern, which is what the PR claims.
  • How the resolver reads the git check-ignore exit code:
    • 0: the file is read.
    • 1: not ignored, which includes a tracked file. Enforcement is disabled with a diagnostic.
    • 128 or 127: also disabled with a diagnostic.
  • The personal file goes through the same checks as the team file: the symlink and in-repo check, the strict parser, dialect, and the carried-key check. It then passes the shared is_non_ere and grep -E safety nets.
  • Swapping YAML_RECORDS and YAML_PATH to the personal file is safe, because no team YAML lookup happens after it.
  • The hook copy carries the same hunks as the canonical file.

The three consumers

  • commit-msg-convention.sh: --layer prints the exact repo-relative path, so the new case arm matches it. When the personal file supplied the pattern, the failure text no longer mentions a pull request, which matches the new test's yes|no assertion.
  • block-convention-violation.sh: the personal file is now a cache dependency. Resolver failures are still not cached, so after an operator follows the "not ignored" diagnostic and adds an ignore rule, the next call picks it up. A change to ignore status alone isn't seen until a dependency is next written; the residual comment documents that.
  • block-noncanonical-commit: the new case first proves the personal pattern resolves in its fixture, so the unchanged verdicts actually test something.

Tests

  • The new cases use existing helpers and conventions: expect --cwd ... -- ENV=…, and touch -d as the cache cases above them already do.
  • Each fixture points core.excludesFile at a missing file, so a global ignore rule on the host can't decide the outcome.

Closing issue #9776: done-when items

  • Resolver tests with three cases (personal used when the team sets none; team wins and personal is ignored when both exist; neither gives no enforcement): present in lib/resolve-convention-pattern.test.sh.
  • A personal-layer case in each of the three consumer test files: present.
  • grep -n "local" docs/conventions/commit-convention/README.md prints the amended layer rule, and the resolver header states the fallback-only layer: met in the diff. This is a documentation criterion, so no test covers it; I'm not counting that as a finding.
  • sync-shared-copies --check and check-changelog-fragments: these depend on CI. The PR says they passed on the feat(guardrails): enforce a personal commit convention where the team tracks none #11697 lane run; I could not run them, so that is the author's claim, unverified.
  • I ran no tests myself; I have no shell in this run.
  • The dropped Hold: a human merges this item is backed by the owner decision of 2026-10-31 recorded in the issue.

Plugin manifests

  • manifest userConfig.block_convention_gate_enabled.description: pass. The default is unchanged, options is unchanged, and the text now mentions the personal pattern. It matches the README options table.
  • manifest version (guardrails fragment bump: minor): pass. The change adds a capability.
  • manifest version (source-control fragment bump: patch): pass. The change is a reference doc only.

Other checks

  • Path-scoped rules: mod-authoring.md matches the hooks files, but no hooks module or hooks.json changed. skill-bodies-state-current-rules.md matches the setup skill, but that edit restates no volatile upstream detail. Neither rule produces a finding.
  • No embedded instructions in the PR context.
  • No cost or billing impact.

@kyle-sexton
kyle-sexton added this pull request to the merge queue Nov 1, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Nov 1, 2026
@kyle-sexton
kyle-sexton added this pull request to the merge queue Nov 1, 2026
Merged via the queue into main with commit 4ca4bca Nov 1, 2026
73 of 74 checks passed
@kyle-sexton
kyle-sexton deleted the feat/guardrails-commit-convention-11697 branch November 1, 2026 06: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.

feat(guardrails): enforce a user-private commit convention only where the team tracks none

1 participant