Skip to content

fix(webfetch): report non-executable revision references as unavailable - #262

Merged
lanyue-llk merged 3 commits into
mainfrom
fix/revision-reference-controls
Nov 10, 2026
Merged

lanyue-llk merged 3 commits into
mainfrom
fix/revision-reference-controls

Conversation

@lanyue-llk

@lanyue-llk lanyue-llk commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

Revision export gate reference controls

Problem

lexbench-webfetch export --revision primary-content-20261103 rejected HF Lexmount/LexBench-Web-Fetch PR #3 (refs/pr/3, head 9b724b6) on 72 controls: webfetch 17, popular-sites 43, dynamic-content 9 and articles 044/102/104. check_revision_references scored the descriptive reference_answer, record-task ground truth and body-only ground_truth_main_content as complete answers. Those tasks also need records, page anchors, titles, comments, links or files, which a text field can't hold.

The same revision has to copy 460 of its 532 reviews.json entries from review-550-20261023, because every change row needs its own entry.

Change

  • Dataset reference text is scored with answer_format: plain_text.
  • A rejected text counts as a full-answer control only when it could be a complete answer. That means the contract asks for nothing beyond text (no records, anchors, components, resources, files, composite lists or trees), or the text fails its own body requirement. Otherwise the text goes into incomplete_reference_answers and the case is unavailable. A passing text still passes. Review-evidence sources keep their current scoring.
  • The error-page control is unchanged. An accepted error page still fails every case.
  • A revision review can declare "inherits": "<predecessor id>". After the predecessor file is checked against definition['predecessor'].sha256 and its review hash, any change row byte-identical to the predecessor's reuses the predecessor's effective entry (its explicit entries plus whatever it inherits itself, along with shared reason_ref reasons). All the existing per-entry checks still run. Reviews without inherits validate as before.
  • score_attempt is unchanged, so this PR adds no scoring-regression controls. code-migration.json refreshes benchmark.py after_sha256 and adds a correction record.

Verification

I ran the real export gate against the PR #3 working tree, with every suite exported into a fresh scratch directory:

Suite Before After
webfetch gate fails (17 failed) passes: 117 passed, 33 unavailable
popular-sites gate fails (43 failed) passes: 20 passed, 80 unavailable
dynamic-content gate fails (9 failed) passes: 21 passed, 79 unavailable
access-restrictions passes (86 unavailable) passes: 86 unavailable
articles gate fails (3 failed) passes: 59 passed, 37 unavailable

No suite accepts the error page.

Inheritance check: I removed the 460 identical entries from a copy of PR #3 reviews.json and added inherits: review-550-20261023. For all five suites, the revised datasets and review records match the explicit 532-entry version. The published revisions (serialization-20261021, review-550-20261023) still pass inspect_annotation_revision for every suite.

New tests:

  • A wrong body reference still fails.
  • A text-only contract passes a correct reference and fails one that lacks a required fact.
  • A body-only reference under a page-anchor contract is unavailable.
  • Inheritance reuses identical rows, works across a three-revision chain, and rejects a changed row, an undeclared predecessor and a wrong predecessor hash.

uv run --frozen --all-extras python -m pytest tests/benchmarks/webfetch tests/benchmarks/test_current_scoring_controls.py: 11102 passed. make lint-check passes.

Review fix and what the gate still guarantees

An independent review found that a wrong required fact or pattern was excused whenever the contract also had an anchor or record check. Any failed text check (body, facts, patterns, literals, length, content) is now conclusive, and the regression test test_wrong_text_requirement_fails_beside_a_passing_anchor covers it. The HF #3 export results are unchanged (webfetch 117/33, popular sites 20/80, dynamic content 21/79, access restrictions 0/86, articles 59/37, error page accepted nowhere).

The gate does not require a revision to show a passing executable control; main didn't either. What remains:

  • the error-page control must fail;
  • a body or text-check failure fails;
  • text-only contracts are fully checked;
  • review-evidence controls run when --review-source is supplied;
  • the hash-bound review (changes_sha256, source hashes, regression IDs) still applies.

A replaced body anchor that a body-only text lacks is reported unavailable, not failed.

The revision export gate scored descriptive reference_answer text,
record-task ground truth and body-only ground_truth_main_content as full
answers. Tasks that also need records, anchors, titles, comments, links or
files then failed the gate (72 controls in HF LexBench-Web-Fetch PR #3).

Score dataset reference text as plain_text. A rejected text that cannot
carry every declared requirement, and still meets its body requirement, is
recorded under incomplete_reference_answers and leaves the case
unavailable. Body failures, text-only contract failures and accepted error
pages still fail.

Let a review declare inherits: <predecessor id>. After checking the
predecessor hash, change rows byte-identical to the predecessor's reuse its
review entry, so a cumulative revision need not copy 460 entries. Reviews
without inherits validate as before.

@lexmount-ocr lexmount-ocr Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Review complete · 31cb316

This review found 1 issue(s), including 1 blocking issue(s).

shared = previous_review.get('shared_reasons', {})
reviewed = {(item['suite'], item['case_id']) for item in entries}
inherited = []
for item in previous_review.get('changes', []):

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bug · medium
P2: Resolve the predecessor's inherited entries before copying its reviews. For a valid chain A → B → C, where B uses inherits: A and omits unchanged entries, C using inherits: B sees only B's explicit changes. Even when the rows and all predecessor hashes match, the omitted entries are never inherited and _review_annotation raises Annotation review task inventory differs. This makes a successfully inherited revision unusable as a complete inheritance source for the next revision. Expand the predecessor's effective entries (with the same hash checks and reason resolution at each hop) before applying the current row-equality filter, and add a three-revision-chain test.

A revision that itself inherits listed only its explicit entries, so the
next revision in a chain could not reuse the omitted ones. Expand the
predecessor's inherited entries, with the same hash checks and reason
resolution at each hop, before filtering identical rows. Add a
three-revision chain test.

@lexmount-ocr lexmount-ocr Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Re-review complete · 9c94c83

No findings in this incremental review.

@lexmount-ocr lexmount-ocr Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Re-review complete · aacac21

No findings in this incremental review.

@lanyue-llk

Copy link
Copy Markdown
Contributor Author

Independent review: P1 at 9c94c83e (a wrong fact/pattern was excused beside a passing anchor) fixed in aacac21e; re-review says merge, no new P0/P1. HF #3 export unchanged; published revision exports unchanged. Non-blocking P2s: a replaced body anchor exports as unavailable; unknown check names default to inconclusive; changed_rules_complete is reported, not enforced; inherited predecessor entries are bound only through the predecessor file hash.

@lanyue-llk
lanyue-llk merged commit 351cb27 into main Nov 10, 2026
8 checks passed
@lanyue-llk
lanyue-llk deleted the fix/revision-reference-controls branch November 10, 2026 14:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant