Repository navigation
fix(comment-hygiene): stop flagging bare domains as owner/repo#N - #74
Conversation
The owner/repo#N rule let the owner segment contain '.', so a bare domain with a numeric fragment in a comment — e.g. `see foo.com/bar#3` or `example.com/page#2` at a space/start boundary — was misread as an issue reference and flagged. The leading-boundary '.'/'-' exclusion only caught hosts embedded in a longer URL (preceded by '/' or '.'), not ones at a word boundary, so the adjacent comment's claim that dotted hosts are handled was only half true. Fix it at the source: a GitHub owner (user or org) login may contain only alphanumerics and hyphens — never a dot or underscore (GitHub username rules; max 39 chars) — so restrict the owner character class to [A-Za-z0-9-]. The repo segment keeps '.'/'_' because repository names allow them. Genuine refs including hyphenated owners (melodic-software/ app#123, owner-name/repo#7) still match; the regression test now covers bare domains alongside the existing scheme'd-URL cases. Consumers vendor this library, so this needs to propagate: ci-workflows carries a byte-identical copy (synced separately) and each consuming repo re-copies on its next standards sync. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01FSMCZgc6Dj6MaKLxDBSJFw
|
Claude finished @kyle-sexton's task in 1m 55s —— View job PR Review
SummaryThe fix is correct and well-targeted. GitHub owner names (user or org logins) genuinely allow only FindingsNo blocking issues. Three minor observations: 1. Positive-case test coverage is thinThe regression guard for bare-domain false positives (test 11) is solid, but the positive-case test (test 12) only checks a single fixture: # comment-hygiene.test.sh:61
flagged_ref="$(printf '%s\n' '// tracked in owner-name/repo#7')"The PR body mentions
These are non-blocking nits — the existing test already catches the hyphenated-owner case. 2. Leading-hyphen owner is technically matchable (pre-existing, not introduced here)The new owner class …would match ( 3. Owner length limit not enforced (pre-existing, not introduced here)GitHub caps owner names at 39 characters. A string of 40+ alphanumeric characters followed by Regex correctness traceFor
Correct — the line is clean under the new regex. For
Files reviewed
Verdict: ready to merge. The core fix is correct, minimal, and adequately tested. The optional test additions above would make the suite more defensive but are not required to ship this. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 25a741d7a4
ℹ️ 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".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…N fix (#62) 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](https://claude.com/claude-code) <!-- CURSOR_SUMMARY --> --- > [!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. > > <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 09e28b2. 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]>
The lefthook shellcheck lane runs `shellcheck {staged_files}` with no --rcfile, relying on ShellCheck's upward directory search from each script to find a .shellcheckrc. No such file existed at the repo root, so external-sources never activated and every `source` line tripped SC1091, blocking commits. sync-manifest.yml already declares `shellcheck.root: .shellcheckrc` (a copy of the canonical modules/shellcheck/.shellcheckrc), so this dogfoods what the sync engine ships to consumers. ShellCheck rc files have no include/extend directive, so a copy — not a stub — is the only faithful form.
Co-Authored-By: Claude <[email protected]>
…tection The owner segment of the owner/repo#N tracker-ref pattern excluded '_', which dropped GitHub Enterprise Managed User owner logins (they carry an '_SHORTCODE' suffix, e.g. mona-cat_octo). Widen the owner class to [A-Za-z0-9_-]+ — still excluding '.' so a bare domain host (foo.com/bar#3) is not misread as owner/repo. Adds a regression test asserting mona-cat_octo/scratch#12 is flagged while bare-domain cases stay unflagged. Co-Authored-By: Claude <[email protected]>
|
Claude finished @kyle-sexton's task in 2m 19s —— View job PR Review
SummaryThe EMU underscore regression is correctly fixed, the Findings1. Regex is now correct —
|
| Start candidate | Boundary | Owner token hits /? |
Result |
|---|---|---|---|
foo (after ^) |
^ ✓ |
foo then ., not / |
no match |
com (after .) |
. is excluded ✗ |
— | no match |
bar (after /) |
/ is excluded ✗ |
— | no match |
Clean. ✓
EMU trace — mona-cat_octo/scratch#12:
mona-cat_octo matches [A-Za-z0-9_-]+, /scratch#12 satisfies the rest → flagged. ✓
2. .shellcheckrc is byte-identical to modules/shellcheck/.shellcheckrc
Confirmed with diff. The root copy is purely a discovery stub for lefthook's shellcheck {staged_files} invocation (which has no --rcfile); the sync manifest already declared root: .shellcheckrc at line 40. Standards was missing its own stub — now added.
The source-path=SCRIPTDIR setting means shellcheck resolves sourced files relative to each script's own directory, which is correct regardless of where shellcheck is invoked from.
3. Test suite: 13/13, well-structured
- False-positive guard extended with three bare-domain cases (the regression this PR fixes)
- New EMU underscore test guards the regression Codex caught
- Updated assertion label is accurate
4. Pre-existing minor nits (not introduced here)
These existed before this PR and are outside its scope:
- A leading-underscore "owner" at line start (e.g.
_name/repo#1) would technically match, but no valid GitHub username begins with_ - No owner length cap (GitHub: ≤39 chars) — risk bounded by the tighter character class
Verdict
Ready to merge. The EMU fix is the right call (keep _, drop only .), the .shellcheckrc addition correctly dogs-foods the sync manifest, and both regressions now have dedicated tests.
…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]>


Problem
The
owner/repo#Ntracker-reference rule let the owner segment contain., so a bare domain with a numeric fragment in a comment — e.g.// see foo.com/bar#3or# example.com/page#2at a space/start boundary — was misread as a cross-repo issue reference and flagged. The existing leading-boundary./-exclusion only caught hosts embedded in a longer URL (preceded by/or., e.g.https://example.com/page#2), not hosts at a word boundary — so the adjacent comment's claim that dotted hosts were handled was only half true.Fix
A GitHub owner login (user or org) may contain only alphanumerics and hyphens — never a
.or_(GitHub username rules; ≤39 chars, no leading/trailing/double hyphen). So the owner character class is restricted from[A-Za-z0-9._-]to[A-Za-z0-9-]. The repo segment keeps./_because repository names legitimately allow them. A dotted host can no longer be read as an owner.Verified against the module test suite (
comment-hygiene.test.sh), which I extended: the regression guard now covers bare domains (foo.com/bar#3,example.com/page#2,sub.example.com/path#9) alongside the existing scheme'd-URL cases. Genuine refs — including hyphenated owners (melodic-software/app#123,owner-name/repo#7) — still match.shellcheck -x: clean.Propagation
This library is vendored downstream:
kyle-sexton/github-iac) re-copy on their next standards sync.Separate follow-up (not fixed here)
While committing I found the local lefthook
shellcheckhook diverges from CI: CI passes--rcfile modules/shellcheck/.shellcheckrc(which setsexternal-sources=true), but the local hook relies on root.shellcheckrcauto-discovery, and standards has no root copy — so the hook emitsSC1091for any script thatsources another (e.g.comment-hygiene.test.sh) and can't be committed withoutSHELLCHECK_OPTS=--external-sources. That's a pre-existing dogfooding gap in standards' own tooling, orthogonal to this fix, and touches the root-stub/sync-manifest model — flagging for a maintainer decision rather than fixing inline.🤖 Generated with Claude Code
Note
Low Risk
Changes are limited to comment-scan regex behavior and ShellCheck config; no runtime auth, data, or production paths.
Overview
Comment-hygiene tightens the
owner/repo#Ntracker rule so dotted hosts in comments (e.g.foo.com/bar#3,example.com/page#2) are no longer treated as cross-repo issue refs. The owner segment no longer allows.(GitHub logins cannot contain dots); the repo segment still allows.and_, and_remains in the owner class for GitHub Enterprise Managed User logins (e.g.mona-cat_octo/repo#12). Tests add bare-domain regression cases and an EMU owner positive case.A root
.shellcheckrcis added as the repo’s ShellCheck ruleset (aligned withmodules/shellcheck/), so local hooks that auto-discover config from the repo root can resolvesourced scripts withexternal-sources=trueand the same optional checks as CI’s--rcfilepath.Reviewed by Cursor Bugbot for commit 76df493. Bugbot is set up for automated code reviews on this repo. Configure here.