š fix(kavach): checkout-discards-uncommitted passes conflict resolution, and commit-body-ref-line-length matches commitlint, 0.8.14
Slice: #642
Refs athya-hq/athya_mono#3606
Under work item #43. Alok asked for it in chat on 2026-11-27. The slice waits on his š on https://github.com/veda-hq/veda/issues/642#issuecomment-7201824063, and this pull request merges only after that.
Two kavach command rules fired where the command was right, so athya_mono kept both at warn (#3606):
checkout-discards-uncommitted: 27 of its 66 live fires weregit checkout --ours|--theirs|-mresolving merge conflicts.commit-body-ref-line-length: it fires on lines that commitlint lets through.
What changes:
uncommitted()leaves out the pathsgit statusshows unmerged (DD AU UD UA DU AA UU). Overwriting one, with a side or a ref, is how a conflict is resolved, and git refuses the plain forms over it ("path is unmerged"). The exemption depends on the path's state, not on the flag. On a path outside the conflict, git's--ours,--theirs,-m,restore --oursandrestore --mergeall silently overwrite a local edit with the index, so those still fire. In a command that names both kinds, the fire names only the changed path. The message no longer says "resolve hunk by hunk".commit_body_ref_line_lengthports commitlint's own exemptions rather than approximating them:- the URL regex of
@commitlint/ensure'smax-line-length; - the default
ignoresof@commitlint/is-ignored(lib/defaults.js), each with its JavaScript flags. The twoMergepatterns are/m, so they match at any line. The others anchor at the start. isSemver, with semver'sFULLregex, its 256-character limit and its safe-integer check.
- the URL regex of
git commit --fixupand--squashpass, because git writes theirfixup!/squash!subject itself.commit_messagesreturnsNonefor them.uncommitted()'s filter reads the path once,(path := entry[3:]). The oldlen(entry) > 3left mutants that no git output can tell apart.- The README rule rows and the held-by lines in
docs/lessons/git-github.md. - kavach and sarathi move to 0.8.14, the next legal version after
v0.8.13. sarathi'sVERSIONfollows.
Tests (test_rules.py):
CheckoutDuringAMergeis a stopped merge withc.txtUU,d.txtAAanda.txtedited.- Nine resolution forms pass,
--theirs -- c.txt d.txtamong them:--ours,--theirs,-m,HEAD --,other --,restore --ours,restore --source=HEAD -SW, and plain--. --ours -- a.txt,--theirs -- c.txt a.txt,--theirs -- .and-m -- a.txtfire, naming onlya.txt.- Once
c.txtandd.txtare added, they count as changed again.
- Nine resolution forms pass,
CommitBodyRefLineLength.COMMITLINT: each message is pinned to the outcome@commitlint/lint20.2 gives it withfooter-max-line-lengthat 100. The outcomes were run on 2026-11-27, near misses included:revert:,xhttps://, a barehttps://,HTTPS://,1.2,01.2.3,1.2.3-alpha.01, a skip tag twice,merge branch,Merged PRin the body, 2^53 against 2^53 ā 1, and there.ASCIIcases (a URL afterĆ©passes,1Ł”.2.3fires).--fixupand--squash, each with a body-mthat would fire otherwise;-m "--fixup"is still judged.- An ignored commit followed by a judged one in the same command; a body line right under the subject.
- I hand-applied 31 mutants of the changed lines to a copy, as #594 did, and each made the rule tests fail. The CI gate has the last word.
athya_mono pins @commitlint/lint 20.2.0, the release these outcomes come from. Its config-conventional makes body-max-line-length (100) an error as well as the footer rule. A long line holding #3606., #3606: or `#3606` is therefore not a reference to the parser, which wants a space, ,, ;, ), ] or the end after it, and it still fails as body. So kavach's remaining fires all fail commitlint there too (probed both ways). Under the footer rule alone those three shapes would pass, and kavach would still fire. kavach matches commitlint's default ignores only, not athya_mono's own Mergify Merge of #N entry: the queue writes those commits, not a session's git commit.
Open #645 sets dvara to 0.8.14 too. One v0.8.14 tag releases all three if it comes after both merge. If v0.8.14 is tagged before this merges, this moves to 0.8.15.
Next under this slice: tag v0.8.14 (or the version it ends on) after this merges, then veda's pin bump to sarathi and kavach 0.8.14. athya_mono's pin bump and the two flips are athya_mono pull requests under #3606.
š¤ Generated with Claude Code
Summary by cubic
Fixes two kavach command rules that fired on commands that were right, which kept both at warn in athya_mono (#3606): checkout-discards-uncommitted flagged git checkout --ours/--theirs/-m resolving merge conflicts (27 of its 66 live fires), and commit-body-ref-line-length fired on lines commitlint accepts.
- Paths
git statusshows as unmerged (DD AU UD UA DU AA UU) no longer count as uncommitted: overwriting one is how a conflict is resolved. Other changed paths the command names still fire, naming only that path. commit_body_ref_line_lengthnow ports commitlint's own exemptions ā the@commitlint/ensureURL regex, the@commitlint/is-ignoreddefault ignores, and semver'sFULLregex ā so it fires only where commitlint fails.git commit --fixup/--squashpass, because git writes its own subject for them.- Tests pin each case to
@commitlint/lint20.2 outcomes atfooter-max-line-length100, near misses included; each of 31 hand-applied mutants made the rule tests fail. - kavach and sarathi move to 0.8.14; README rule rows and the held-by lines in
docs/lessons/git-github.mdupdated. Tagv0.8.14after this merges, or the version becomes 0.8.15.