Skip to content

fix(comment-hygiene): sync vendored library — bare-domain owner/repo#N fix - #62

Merged
kyle-sexton merged 1 commit into
mainfrom
fix/comment-hygiene-owner-regex-sync
Jul 8, 2026
Merged

kyle-sexton merged 1 commit into
mainfrom
fix/comment-hygiene-owner-regex-sync

Conversation

@kyle-sexton

@kyle-sexton kyle-sexton commented Jul 8, 2026 •

Copy link
Copy Markdown
Member

Syncs the vendored modules/comment-hygiene/comment-hygiene-patterns.sh to match the source-of-truth fix in melodic-software/standards (PR: melodic-software/standards#74).

Why

The owner/repo#N tracker-reference rule let the owner segment contain ., so a bare domain with a numeric fragment in a comment (foo.com/bar#3, example.com/page#2) was misread as a cross-repo issue reference. A GitHub owner login allows only alphanumerics and hyphens (no ./_), so the owner class is tightened to [A-Za-z0-9-]; the repo segment keeps ./_.

Why sync here

This repo carries a byte-identical vendored copy of the library that the comment-hygiene action's superset-test.sh sources directly. It must track standards.

Verified

  • superset-test.sh: pass — the prefilter remains a superset (the library now flags a strict subset of before, so no admitted-but-unflagged gap opens).
  • shellcheck on the vendored file: clean.

Order-independent with the standards PR (identical content); merge either first.

🤖 Generated with Claude Code


Note

Low Risk
Narrow regex change in comment-scan policy only; it reduces false positives and stays aligned with the vendored standards copy and superset tests.

Overview
Syncs the vendored comment-hygiene-patterns.sh with the standards library fix for owner/repo#N tracker detection.

The repo-issue regex now restricts the owner segment to [A-Za-z0-9-]+ (GitHub login rules), instead of allowing . and _. Comments that look like bare URLs with a hash fragment (e.g. foo.com/bar#3) are no longer flagged as cross-repo issue refs; real references like org/my.repo#123 still match via the repo segment. Inline comments were updated to document that behavior and to note case-insensitive matching across patterns.

Reviewed by Cursor Bugbot for commit 09e28b2. Bugbot is set up for automated code reviews on this repo. Configure here.

…N fix

Sync the vendored comment-hygiene policy library to match the source of
truth in melodic-software/standards, which tightened the owner/repo#N
rule so a bare domain with a numeric fragment in a comment (e.g.
foo.com/bar#3, example.com/page#2) is no longer misread as an issue
reference: the owner character class drops '.'/'_' (a GitHub owner login
allows only alphanumerics and hyphens), while the repo segment keeps them.

This copy must stay byte-identical to standards because the comment-
hygiene action's superset self-test sources it. Verified: superset-test.sh
still passes (the library now flags a strict subset, so the prefilter
remains a superset), and the file shellchecks clean.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01FSMCZgc6Dj6MaKLxDBSJFw
@claude

claude Bot commented Jul 8, 2026 •

Copy link
Copy Markdown

Claude finished @kyle-sexton's task in 1m 30s —— View job


Review: fix(comment-hygiene): sync vendored library — bare-domain owner/repo#N fix

  • Gather context (diff, changed file, superset test)
  • Analyze regex change for correctness and alignment
  • Check comment accuracy and CLAUDE.md compliance
  • Post review

Summary

This is a targeted, correct fix. The tightened owner-segment class accurately mirrors GitHub's actual username constraints, and the false-positive it eliminates (bare domain foo.com/bar#3 misread as a cross-repo reference) is real. The comment rewrite at the top of chp::scan_text is also a clear improvement.


Regex correctness

Change: owner segment [A-Za-z0-9._-]+ → [A-Za-z0-9-]+

GitHub owner logins (both users and orgs) allow only alphanumerics and hyphens — no ., no _ — so both removals are accurate:

  • Removing . is the core fix: foo.com can no longer satisfy the owner pattern, eliminating the false positive.
  • Removing _ is also correct: GitHub has never permitted _ in owner names.
  • The repo segment retains ._- because GitHub repository names do allow all three. ✓
  • The leading boundary (^|[^[:alnum:]_/.-]) is unchanged and correctly prevents a full URL like github.com/org/repo#1 from matching via the / before the owner segment. ✓

Permalink: comment-hygiene-patterns.sh L88


Minor notes (non-blocking)

1. No assert_clean guard for the fixed false-positive — the superset test verifies the prefilter ⊇ library invariant but does not assert that foo.com/bar#3 or example.com/page#2 are now clean. If this fix were accidentally reverted, no test in this repo would catch it. Consider:

assert_clean 'bare domain not a repo ref'  '# foo.com/bar#3'
assert_clean 'dotted domain not a repo ref' '# example.com/page#2'

These would live in superset-test.sh alongside the existing assert_clean 'plain prose' cases.

2. Owner regex permits leading/trailing hyphen — [A-Za-z0-9-]+ matches -bad/repo#1 or org-/repo#1, both invalid as GitHub owners. This is a pre-existing over-match (the old class had the same property), and the cost is a false positive (flagging something that isn't a real reference), which is the correct direction to err. Not a regression; noting for completeness.


CLAUDE.md compliance

  • SHA-pinning: not applicable (no uses: added). ✓
  • No security-sensitive paths touched. ✓
  • Vendored file updated without touching the action entrypoint. ✓

Verdict: LGTM with the optional assert_clean additions as a nice-to-have. The core change is correct and minimal.

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Risk: low. Cursor Bugbot completed with no findings; this is a narrow vendored regex sync with bounded blast radius. Approved; no reviewers assigned.

Open in Web View Automation 

Sent by Cursor Approval Agent: Pull Request Router and Approver

@kyle-sexton
kyle-sexton merged commit ef419a6 into main Jul 8, 2026
4 checks passed
@kyle-sexton
kyle-sexton deleted the fix/comment-hygiene-owner-regex-sync branch July 8, 2026 13:27
kyle-sexton added a commit that referenced this pull request Jul 8, 2026
…ary (#66)

Follow-up to #62, syncing the corrected library from
**melodic-software/standards#74**.

#62 tightened the `owner/repo#N` owner class to `[A-Za-z0-9-]`, which
dropped `_`. GitHub Enterprise Managed Users have logins with an
`_SHORTCODE` suffix (e.g. `mona-cat_octo`, `fabrikam_admin`), so `// see
mona-cat_octo/scratch#12` started scanning clean — the hygiene gate
missed deferred-work refs in EMU repos. The corrected owner class
`[A-Za-z0-9_-]` excludes only `.` (keeping the bare-domain fix) while
preserving `_`.

Re-synced byte-identical to standards main. `superset-test.sh` passes;
`shellcheck` clean.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Low Risk**
> Single-regex tweak in a vendored detection policy; improves coverage
for EMU refs without changing auth or runtime behavior.
> 
> **Overview**
> Restores **`_` in the `owner/repo#N` regex owner class**
(`[A-Za-z0-9_-]+` instead of `[A-Za-z0-9-]+`) so comment-hygiene flags
cross-repo refs like `mona-cat_octo/scratch#12` again after a prior
tightening dropped underscores.
> 
> Comments now state that **only `.` is excluded** from owners
(bare-domain false positives) and that **GitHub EMU logins** need `_` in
the owner segment. Repo-name matching and boundary rules are unchanged.
> 
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
218bef0. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->

Co-authored-by: Claude Opus 4.8 (1M context) <[email protected]>
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.

1 participant