Repository navigation
fix(web-fetch): accept spaced anchors, indented links; cache tokenizing - #253
Conversation
An undeclared answer that keeps source-HTML nesting put its links at three or more depths inside indented blocks. They were read as code, so records parsed to zero. normalize_native_markdown_layout now removes that indentation from those blocks; declared Markdown and shallower code examples stay literal. The fold for layout space around CJK characters ran only in Markdown normalization, so anchors matched through the plain-text view failed on a split label such as '登 录'. Anchor matching now applies the same fold. Latin word boundaries stay significant. Tag spans were reparsed after every closed code span and again for each fact and anchor. Results are now cached, and a span without tag delimiters or quotes no longer triggers a reparse. Adds eleven paired controls and the matching code-migration bindings.
There was a problem hiding this comment.
This review found 1 issue(s), including 1 blocking issue(s).
| depths = {len(line) - len(line.lstrip(' ')) | ||
| for left, right in spans for line in text[left:right].expandtabs(4).splitlines() | ||
| if '](' in line} |
There was a problem hiding this comment.
P2 — The depth threshold is document-wide, and the subsequent loop unindents every code block. For example, three separate examples separated by unindented headings, each containing one link at respectively 4, 8 and 12 spaces, collectively trigger this rule even though each example has only one depth. Likewise, a qualifying serializer block exposes unrelated shallow code examples elsewhere. _extract_named_candidates normalizes before removing literals, so those example links can now count as records and produce false-positive verdicts. This exceeds the stated preservation of shallow examples. Compute qualification per indented block and strip only qualifying blocks; add controls for separate shallow examples and mixed serializer/literal content.
The depth count treated any "](" as a link, so code samples passed record
tasks, and removing all indentation exposed unbalanced syntax in link-free
samples. The rule now needs whitespace-only deep lines, the serializer's own
signature.
The CJK fold also reached required facts and joined separate words such as
'北京' and '大学'. It now joins only labels letter-spaced into single
characters, and the existing Markdown fold is unchanged.
The tokenizer shortcut's comment now states its known limit.
Adds controls for both directions and updates the scorer bindings.
There was a problem hiding this comment.
✅ Re-review complete · 57d74b4
No findings in this incremental review.
Port of #252 (16 commits, head cebd6aa) onto #224 rebased on current #131, resolved once. Same behavior as cebd6aa except: - Keep main's CJK rule (#253): plain text folds letter-spaced single characters only, so separate CJK words or paragraphs never join (cjk-separate-paragraphs-fact-rejected passes again). The plain-text-typography control no longer relies on joining 中文 文本. - Catalog price-heading cards keep #252's broader condition, which covers main's #250 case. - Keep both stable-anchor fallbacks (escaped prose from #131, link labels and extracted fields from #252). - Bind loop variables for B023 and recompute scorer source hashes; add #252's two correction records to the migration receipt. Co-authored-by: Maisiqi <[email protected]>
Port of #252 (16 commits, head cebd6aa) onto #224 rebased on current #131, resolved once. Same behavior as cebd6aa except: - Keep main's CJK rule (#253): plain text folds letter-spaced single characters only, so separate CJK words or paragraphs never join (cjk-separate-paragraphs-fact-rejected passes again). The plain-text-typography control no longer relies on joining 中文 文本. - Catalog price-heading cards keep #252's broader condition, which covers main's #250 case. - Keep both stable-anchor fallbacks (escaped prose from #131, link labels and extracted fields from #252). - Bind loop variables for B023 and recompute scorer source hashes; add #252's two correction records to the migration receipt. Co-authored-by: Maisiqi <[email protected]>
Port of #252 (16 commits, head cebd6aa) onto #224 rebased on current #131, resolved once. Same behavior as cebd6aa except: - Keep main's CJK rule (#253): plain text folds letter-spaced single characters only, so separate CJK words or paragraphs never join (cjk-separate-paragraphs-fact-rejected passes again). The plain-text-typography control no longer relies on joining 中文 文本. - Catalog price-heading cards keep #252's broader condition, which covers main's #250 case. - Keep both stable-anchor fallbacks (escaped prose from #131, link labels and extracted fields from #252). - Bind loop variables for B023 and recompute scorer source hashes; add #252's two correction records to the migration receipt. Co-authored-by: Maisiqi <[email protected]>
Port of #252 (16 commits, head cebd6aa) onto #224 rebased on current #131, resolved once. Same behavior as cebd6aa except: - Keep main's CJK rule (#253): plain text folds letter-spaced single characters only, so separate CJK words or paragraphs never join (cjk-separate-paragraphs-fact-rejected passes again). The plain-text-typography control no longer relies on joining 中文 文本. - Catalog price-heading cards keep #252's broader condition, which covers main's #250 case. - Keep both stable-anchor fallbacks (escaped prose from #131, link labels and extracted fields from #252). - Bind loop variables for B023 and recompute scorer source hashes; add #252's two correction records to the migration receipt. Co-authored-by: Maisiqi <[email protected]>
* fix(webfetch): score returned structured page fields Port of #252 (16 commits, head cebd6aa) onto #224 rebased on current #131, resolved once. Same behavior as cebd6aa except: - Keep main's CJK rule (#253): plain text folds letter-spaced single characters only, so separate CJK words or paragraphs never join (cjk-separate-paragraphs-fact-rejected passes again). The plain-text-typography control no longer relies on joining 中文 文本. - Catalog price-heading cards keep #252's broader condition, which covers main's #250 case. - Keep both stable-anchor fallbacks (escaped prose from #131, link labels and extracted fields from #252). - Bind loop variables for B023 and recompute scorer source hashes; add #252's two correction records to the migration receipt. Co-authored-by: Maisiqi <[email protected]> * fix(webfetch): stop link labels and document titles from passing content checks Independent review of #252 found two false passes in the shared scorer: - Labels of returned links (Firecrawl, Exa and Lexmount return page-wide link lists) satisfied required body facts and stable anchors, so a truncated body plus a table-of-contents link passed. Link labels no longer feed facts or anchors, and tasks without an acceptance contract keep body-only facts. - The Lexmount projection copied the document title (result.title) into page_information.title, letting it pass title contracts that reject document titles. It is already scored as the title field. returned-link-label becomes a negative control; returned-link-fact-cross-page is new. Both are bound in a new correction record. * fix(webfetch): keep malformed Lexmount envelopes free of answer fields After rebasing onto main (#224), a non-JSON body still merged projected page fields into metadata without a declaration, so its evidence failed verification. Merge answer fields only for a parsed envelope. Refresh the route baseline for the projection source hash. * fix(webfetch): keep returned-field scoring within declared scope Returned headings no longer satisfy title checks that exclude page regions, since a flat field cannot prove it came from outside them. Remove the dev.to-specific comment-card parser and revert the unbound named-link, catalog-boundary, Han-spacing and section-heading scoring changes to main; they need their own bound corrections. * fix(webfetch): keep returned duplicates and paragraph breaks visible to checks Repeated returned records now reach the duplicate-record check, and plain-text paragraphs ending in CJK punctuation no longer join. A trailing reply-form heading no longer hides earlier comments. Report evidence shows only fields the scorer accepts for an anchor, and the method-comparison caption is localized. Bind two new controls. * fix(webfetch): merge returned records only with valid, case-exact text rows A complete returned record replaces the same fields parsed as invalid text, and API paths that differ only in case stay separate records. Revert the comment discussion-heading start rule to main: a populated reply-form heading could hide earlier comments. * fix(webfetch): let each text record absorb only one returned copy Further identical returned rows reach the duplicate-record check even when the body also contains the record. Bind a paired control. * fix(webfetch): consume each text record once across quote and exact matches A body quote could absorb one returned copy by exact fields and another by equivalent tags. Track consumed text rows by index. Bind a quote control. --------- Co-authored-by: lanyue-llk <[email protected]> Co-authored-by: Maisiqi <[email protected]>
Question
Why do correct stored answers still fail after #250, and why can a full rescore not finish?
Causes and fixes
Nested links from Obscura. It keeps source-HTML nesting, so its links sit in Markdown indented code blocks and parse to 0 records.
_without_nested_link_indentationremoves that indentation only when an indented link line exists and the answer has 5 or more whitespace-only deep lines, the signature of this serializer defect. Ordinary code samples do not leave those lines, so they stay literal; a sample with 5 such lines would still be read as page text (synthetic only, no stored row seen). Declared Markdown is unaffected.Letter-spaced CJK labels.
登录against page text登 录failed._LETTER_SPACED_CJKjoins only runs of single CJK characters. It applies to anchors and facts at this call site. Words of two or more characters stay separate, so首页 登录does not match首页登录. Single characters in separate paragraphs can still join:<p>北</p><p>京</p>matches北京(synthetic only). The existing Markdown fold is unchanged.Repeated tokenizing.
_markdown_html_tag_spansreparsed the whole document after every code span and for every fact. It now has anlru_cache(maxsize=256), and a code span with no<,>or quote skips the reparse. Known limit: masking can still move a boundary after a tag name (<script></script`x`>); this is accepted and stated in the code. Fuzzing found no difference on ordinary documents, and no stored row was seen to change.Evidence
Read-only rescore on copies of stored rows, main against this head: 554 rows compared (including 99 random rows). Ten verdicts change, all fail to pass, and all ten match the stored verdict.
dynamic-products-api,dynamic-074-melon-com-chart,challenge-02,challenge-05,dynamic-062-zh-sspai-homechina-homepage-065-lingxing-com登 录An independent review rejected the first version of both rules, which gave unearned passes. Each case it found is now a paired control: a nested code cheatsheet, unrelated samples, a product sample and Python call syntax stay literal; a sample with an unbalanced fence, open comment or script tag keeps the page's links;
北京大学across paragraphs,不含税split across lines,1月,100元, two separate links,首页 登录and攀登 录像do not match.Diagnostic metrics move on rule-touched Obscura rows. Mean
word_f1rises 0.063 on 81 rows, and 65 move closer to the stored value, so a rebuilt report's Obscura diagnostics would change and must say so.Targeted tests:
tests/test_scoring_regressions.py,tests/benchmarks/test_current_scoring_controls.pyandtests/test_golden_reports.pypass (31 tests, 3,996 subtests).make lint-checkpasses.Not done
dynamic-058-zh-stable-tdesign-table(lightpanda) anddynamic-025-025-tabulator-vertical-virtual-dom(obscura) still did not finish within the time limit, so they are not compared.live-029-fetch(moli-fixed) anddynamic-058-zh-stable-tdesign-table(obscura) finished only on this head, so 4 rows have no main comparison.