feat(page-cluster): self-tuning recursive clustering with data-driven landmark scoping#916
Merged
Merged
Conversation
filterFirstPartyStylesheetHrefs picked a single "dominant host" by counting how many pages reference each stylesheet host, since it never had access to each page's own URL to compare against directly. When a third party (e.g. a sitewide Google Fonts request) is referenced by exactly as many pages as the real first-party host, the tie-break silently keeps whichever host happened to be counted first — confirmed on a real 302-page crawl where every single page loaded both, and the third party won. Adds an optional `host` field to PageClusterSignals: when a caller supplies it, each page's stylesheetHrefs are filtered by direct comparison against that host instead of the batch-wide vote, eliminating the tie case entirely. Omitting it keeps the existing dominant-host fallback unchanged.
Stage A: auto-cut threshold with clamping + containment assignment inside each block. Stage B: cross-block recursive merge using quorum-80% cores, shape-Jaccard ≥ 0.9, L2 multi-set signatures with shell corroboration, iterating until fixed point (MAX_ROUNDS=10). Also promotes autoCapMainDepth default to true. BREAKING CHANGE: cluster keys may differ from previous versions
Adds form (role="form") and search (<search> tag / role="search") landmark types to extractLandmarks. Bare <form> without a role is intentionally excluded — it has no implicit landmark role under HTML-AAM and is often page-specific content. Also widens the shell-corroboration signal in mergeCrossBlockClusters to include aside, form, and search in addition to header/nav/footer.
…uto-cut Landmark extraction now collects every genuinely-closed instance per type (no shallowest-wins depth rule); ExtractLandmarksResult switches to string[] arrays and downstream consumers pick their own canonical instance via corpus-signature frequency. shellQuorum runs autoCutThreshold over the per-landmark-token page- frequency histogram (was fixed 80% quorum). Corpus-level chrome discovery in resolvePageClusterKeys applies the same primitive to landmark-instance signatures, and reinjects tokens of local (below-cut, non-singleton) signatures into Stage A block token sets so section-local template variants become structurally visible. BREAKING CHANGE: ExtractLandmarksResult fields change from string|undefined to string[]; every landmark instance is now returned in document order instead of just the shallowest match per type.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
@d-zero/page-clusterに自己チューニング再帰クラスタリングを実装し、landmark 抽出のハードコード depth 制約を撤廃、データ駆動で site-wide / section-local chrome を自己発見する仕組みに置き換える。4 コミットで構成
extractLandmarksは全 landmark instance を配列で返す(BREAKING)、shellQuorumは per-token 頻度へのautoCutThreshold適用、コーパス頻度分布に auto-cut を適用して local chrome を判定・Stage A へトークン再注入BREAKING CHANGES
ExtractLandmarksResultのフィールド型がstring | undefined→string[]実装機構の要点
autoCutThresholdプリミティブを 3 階層で再帰使用: (a) Stage A のマージ高さカット (b) Stage B unit 内 shell quorum (c) コーパスレベル landmark signature 頻度Test plan
yarn build/yarn lint/yarn test(1,554 tests pass, cspell clean)🤖 Generated with Claude Code