Skip to content

feat: add online link-check advisory caller - #12

Merged
kyle-sexton merged 1 commit into
mainfrom
feat/lychee-online
Jun 22, 2026
Merged

kyle-sexton merged 1 commit into
mainfrom
feat/lychee-online

Conversation

@kyle-sexton

Copy link
Copy Markdown
Member

Add a scheduled (weekly + workflow_dispatch) caller of the ci-workflows
link-check reusable workflow — external link health as an advisory signal that
files a rolling tracking issue, not a ci-status gate. Extend the shared
lychee.toml with URL excludes (auth-walled hosts, loopback, placeholders) used
only by the online lane.

Co-Authored-By: Claude Opus 4.8 (1M context) [email protected]

Add a scheduled (weekly + workflow_dispatch) caller of the ci-workflows
link-check reusable workflow — external link health as an advisory signal that
files a rolling tracking issue, not a ci-status gate. Extend the shared
lychee.toml with URL excludes (auth-walled hosts, loopback, placeholders) used
only by the online lane.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
@kyle-sexton
kyle-sexton merged commit 52485a9 into main Jun 22, 2026
1 check passed
@kyle-sexton
kyle-sexton deleted the feat/lychee-online branch June 22, 2026 19:43
kyle-sexton added a commit that referenced this pull request Jul 8, 2026
## Problem
The `owner/repo#N` tracker-reference 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 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.
- Module test: **12/12 pass** (test #11 now guards the bare-domain false
positive; #12 confirms hyphenated owners still flag).

## Propagation
This library is vendored downstream:
- **ci-workflows** carries a byte-identical copy (its comment-hygiene
action self-test sources it) — a sync PR follows.
- Consuming repos (e.g. `kyle-sexton/github-iac`) re-copy on their next
standards sync.

## Separate follow-up (not fixed here)
While committing I found the **local lefthook `shellcheck` hook diverges
from CI**: CI passes `--rcfile modules/shellcheck/.shellcheckrc` (which
sets `external-sources=true`), but the local hook relies on root
`.shellcheckrc` auto-discovery, and standards has no root copy — so the
hook emits `SC1091` for any script that `source`s another (e.g.
`comment-hygiene.test.sh`) and can't be committed without
`SHELLCHECK_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](https://claude.com/claude-code)

<!-- CURSOR_SUMMARY -->
---

> [!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#N` tracker 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 `.shellcheckrc`** is added as the repo’s ShellCheck ruleset
(aligned with `modules/shellcheck/`), so local hooks that auto-discover
config from the repo root can resolve `source`d scripts with
`external-sources=true` and the same optional checks as CI’s `--rcfile`
path.
> 
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
76df493. 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]>
kyle-sexton added a commit that referenced this pull request Sep 3, 2026
…oded i

Review caught a real hole in the previous commit. Accepting any flag set while
rebuilding both probes with a hardcoded "i" meant a gate that DROPPED `i` would
still be probed case-insensitively and pass. Both declared bodies are lowercase
and depend on `i` to accept the documented `Closes #12`, so that gate would have
become case-sensitive in production while this check reported it healthy, which
is precisely the enforcement drift the check exists to catch.

Capture the flags and build each probe from them. `g` and `y` are stripped,
because they make `.test()` advance lastIndex and assertPatternsEnforce probes
each pattern once per policy keyword, so a retained `g` would make every probe
after the first read a moved cursor rather than the pattern. Neither flag
changes what the pattern matches, so dropping just those two is safe; every
behavior-affecting flag now survives into the probe.

Two tests added: a gate declared `/g;` without `i` is reported as enforcement
drift naming the rejected `Closes` keyword, and a `/gi;` gate probes true for
every policy keyword in sequence rather than only the first.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
kyle-sexton added a commit that referenced this pull request Sep 3, 2026
…ation flags (#520)

No linked issue: found while driving #519, whose CI was red for a reason
unrelated to its diff.

## Summary

`main` is red on `pr-convention-lockstep`, and has been since
2026-09-02, on a gate that has not actually drifted. The check stopped
being able to *read* the reusable and reported that as drift. This
restores it.

## Fix

`parseGatePatterns` matched the gate's regex declarations with a literal
`/i;` terminator. melodic-software/ci-workflows commit `3e32b0a` made
`CLOSING_KEYWORD` global, `/gi;`, so every occurrence on a line can be
classified. The match then failed and the check raised `gate reusable:
CLOSING_KEYWORD / NO_ISSUE_MARKER regex declarations not found`, which
reads as drift but is a parse failure.

Declaration flags were never part of the contract this check enforces.
Only the pattern *body* is extracted, and both probes are rebuilt with
`"i"` regardless, so pinning the flag set asserted an incidental detail
of how the reusable happened to be written on the day the parser was
authored. The matcher now accepts any valid flag set. Drift detection is
unchanged and still functional: the extracted body is probed against
every policy keyword and marker, so a keyword surviving only in a
comment still fails.

Why `main` went red without anyone touching it: this repo's last CI run
on `main` was 2026-09-02T06:04Z and the ci-workflows commit landed at
06:48Z, 44 minutes later. No run had observed it until #519 opened.

## Verification

- Reproduced on `main`'s own tree before changing anything: `node
components/pr-convention-policy/lockstep-drift.mjs` against live sources
fails with the exact CI message.
- With the fix, the same live run reports `pr-convention lockstep: all
copies and caller pins match policy.json` and exits 0. That is the
load-bearing check that no *real* drift was hiding behind the parse
failure, so this is not a detector being loosened to hide a problem.
- `npm run test:pr-convention-lockstep`: 14 tests, 14 pass.
- Red under mutation, which this suite's design calls for: reverting
only the parser change and re-running leaves 13 passing and fails
exactly the new `declaration flags are not part of the contract` test.
- The new test asserts the substantive properties rather than the
message: a `gi`-declared gate still yields probes that match `Closes
#12` and `No linked issue`, the rebuilt probe is not global, and the
extracted body is identical whichever flags were declared.

Two commits, deliberately. `e11eb1c` is mechanical Biome formatting plus
three per-call `noConsole` suppressions for the CLI entrypoint; it
landed on its own because these files had never been Biome-formatted.
The CI Biome job scopes itself to a path list that excludes this
component while the lefthook lane globs every staged JS/TS file, so any
edit here drags the accumulated formatting diff in. `4344d9a` is the
actual fix. Reviewing the second commit alone is sufficient, and the
first is verified behavior-neutral: after it, the live check still
failed with exactly the original error and the 13 pre-existing tests
still passed.

## Related

- #519, blocked by this failure; it touches
only `components/claude-permissions` and is otherwise green.
- melodic-software/ci-workflows `3e32b0a`, the upstream change that
exposed the brittleness. It is correct and needs no revert.

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

---------

Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
kyle-sexton added a commit that referenced this pull request Oct 6, 2026
…tion

The negation samples used only the three spellings policy.json lists
(closes, fixes, resolves), but both copies accept GitHub's nine forms. A copy
that stopped applying negation to close, closed, fix, fixed, resolve or
resolved stayed green, while GitHub still closes the issue on
`This does not close #12`.

The matrix now takes the nine forms from a GitHub-documented constant and
probes each as a negated closer, and each form the policy does not spell as
a plain and an upper-case closer. policy.json and the schema are unchanged.
Both fixture copies agree on every new sample.

Mutation test: a gate or a hook that applies negation only to the policy's
spellings passes the previous matrix and is caught now. The README's
inflection note now names only the reference validator's own derivation as
divergent.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01G3BsUv4VeQ81gAPhk73xvs
kyle-sexton added a commit that referenced this pull request Oct 11, 2026
…ape (#774)

No related issue: repair standards main after ci-workflows#733

## Summary

`check-pr-convention-copies` has been red on main since
melodic-software/ci-workflows#733 (merged 2026-10-11 17:13Z) changed the
pr-contract composite's `run.sh`, for example run 38159506436. The
gate's behavior with the default pattern is unchanged; the drift checker
was reading the old source shape.

## Fix

#733 changed four things the checker anchored on:

| Checker expectation | run.sh after #733 |
|---|---|
| `match(chunk, /(close\|...)[ \t]*:?[
\t]*([a-z0-9_.-]+\/[a-z0-9_.-]+)?#[0-9]+/)) break` | `match(chunk,
closing_regex)) break`, with `closing_regex = "(close\|...)" separator
ref` and `ref` from `ENVIRON["ISSUE_REF_PATTERN"]` (default
`DEFAULT_ISSUE_REF_PATTERN='([a-z0-9_.-]+/[a-z0-9_.-]+)?#[0-9]+'`) |
| `rest ~ /^(refs\|relates[ \t]+to):...#[0-9]+[ \t]*$/)` | `rest ~
non_closing_regex)` with `non_closing_regex = "^(refs\|relates[
\t]+to):[ \t]*" ref "[ \t]*$"` |
| `linkage_errors+=('Missing a native closing keyword` |
`linkage_errors+=("Missing a ${keyword_kind} closing keyword` |
| analyzer runs with no env | analyzer reads `ISSUE_REF_PATTERN`; unset,
`ref` became `()` and 347 sample bodies (`xcloses #12`, `Closes #12x`,
...) read as closing |

Changes, all in `components/pr-convention-policy/`:

- The extractors accept both shapes. Consumers pinned before #733 still
run the inline literal, so the pin audit must keep reading it. The new
shape is rebuilt from the keyword alternation, the default separator and
`DEFAULT_ISSUE_REF_PATTERN`.
- The behavioral run passes run.sh's default as
`ISSUE_REF_PATTERN`/`DEFAULT_ISSUE_REF_PATTERN`. A run.sh that reads the
variable without declaring, falling back to and exporting the default is
drift.
- New check: action.yml's `issue-ref-pattern` default must equal
run.sh's default (or be empty). Any other value flips the analyzer to
its custom-pattern separator for every caller that leaves the input
unset.
- Fixtures: `check-contract-run.sh.txt` is now ci-workflows 8b3cc4bf28.
It is verbatim apart from one `spellchecker:ignore-next-line` awk
comment, needed because this repository's typos lane flags `ture` in an
upstream comment. The previous fixture is kept as
`check-contract-run-literal-ref.sh.txt` for the older-pin shape.

## Verification

- `npm run test:pr-convention-lockstep`: 90 pass, 0 fail. Before the
fix, the new fixture produced 37 failures.
- `npm run lint:pr-convention-copies` against live ci-workflows main:
`every copy matches policy.json`.
- Real drift still fails, with new tests for: a missing or unexported
default, a default without the `#N` grammar (both the
enforcement-pattern probe and the behavior check catch it), a default
separator losing the optional colon (the behavior check catches it), and
a mismatched action.yml default. The existing mutation tests still pass
against the new fixture.
- Biome, typos, gitleaks and editorconfig pre-commit hooks pass.

## Related

- melodic-software/ci-workflows#733 (the change being tracked)
- #773 (blocked by the red main)

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

---------

Co-authored-by: Claude Opus 5.5 <[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