Skip to content

HTML product acceptance drops prices split by inline formatting #110

Closed

Description

@lanyue-llk

HTML product acceptance rejects a price split by inline formatting.

A complete record with <p class="price">$10.00</p> passes, but changing it to <p class="price">$<strong>10.00</strong></p> fails with zero complete records. Both render the same price. This occurs with and without an explicit .product / .price entry scope.

Reproduction through the public scorer:

from lexbench_webfetch.scoring import score_attempt
from lexbench_webfetch.metrics import task_passed

case = {
    "url": "https://shop.example/catalog",
    "expected_any": [],
    "acceptance_contract": {
        "version": 1,
        "schema": "linked_product",
        "minimum_records": 1,
        "hosts": ["shop.example"],
        "entry_path": r"/item/\d+",
        "stable_text_anchors": [],
        "price_patterns": [r"\$\d+\.\d{2}"],
    },
}
for price in ["$10.00", "$<strong>10.00</strong>"]:
    html = f'<article class="product"><a href="/item/1">Widget</a><p class="price">{price}</p></article>'
    metrics = score_attempt(case, html.encode(), ok=True, metadata={"answer_format": "html"})
    print(price, task_passed(True, metrics))

Observed on both the pinned upstream scorer at 5a5b9367118dcc25f126ee16ef4de2d7c666f190 and PR #81: plain price passes; inline-formatted price fails. The scoped path joins text nodes with spaces, splitting the currency token; the unscoped path applies the price pattern to raw markup.

Expected: preserve visible inline price text within its own record. Controls should cover plain and inline-formatted prices, scoped and unscoped records, and a neighboring record's price that must not fill a missing field.

This defect predates the consolidation. Tracked separately under the maintainer's scope instruction, from the PR #81 review.

Activity

  1. self-assigned this
    on Oct 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions