Skip to content

feat: add --ignore-link flag to skip URLs in link validation#69

Draft
blva wants to merge 4 commits intoagent-ecosystem:mainfrom
blva:bianca/ignore-link-patterns
Draft

feat: add --ignore-link flag to skip URLs in link validation#69
blva wants to merge 4 commits intoagent-ecosystem:mainfrom
blva:bianca/ignore-link-patterns

Conversation

@blva
Copy link
Copy Markdown

@blva blva commented Apr 16, 2026

Closes #68

Changes

Adds an --ignore-link flag to check and validate links that skips any URL containing a matching substring (case-insensitive). The flag is repeatable and also accepts comma-separated patterns, consistent with --only, --skip, and --allow-dirs.

# Skip a private org's repos
skill-validator validate links --ignore-link=github.com/myorg .

# Multiple patterns: repeated or comma-separated (equivalent)
skill-validator check --ignore-link=github.com/myorg --ignore-link=localhost .
skill-validator check --ignore-link=github.com/myorg,localhost .

Implementation

  • links.Options — new struct with IgnorePatterns []string
  • links.CheckLinks — updated signature to accept Options; filters ignored URLs before the concurrent check loop
  • links.isIgnored — case-insensitive substring helper
  • orchestrate.Options — adds LinksOpts links.Options, threaded through RunAllChecks and RunLinkChecks
  • cmd/check.go and cmd/validate_links.go — expose --ignore-link flag, wire into options
  • README.md — documents the flag in both the validate links and check command sections, and in the "Link validation" what-it-checks section

Tests

  • links.TestIsIgnored — 8 table-driven cases: empty patterns, exact match, case-insensitive, partial substring, no-match, first/second of multiple patterns, none matching
  • links.TestCheckLinks_IgnorePatterns — 4 cases using httptest.NewServer: ignored URL skipped, non-ignored URL still checked, mixed body, case-insensitive matching
  • orchestrate.TestRunLinkChecks_WithIgnorePatterns — uses the invalid-skill fixture (has https://httpstat.us/404); asserts 0 errors when ignored, errors when not
  • orchestrate.TestRunAllChecks_WithIgnoreLinks — same fixture; asserts LinksOpts propagates through RunAllChecks
  • cmd.TestSliceFlags — 3 integration tests exercising the repeated flag form, comma-separated form, and the flag on check --only=links; all run against the compiled binary

Adds an IgnorePatterns option to links.Options that skips any URL
containing a matching substring (case-insensitive). Useful for private
repositories or localhost URLs that are valid locally but unreachable
from CI environments.

  skill-validator check --ignore-link=github.com/myorg,localhost .
  skill-validator validate links --ignore-link=github.com/myorg .

Closes agent-ecosystem#68
@blva blva marked this pull request as draft April 16, 2026 18:21
blva added 2 commits April 16, 2026 19:32
- Update all CheckLinks and RunLinkChecks call sites to pass the new Options parameter
- Add TestIsIgnored with 8 table-driven cases covering empty patterns, exact match, case-insensitive matching, partial substrings, multi-pattern scenarios
- Add TestCheckLinks_IgnorePatterns covering ignored URLs skipped entirely, non-ignored URLs still checked, mixed scenarios, and case-insensitive matching
- Add TestRunLinkChecks_WithIgnorePatterns and TestRunAllChecks_WithIgnoreLinks in the orchestrate package to verify patterns propagate end-to-end
Replace the ad-hoc writeSkillFile helper with the existing invalid-skill
fixture (which has httpstat.us/404 as its only HTTP link). Tests now follow
the same pattern as the rest of the orchestrate package.

Add --ignore-link integration tests to TestSliceFlags covering the repeated
flag form, the comma-separated form, and the flag on the check subcommand,
all consistent with how --only/--skip/--allow-dirs are tested.
@blva blva changed the title Add --ignore-link flag to skip URLs in link validation feat: add --ignore-link flag to skip URLs in link validation Apr 16, 2026
Copy link
Copy Markdown
Member

@dacharyc dacharyc left a comment

Choose a reason for hiding this comment

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

Thanks for this, the implementation is clean and the test coverage is solid! A few things I'd like to address before merge:

Bug: empty pattern matches everything

In Go, strings.Contains(s, "") returns true for any s. This means an accidental empty pattern silently disables all link validation:

# All of these skip every link with no warning:
skill-validator validate links --ignore-link= .
skill-validator validate links --ignore-link=,github.com/myorg .
skill-validator validate links --ignore-link="github.com/myorg," .

isIgnored should skip empty strings in the patterns slice. Would also be good to add a test case for this.

Visibility into skipped links

Right now ignored links are silently dropped. If someone misconfigures a pattern that's too broad (e.g. --ignore-link=github.com instead of --ignore-link=github.com/myorg), they'd have no way to know they're accidentally skipping legitimate links.

We do something similar for 403 responses at links/check.go:122, where we emit an info-level result rather than silently swallowing the ambiguity. Could we do the same here? Something like an rctx.Infof("%s (skipped — matches ignore pattern)", url) per link, or a summary count. Either way, the user should see what was skipped.

Substring matching breadth

Minor, but worth noting: --ignore-link=example.com would also match notexample.com or example.com.evil.org. For the motivating use cases (org paths, localhost) this is unlikely to matter, but could we note this in the flag help text or README? Something like "the pattern is matched as a substring, not a domain boundary" so users aren't surprised.

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.

Support URL/domain exclusions in link validation

2 participants