feat(capture): rank selector candidates without changing capture YAML - #515
Open
gildesmarais wants to merge 5 commits into
Open
gildesmarais wants to merge 5 commits into
gildesmarais wants to merge 5 commits into
Conversation
Expose best-first items/title/link/published evidence on CaptureResult while keeping emitted YAML single-selector and excluding the default a[href] fallback from discovered candidates.
Title matches were published as the lexicographically smallest class token, so a utility class replaced title or font-semibold, and raw tokens containing ] or , could widen the CSS selector.
The test result keeps an in-process copy of the fetched HTML so replay can read it without putting the page on the public test hash.
The fetched-body check on a short item count is its own example so the existing min_items example stays within RSpec/ExampleLength.
Ranked items and field candidates now carry visible_text so the studio can label choices with a headline instead of CSS.
This branch has not been deployed
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.
What changed
SelectorCandidatesranks items, title, link, and published selector evidence best-first and allows any bucket to be empty.Capturestill writes one items selector into YAML. The defaulta[href]fallback is not listed as discovered evidence.CaptureResult#candidatescarries the four buckets. This branch is rebased onto master, so it includes the Falcon HTTPX retry fix.Why
Studio refine needs more than the single winning items selector Capture emits for YAML. Empty evidence must stay a success, and utility-class pages must not publish a broad class token.
Risk
items_selectorhint skips discovery and returns empty buckets.Review map
spec/lib/html2rss/selector_candidates_spec.rb— empty buckets, best-first order, identifying class, escaped class tokens.lib/html2rss/selector_candidates.rb— ranking, dedupe, field CSS.lib/html2rss/capture.rb— YAML stays one items selector; candidates are separate.spec/lib/html2rss/capture_spec.rb— existing capture contracts plus candidate exposure.Validation
make readyexited 0 on the pre-rebase candidate commits.98e9725bapplied cleanly.make readywas not re-run after the rebase.