Skip to content

fix(git): reject whitespace-only trailer values - #345

Merged
stackbilt-admin merged 3 commits into
mainfrom
auto/bugfix/issue-340
Oct 15, 2026
Merged

stackbilt-admin merged 3 commits into
mainfrom
auto/bugfix/issue-340

Conversation

@stackbilt-admin

Copy link
Copy Markdown
Member

Closes #340

parseTrailersFromMessage matched values with \s*.+, which backtracks to accept Governed-By: , so charter validate --ci counted a commit the commit-msg gate from #339 rejects.

  • Value patterns for Governed-By / Resolves-Request are now \s*(\S.*); values are still .trim()med as before.
  • Terminal-trailer-block detection uses the same non-whitespace rule, so a whitespace-only Key: line ends the block, matching the hook's awk (which sees the line after git stripspace has stripped the trailing blanks, where [ \t]*.+ fails).
  • Parity with the hook: whitespace-only value is rejected by both; leading whitespace then text and trailing whitespace after text are accepted by both, and the value is trimmed.
  • validate.ts's governanceLinePattern already tests line.trim(), so it already rejected whitespace-only values. Left unchanged.
  • Parser regression tests added (4 of them fail without the fix). CHANGELOG entry under Unreleased/Fixed.

Implemented via constellation-loop.

🤖 Generated with Claude Code

@stackbilt-admin
stackbilt-admin merged commit 0113073 into main Oct 15, 2026
5 checks passed
@stackbilt-admin
stackbilt-admin deleted the auto/bugfix/issue-340 branch October 15, 2026 23:54
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.

trailers: parseTrailersFromMessage accepts a whitespace-only trailer value

2 participants