Skip to content

fix(comment-hygiene): exclude '.' from the owner/repo#N leading boundary - #47

Merged
kyle-sexton merged 2 commits into
mainfrom
fix/comment-hygiene-url-boundary
Jun 27, 2026
Merged

fix(comment-hygiene): exclude '.' from the owner/repo#N leading boundary#47
kyle-sexton merged 2 commits into
mainfrom
fix/comment-hygiene-url-boundary

Conversation

@kyle-sexton

Copy link
Copy Markdown
Contributor

What

Fixes a false positive in the comment-hygiene owner/repo#N (repo-issue) rule.

The rule's leading boundary [^[:alnum:]_/] allowed a dotted URL host to satisfy it, so an ordinary comment linking a URL with a numeric fragment was wrongly flagged and would fail the hygiene gate:

// see https://example.com/page#2 for details   # was: tracker-ref:repo-issue

The . in example.com satisfied the boundary, matching com/page#2 as an owner/repo segment.

Fix

Add . to the negated boundary class ([^[:alnum:]_/][^[:alnum:]_/.]) so a dotted host is no longer misread as an owner segment. Genuine owner/repo#N references — where the owner is not preceded by a dot (GitHub owners cannot contain dots) — still match.

A regression fixture is added asserting a dotted URL host with a #fragment stays clean; the existing assertion that genuine owner/repo#N is still flagged is unchanged.

Validation

  • Empirically reproduced against the live policy library before/after.
  • comment-hygiene.test.sh: 11/11 — new [11] URL guard passes and [7] flags owner/repo#N still passes.
  • Narrowing the rule preserves the ci-workflows coarse-prefilter superset invariant (verified via superset-test.sh).

Scope

This is the canonical source. The identical one-line fix is being propagated to the vendored copies in ci-workflows, github-iac, and claude-code-plugins (separate PRs). medley's copy already uses a literal internal-repo matcher and is unaffected.

🤖 Generated with Claude Code
https://claude.ai/code/session_01KPusuNL65RexZQQQ4SqL7t

The repo-issue rule's leading boundary `[^[:alnum:]_/]` let a dotted URL
host satisfy it, so an ordinary comment linking a URL with a numeric
fragment (e.g. `https://example.com/page#2`) matched as
`tracker-ref:repo-issue` and failed the hygiene gate. Add `.` to the
negated class so a dotted host is no longer misread as an owner/repo
segment; genuine `owner/repo#N` references (no dot before the owner) still
match. Adds a regression fixture asserting a dotted URL host with a numeric
fragment stays clean.

Empirically reproduced and verified against the live policy library.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KPusuNL65RexZQQQ4SqL7t

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c1e7477718

ℹ️ 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".

Comment thread modules/comment-hygiene/comment-hygiene-patterns.sh Outdated
kyle-sexton added a commit to melodic-software/claude-code-plugins that referenced this pull request Jun 27, 2026
Propagates the canonical fix (melodic-software/standards#47) to this repo's
vendored copy of the comment-hygiene policy so all copies stay byte-identical.

The repo-issue rule's leading boundary `[^[:alnum:]_/]` let a dotted URL host
satisfy it, so a comment linking a URL with a numeric fragment (e.g.
`https://example.com/page#2`) was flagged `tracker-ref:repo-issue`. Adding `.`
to the negated class stops a dotted host being misread as an owner/repo
segment; genuine `owner/repo#N` references still match.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KPusuNL65RexZQQQ4SqL7t
Addresses Codex review: excluding only '.' from the leading boundary still let a
hyphenated URL host match — `foo-example.com/page#2` matched `example.com/page#2`
because the '-' before the host was a valid boundary char. Exclude '-' as well so
dotted and hyphenated hosts are both ignored; owners that contain '-' still match
(the '-' is excluded only at the boundary, not inside the owner class). Extends
the test with a hyphenated-host case and a hyphenated owner/repo#N that must still
be flagged.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HjNG9583Dpkx77atd1k6t5
@kyle-sexton
kyle-sexton merged commit 46f5bb9 into main Jun 27, 2026
31 checks passed
@kyle-sexton
kyle-sexton deleted the fix/comment-hygiene-url-boundary branch June 27, 2026 19:06
kyle-sexton added a commit to melodic-software/ci-workflows that referenced this pull request Jun 27, 2026
Mirrors the standards SSOT fix (melodic-software/standards#47): excluding only
'.' from the leading boundary still let a hyphenated URL host match
(`foo-example.com/page#2` matched `example.com/page#2`, since '-' was a valid
boundary char). Exclude '-' too; owners that contain '-' still match because '-'
is excluded only at the boundary, not inside the owner class.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HjNG9583Dpkx77atd1k6t5
kyle-sexton added a commit to melodic-software/ci-workflows that referenced this pull request Jun 27, 2026
…ary (#46)

## What

Propagates the canonical comment-hygiene fix —
**melodic-software/standards#47** — to this repo's vendored copy of
`comment-hygiene-patterns.sh`, keeping all copies byte-identical.

## Why

The repo-issue (`owner/repo#N`) rule's leading boundary `[^[:alnum:]_/]`
allowed a dotted URL host to satisfy it, so an ordinary comment linking
a URL with a numeric fragment was wrongly flagged:

```sh
// see https://example.com/page#2 for details   # was: tracker-ref:repo-issue
```

## Fix

Add `.` to the negated boundary class (`[^[:alnum:]_/]` →
`[^[:alnum:]_/.]`). A dotted host is no longer misread as an owner
segment; genuine `owner/repo#N` references still match. See standards#47
for the full rationale, regression test, and validation.

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

---------

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
kyle-sexton added a commit to melodic-software/claude-code-plugins that referenced this pull request Jun 27, 2026
…ary (#12)

## What

Propagates the canonical comment-hygiene fix —
**melodic-software/standards#47** — to this repo's vendored copy of
`comment-hygiene-patterns.sh`, keeping all copies byte-identical.

## Why

The repo-issue (`owner/repo#N`) rule's leading boundary `[^[:alnum:]_/]`
allowed a dotted URL host to satisfy it, so an ordinary comment linking
a URL with a numeric fragment was wrongly flagged:

```sh
// see https://example.com/page#2 for details   # was: tracker-ref:repo-issue
```

## Fix

Add `.` to the negated boundary class (`[^[:alnum:]_/]` →
`[^[:alnum:]_/.]`). A dotted host is no longer misread as an owner
segment; genuine `owner/repo#N` references still match. See standards#47
for the full rationale, regression test, and validation.

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

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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