Skip to content

feat(hackbrowser): declarative nav harvest (Yön A of #120) - #124

Merged
badchars merged 3 commits into
mainfrom
feat/spa-nav-discovery
Aug 30, 2026
Merged

feat(hackbrowser): declarative nav harvest (Yön A of #120)#124
badchars merged 3 commits into
mainfrom
feat/spa-nav-discovery

Conversation

@badchars

Copy link
Copy Markdown
Contributor

Extends the DOM-link harvest beyond <a href> to declarative nav attributes (data-href/data-url/role=link[href]) and routes all harvested targets through resolveUrl for consistent scope/normalization (drops phantom scroll-anchor targets). Verified on canary.7 — no regression (classic-app crawl depth unchanged, no crashes). Part of #120; the imperative/button-nav sweep (nav discovery engine) is the remaining, larger part.

collectDOMLinks normalized hrefs inline (origin+pathname+search+hash) and
scoped by hostname, diverging from the rest of the crawl which uses
resolveUrl (resolve-against-page + isInScope + normalizeUrl). Route the
harvested hrefs through resolveUrl instead: bare "#section" scroll anchors
now collapse to the base page (no phantom targets) while "#/route"
hash-router URLs are preserved, and dedup matches the BFS queue's keys.

Prep for harvesting declarative nav attributes (relative/hash values that
must resolve against the page URL). Refs #120
Button/router-nav SPAs often expose no <a href> links, so the DOM-link
supplement found nothing and route discovery fell entirely on the planner's
per-page clicks — shallow crawls (#120). Widen the harvest to elements that
declare a destination without an anchor: data-href, data-url, and role=link.
The first destination attribute per element is resolved against the page URL
(so relative and #/hash-route values work) and scoped/deduped as before.

routerLink/[to]/data-route are excluded on purpose — their values are
router-relative and would need scheme-guessing; those routes are discovered
imperatively by clicking (phase B). Refs #120
The harvest is no longer <a href>-only (it now covers data-href/data-url/
role=link), so the DOM-specific name is misleading. Rename to collectNavLinks
across the definition, call sites, and comments. Refs #120
@github-actions

Copy link
Copy Markdown
Contributor

Thanks for your contribution!

This PR doesn't have a linked issue. All PRs must reference an existing issue.

Please:

  1. Open an issue describing the bug/feature (if one doesn't exist)
  2. Add Fixes #<number> or Closes #<number> to this PR description

See CONTRIBUTING.md for details.

@badchars
badchars merged commit 1fa1e95 into main Aug 30, 2026
9 of 11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant