Skip to content

visitAllLinks: add a shouldVisit filter - #137

Merged
NullVoxPopuli merged 1 commit into
mainfrom
should-visit
Jul 28, 2026
Merged

NullVoxPopuli merged 1 commit into
mainfrom
should-visit

Conversation

@NullVoxPopuli

Copy link
Copy Markdown
Contributor

Not every reachable link is one the crawl should assert on.

The case that prompted this: docs sites give demo components real-looking links whose route calls transition.abort(), so clicking one keeps the reader on the page instead of yanking them to a stub. Those targets aren't meaningfully visitable — in AuditBoard's docs app, visiting them makes visit() reject with TransitionAborted, so 7 otherwise-green pages failed the crawl with no app bug behind them. There was no way to tell the crawler "these are deliberately inert".

await visitAllLinks(undefined, undefined, {
  shouldVisit: (url) => !url.startsWith('/demo-targets/'),
});

Returning false skips the target entirely: not navigated to, not asserted on, and not traversed for further links. Beyond inert demo links it also covers sharding a large crawl across CI jobs (shouldVisit: (url) => hash(url) % SHARDS === INDEX) and excluding areas that have dedicated tests.

Tests: the test-app gains an /inert-demo-target route that aborts its transition, linked from the application template; every crawl in the suite now filters it out (realistic usage), and a new test asserts the filtered target is never visited while everything else still is, plus that a reject-everything filter visits nothing. Disabling the filter makes that test fail. 10/10 passing, lint clean.

One note on the fixture: a top-level aborting route in this test-app resolves rather than rejecting, so it demonstrates the filtering contract rather than reproducing the TransitionAborted rejection specifically — that came from a nested aborting route in a real app.

🤖 Generated with Claude Code

Not every reachable link is one the crawl should assert on. The case
that prompted this: docs sites give demo components real-looking links
whose route calls transition.abort(), so clicking one keeps the reader
in place. Those targets aren't meaningfully visitable — in AuditBoard's
docs app, visiting them makes visit() reject with TransitionAborted, so
seven otherwise-green pages failed the crawl with no app bug behind it.

shouldVisit(url) returns false to skip a target entirely: not
navigated, not asserted on, and not traversed for further links. It
also covers sharding a large crawl across CI jobs and excluding areas
covered by dedicated tests.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@NullVoxPopuli NullVoxPopuli added the enhancement New feature or request label Jul 28, 2026
@NullVoxPopuli
NullVoxPopuli merged commit 8fefe23 into main Jul 28, 2026
2 of 3 checks passed
@NullVoxPopuli
NullVoxPopuli deleted the should-visit branch July 28, 2026 22:59
@github-actions github-actions Bot mentioned this pull request Jul 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant