Repository navigation
fix(web-fetch): score declared image links and heading-price catalog cards - #250
Conversation
There was a problem hiding this comment.
This review found 2 issue(s), including 2 blocking issue(s).
| "expected_task_pass": false | ||
| }, | ||
| { | ||
| "id": "catalog-heading-price-title-cards-complete", |
There was a problem hiding this comment.
P2 — Add a compatibility control for the shared product parser, not only price-first catalog cards. With schema: product, minimum_records: 1, and artifact Alpha\n#### $10, the previous _product_start recognized name + price; the new heading-level guard skips Alpha, then creates a price-only record (the price-first branch supplies a title only for catalog_product). This loses a previously complete record, but both new catalog controls miss it. Add an expected-pass control for this layout and preserve that behavior in the parser before updating the correction binding. This is a localized scoring compatibility/coverage regression.
| next_price = index + 1 < len(lines) and re.fullmatch(_MONEY, _field(lines[index + 1], "price"), re.I) | ||
| # A heading price starts its own card; a plain line above it is not its title. | ||
| next_price = (index + 1 < len(lines) | ||
| and not (levels and levels[index] is None and levels[index + 1] is not None) |
There was a problem hiding this comment.
P2 — Preserve the supported title-before-price layout for product cards. With schema product, Alpha\n#### $10 previously produced a valid {name: "Alpha", price: "$10"} record. This new condition skips Alpha; the price-first branch then returns only price because it consumes a following title only for catalog_product, so _record reports invalid_field:name. The same regression applies to native HTML with a plain name followed by a heading price. This is a localized scoring regression, not just missing coverage. Restrict the catalog boundary fix so it preserves the existing product layout, and add a public-scoring regression control for it alongside the new catalog controls.
a51d6f4 to
04ca091
Compare
There was a problem hiding this comment.
This review found 1 issue(s), including 1 blocking issue(s).
| next_price = (index + 1 < len(lines) | ||
| and not (levels[index] is None and levels[index + 1] is not None | ||
| and index + 2 < len(lines) and levels[index + 2] is not None) |
There was a problem hiding this comment.
P2: Restrict this heading-price disambiguation to catalog cards. For the supported product schema, Alpha\n#### $10\n#### Free shipping\n previously yields a valid name/price record with shipping. The new condition skips Alpha because the following two lines are headings; parsing then starts at $10, and the product price-first branch never consumes a name, producing invalid_field:name. This also affects a heading price followed by a new section heading. The added product regression only covers end-of-input, so it misses this remaining false negative. Gate the exception on schema == "catalog_product" and add a product control with a following heading.
…cards
The rendered-DOM image route returns {"links": [...]} under the declared
structured_resource_urls contract, but image-answer scoring read only
image-typed JSON keys, so every headless image task scored zero. Read that
declared list as image candidates; undeclared JSON and diagnostic keys stay
excluded.
A plain line above a heading price was taken as the card title, so
'#### $price' + '#### [title]' catalog cards lost their titles and parsed
to zero complete records. A heading price now starts its own card.
Adds five paired controls and the matching code-migration bindings.
A heading price only starts its own card when a heading title follows it. Plain 'Alpha' then '#### $10' stays title-first, as it was before this branch. Adds controls for both product schemas and updates the scorer bindings.
The price-first branch reads a title only for catalog_product, so applying the rule to product cards lost the name in 'Alpha', '#### $10', '#### Free shipping'. Product parsing now matches main. Adds a control and updates the scorer bindings.
2649d5b to
2126b47
Compare
There was a problem hiding this comment.
This review found 1 issue(s), including 1 blocking issue(s).
| and levels[index] is None and levels[index + 1] is not None | ||
| and index + 2 < len(lines) and levels[index + 2] is not None) |
There was a problem hiding this comment.
P2: This also suppresses a valid title-first catalog card when the heading after the price is a deeper description heading. For example, Alpha\n#### $10\n##### Blue machine\n2 reviews previously produces a complete catalog record: the level-5 heading belongs to the level-4 card's description. Now Alpha is skipped, Blue machine becomes the title, and the empty description makes the record invalid. Restrict the price-first override to a heading that actually establishes the next card title (accounting for heading levels), and add a catalog title-first regression with a deeper heading after the price; the new heading-after-price control only covers product.
Only a heading no deeper than the price is the next card's title. In 'Alpha', '#### $10', '##### Blue machine', '2 reviews' the deeper heading is the description, so the card stays title-first as on main. Adds a control and updates the scorer bindings.
There was a problem hiding this comment.
✅ Re-review complete · b6995c2
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 tasks that passed on stored answers fail when those same answers are rescored by the current scorer, and do the closed fixes for #85 and #86 reach real runs?
Cause
candidate_scope: image_answer_fields, 9 tasks){"links":[...]}and declaresoutput_contract: structured_resource_urls. The image branch reads only image-typed JSON keys, so it finds no candidates.dynamic-catalog,dynamic-020-webscraper-io-test)_product_start, the title-then-price layout claims any line above a price. For#### $pricethen#### [title], the title becomes117 itemsor the previous card's1 reviews, and the real title ends the card. Result: 0 complete records.Fix
metrics.py: underimage_answer_fields, read the top-levellinksstrings only when the route declaresstructured_resource_urls. Only the headless route sets that value, and its image selector isimg,picture source, so that list holds image URLs.imageswould change the projection expression and its hash, and stored answers would stay at 0 until a rerun. This fix leaves the projection and its hash unchanged.stable_tasks.py: incatalog_productonly, when a heading price is followed by a heading no deeper than it, the plain line above is no longer taken as the title, so the price starts its own card.productparsing matchesmain, and catalogAlphathen#### $10with no heading after it, or with a deeper heading as its description, stays title-first.scoring-regressions.json, 2 correction entries and new hashes incode-migration.json.SCORING_SOURCE_SHA256is now0cc6d7df…, which moves six routes intests/golden/web-fetch.json(the same six as fix(web-fetch): repair six scorer defects with paired controls #239). I did not separately prove those golden changes are hash-only.Evidence
Stored answers in
webfetch-430-refresh-20261014/evidence, rescored read-only with cases from itsdataset.json. No provider ran and no stored file changed.Image tasks, passes out of 9:
mainCatalog tasks: all 6 providers go from stored 2/2 to 0/2 on
mainto 2/2 with this PR. The other 2 tasks using a product schema give identical verdicts on both trees.This does not restore every stored image verdict. The remaining gaps have other causes:
dataset.json. For example,image-04now expects Wikimedia thumbnail URLs withutm_*query strings. Chromium's answer has no such URL. Kitesurf's has the thumbnail path, but the task still fails.image-pexels-detailpassed only because the old scorer's bare-URL reader dropped the query string. Its answer haspexels-photo-12377231.jpeg?auto=compress..., while the task expects no query.Controls
mainscorerstructured-resource-route-image-links-answerstructured-resource-route-undeclared-links-rejectedstructured-resource-route-diagnostic-json-rejectedcatalog-heading-price-title-cards-completecatalog-heading-price-without-title-incompletecatalog-plain-title-above-heading-price-completeproduct-plain-title-above-heading-price-completeproduct-plain-title-above-heading-price-and-heading-completecatalog-plain-title-above-heading-price-deeper-description-completeTwo controls flip; the other seven are guards that already held. The last four pin the title-first layout, which earlier revisions of this PR broke.
answer_format(#85, #86): not reachable in real runs, left unchangedsrc/harness,scripts,configsorevaluationdeclaresanswer_format; only regression fixtures do.results.jsonlfiles found under~/.browser-eval/evidence, skipping any of 1 KiB or less, found none containinganswer_format.score_attemptrecords the field when it is declared.htmland the Plain-text document structure is still parsed with Markdown syntax #86 fix only to declaredplain_text, so neither runs for these answers. Their tests pass because the fixtures declare the format.Tests
Rebased on
506b2743.tests/benchmarks,tests/test_scoring_regressions.pyandtests/test_golden_reports.pygave 11407 passed, 4326 subtests passed. Ruff passes. The 22 distinct stored catalog answers each still give 6 complete records.04ca0916: 14 failed, 20053 passed, 61 skipped. The baseline ond053e239was also 14 failed, with the same 13 tests (Node converter, CI gate, local data) plus the same Moli subtest failure,test_answer_capacity_does_not_limit_native_resource_downloads, which passes alone. Parser changes since then are thecatalog_productgate and the heading-level check; the rebases also brought in other changes frommain.tests/trajectory_replay/test_playwright_tool.pyfailed in one earlier full run on this branch and passes alone and in the04ca0916run.Known limit
A rescore of all 2,580 stored records was stopped unfinished, so verdict changes outside the 13 tasks above are unchecked.
What I did not do
answer_format.linksreader, but no control pins that.