Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .agents/skills/benchmark-report/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,14 @@ For an explicitly requested full review, set `independent_result_review_scope: a

## Frozen report extensions

For a separate configuration experiment, use the saved publication owner's
`configuration_comparisons` instead of adding participants to its leaderboard.
Bind a complete saved comparison and retain its original task contracts, scores,
languages and evidence. The Web Fetch guide documents its build and check contract.
Retain each selected source's execution settings. Presentation gates verify the
hash-bound predecessor HTML and apply current semantic checks to new projections,
including embedded comparisons; diagnostic views do not introduce winner styling.

When adding saved methods to an existing publication, inspect both frozen task
contracts and scorer identities before combining ranks. Different editions retain
their own saved values and evidence. Default to unranked presentation; when the user
Expand Down
32 changes: 28 additions & 4 deletions src/harness/reporting/publication_privacy.py
Original file line number Diff line number Diff line change
Expand Up @@ -1181,20 +1181,23 @@ def project(value, *, secret=False):
'original_bytes': len(data), 'published_bytes': len(projected)}


def project_result_diagnostics(name, data):
def project_result_diagnostics(name, data, *, case=None, answer=None):
"""Redact quoted output diagnostics without changing result authority.

Only passage quotations and resource-URL diagnostics may differ. Original
records stay at source; callers must bind this separate presentation receipt
and verify its projection against those originals at the report boundary.
Passage quotations and resource-URL diagnostics may differ. Native answer
fields additionally require their bound scorer and unchanged task acceptance.
Original records stay at source; callers bind this separate presentation
receipt and verify its projection at the report boundary.
"""
public, receipt = project_file(name, data)
if receipt is None:
return data, None
before, after = json.loads(data), json.loads(public)
changed = []
acceptance_context_changed = False

def compare(left, right, path=()):
nonlocal acceptance_context_changed
if left == right:
return
if isinstance(left, dict) and isinstance(right, dict) and left.keys() == right.keys():
Expand All @@ -1210,10 +1213,31 @@ def compare(left, right, path=()):
('metrics', 'resource_candidates', '*', 'url'),
('metrics', 'unexpected_resource_urls', '*')}:
changed.append('/'.join(map(str, path)))
elif (case is not None and answer is not None
and isinstance(left, str) and isinstance(right, str)
and tuple('*' if isinstance(part, int) else part for part in path) in {
('provider_metadata', 'links', '*'),
('provider_metadata', 'links', '*', 'href'),
('provider_metadata', 'images', '*', 'src'),
('provider_metadata', 'page_information', 'paragraphs', '*'),
('final_url',)}):
acceptance_context_changed = True
changed.append('/'.join(map(str, path)))
else:
raise ValueError('Public result diagnostics would change non-diagnostic authority')

compare(before, after)
if acceptance_context_changed:
from lexbench_webfetch.metrics import task_passed
from lexbench_webfetch.scoring import SCORING_SOURCE_SHA256, score_attempt
if before['metrics'].get('scoring_source_sha256') != SCORING_SOURCE_SHA256:
raise ValueError('Changed native view requires its bound scoring version')
metrics = score_attempt(case, answer, ok=before['ok'], status_code=before.get('status_code'),
metadata=after.get('provider_metadata'), previous_metrics=before['metrics'],
title=after.get('title'), final_url=after.get('final_url'))
if task_passed(before['ok'], metrics, case.get('task_kind', 'body')) != task_passed(
before['ok'], before['metrics'], case.get('task_kind', 'body')):
raise ValueError('Public native projection changes task acceptance')
return public, {**receipt, 'kind': 'post_score_result_diagnostics_view',
'changed_fields': changed, 'measurements_unchanged': True,
'original_retained_privately': True, 'provider_calls_added': 0}
Expand Down
8 changes: 6 additions & 2 deletions src/harness/reporting/release_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,28 +124,32 @@ class ReleaseRules:
``identity`` and ``evidence`` are the track's own rules. ``languages`` and
``links`` default to the shared checks; a track replaces one only when its
layout differs, and names the replacement's reason where it declares it.
Presentation defaults to the shared checker. A frozen-template adapter may
retain verified predecessor markup while checking every current view.
"""

identity: Callable[[Path], object]
evidence: Callable[[Path], object] | None = None
languages: Callable[[Path], object] | None = check_language_editions
links: Callable[[Path], object] | None = check_links
visual: VisualReceipt | None = None
presentation: Callable[[Path], object] | None = None


def validate_release(report, rules: ReleaseRules) -> dict[str, object]:
"""Run the release gate in its fixed order and return each stage's result.

Order: identity, languages, links, presentation, evidence bindings, visual
receipt. The presentation stage is shared and always runs.
receipt. Presentation always runs; frozen-source adapters retain old HTML
identities while applying the shared checker to current views.
"""
root = open_report(report)
results: dict[str, object] = {"identity": rules.identity(root)}
if rules.languages is not None:
results["languages"] = rules.languages(root)
if rules.links is not None:
results["links"] = rules.links(root)
results["presentation"] = check_report_presentation(root)
results["presentation"] = (rules.presentation or check_report_presentation)(root)
if rules.evidence is not None:
results["evidence"] = rules.evidence(root)
if rules.visual is not None:
Expand Down
23 changes: 23 additions & 0 deletions src/harness/web_fetch/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1657,6 +1657,7 @@ tables use final-call latency; accumulated retry cost stays in the evidence.
- The hash-bound specification declares datasets, providers, selected results and evidenced missing outcomes. Suite-qualified identities preserve original cases and scores. No provider calls, rescoring or certification are added.
- This mode uses the existing Web Fetch renderer, including datasets, method pages and result/reference comparisons. Missing outcomes have a separate inventory. Keep the HTML pages and evidence directories together.
- Set `public_evidence_views: true` for a fixed text-output selection when native responses or diagnostic logs need inspectable public copies. The shared privacy owner creates separately hash-bound post-score views; original result records, source artifacts and scores remain immutable. A changed displayed answer must preserve task acceptance. Each evidence scope retains its view inventory and original/public identities, including declared split retries. The source-spec check reproduces these views from originals and rejects altered or missing copies. Scoring-only revisions with unchanged task contracts, call inputs and answer bytes are supported: the public predecessor is an explicitly labeled historical score summary bound to the original record hash, not a historical scorer replay. Original predecessor records remain in private evidence. Parameter candidates, adoptions, changed answer fields and superseded histories are excluded; this option does not weaken acquisition checks or add provider calls.
Native link, image, paragraph and redirect views require the acquisition scorer and unchanged task acceptance. Direct Lexmount retry replay verifies the retained native response and hash-bound API call log, including the logging owner's URL redaction. Missing events, inconsistent status, changed redirect targets or acceptance changes fail before publication.
- When quoted output passages or resource-URL diagnostics contain sensitive values, the same public-view mode projects only those diagnostic strings in the report copy of `record.json`. A separate `result-diagnostics-view.json` binds its original/public hashes and exact changed fields. All scores, counts, timings, verdicts and other result authority must remain identical; source-backed checks reproduce the projection and reject unrelated changes. Result pages disclose the projection and link its receipt. Original source records remain private and immutable.
- Optional `pricing` binds an external public price catalog by path and SHA-256. It must cover every selected participant. The report copies it to `report-assets/provider-pricing.json`, renders prices and registered interfaces for the measured cohort, and checks the source bytes again during rebuild validation. Without this binding, historical saved reports retain their explicit unavailable-price state.
- Optional `report_families` lists ordered `{id, label}` entries for every observed task family. It groups the presentation by task content (including embedded media versus direct files), while preserving suite-qualified evidence identities and all saved scores.
Expand Down Expand Up @@ -1696,6 +1697,28 @@ language must show the same comparison population and valid evidence links;
evidence uses its frozen English edition when available, otherwise its original
language.

Optional `configuration_comparisons` adds separately frozen saved reports to the
home page without changing leaderboard participants, ranks or result inventories.
Each entry declares an `id`, report `root`, path/hash `audit` binding, and English
and Chinese `title` and `description`. The complete comparison remains available
under `comparisons/<id>/`; the home table retains its saved values and evidence
links. Every generated parent language requires the same comparison language.
Build, refresh and portable checks verify these sources and displayed tables.
To retain an already extended publication byte for byte, bind its
`saved-extension.json` as `published_base.audit` and omit `additional_report`.
This appends the separate comparisons and retains every original page and result;
it does not rebuild the leaderboard with a newer renderer. Packaging resolves
lazy evidence against each frozen report's own file inventory, including nested
source reports.
Selected sources retain their verified execution settings. The release gate keeps
hash-bound predecessor HTML under its original renderer and checks all current
views and embedded comparisons with the shared semantic presentation rules.
When composing frozen reports with different task ID namespaces,
`saved_reports[].case_id_mapping` maps every `suite--source_id` to a unique target
ID within that suite. This requires `retain_source_task_contracts`; task names,
URLs and deliverable kinds must still match, and original cases and records stay
unchanged.

Use `scripts/build_report.py --variant saved-matrix --input SPEC --output NEW_REPORT` and
`scripts/check_report.py NEW_REPORT --variant saved-matrix --source-spec SPEC`. Package with
`uv run --frozen python -m harness.web_fetch site-package NEW_REPORT ARCHIVE
Expand Down
1 change: 1 addition & 0 deletions src/harness/web_fetch/data/report-methods.json
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@
}
},
"lexmount": {
"engine_is_method": false,
"endpoint": "POST https://api.lexmount.com/v1/extract",
"contract": {
"zh": "已知 URL → 主正文 + 元数据",
Expand Down
6 changes: 4 additions & 2 deletions src/harness/web_fetch/methods.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,10 @@ def report_method(name, record=None, *, language="zh", scope):
methods = (report_method_catalog() if language == "zh" else report_method_catalog(language))["methods"]
record = record or scope.records.get(name, {})
metadata = record.get("provider_metadata") or {}
if metadata.get("engine"):
return methods.get(metadata["engine"], {})
engine = metadata.get('engine')
adapter = report_method_catalog(language)['adapters'].get(record.get('provider_type'), {})
if engine and adapter.get('engine_is_method', True):
return methods.get(engine, {}) if isinstance(engine, str) else {}
execution = browser_method_registry(scope=scope).get(name, {})
for key in (execution.get("engine"), name):
if key in methods:
Expand Down
10 changes: 9 additions & 1 deletion src/harness/web_fetch/providers/lexmount.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def normalize_native_http_body(self, body, case):
return True
return False
native_configuration_fields = Provider.native_configuration_fields + (
'engine', 'trace_include_steps')
'engine', 'trace_include_steps', 'use_proxy')

@staticmethod
def native_answer_selection(selection):
Expand Down Expand Up @@ -121,12 +121,19 @@ def native_http_arguments(self, case, timeout):
'options': {'engine_preference': engine}}}
if trace:
body['trace'] = {'include_steps': True}
self._configure_proxy(body)
return (str(self.config.get('base_url', 'https://api.lexmount.com')).rstrip('/') + '/v1/extract',
self.native_http_options(body, {
'X-API-Key': str(self.config.get('api_key', '')),
'X-Project-Id': str(self.config.get('project_id', '')),
}, timeout))

def _configure_proxy(self, body):
if 'use_proxy' in self.config:
if type(self.config['use_proxy']) is not bool:
raise ValueError('Lexmount use_proxy must be boolean')
body['use_proxy'] = self.config['use_proxy']

def validate(self) -> list[str]:
missing = []
if not self.config.get("api_key"):
Expand Down Expand Up @@ -224,6 +231,7 @@ def fetch(self, case: EvalCase, timeout: float, *, native_route_ledger=None) ->
"X-API-Key": str(self.config.get("api_key", "")),
"X-Project-Id": str(self.config.get("project_id", "")),
}, json_body={"extract": extract})
self._configure_proxy(arguments['json_body'])
response = self.native_http_request(case, request, endpoint,
native_route_ledger=native_route_ledger, **arguments)
try:
Expand Down
17 changes: 13 additions & 4 deletions src/harness/web_fetch/report.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import statistics
from collections import Counter, defaultdict
from dataclasses import replace
from functools import lru_cache
from math import ceil
from pathlib import Path
from urllib.parse import urlsplit
Expand Down Expand Up @@ -456,9 +457,9 @@ def comparative_rows(rows, directions, *, ctx):
metric,direction=directions[index];column,extreme,unique=numbers[index]
fragment=cells[index].group();opening,body=fragment.split('>',1)
if column[row_number] is None:opening=re.sub(r' data-sort="[^"]+"','',opening)
opening+=' data-metric="'+metric+'" data-metric-direction="'+direction+'"'
opening+=' data-metric="'+metric+'" data-metric-direction="'+(direction if ctx.comparison_highlights else 'neutral')+'"'
content=body[:-5]
if (unique or ctx.descriptive_ranks) and column[row_number] is not None and column[row_number]==extreme:
if ctx.comparison_highlights and (unique or ctx.descriptive_ranks) and column[row_number] is not None and column[row_number]==extreme:
content='<strong class="comparison-winner good">'+content+'</strong>'
values=values[:cells[index].start()]+opening+'>'+content+'</td>'+values[cells[index].end():]
result.append((attrs,values))
Expand Down Expand Up @@ -832,9 +833,16 @@ def result_view(record, *, ctx):
views=ctx.result_views
return views.get((record['provider'],record['case_id']),{}) if views else {}

@lru_cache(maxsize=8192)
def _saved_source_case(path):
return json.loads(Path(path).read_bytes())

def result_case(record,fallback, *, ctx):
"""Keep each saved result's own rules separate from its comparison identity."""
return result_view(record, ctx=ctx).get('case',fallback)
selected=result_view(record, ctx=ctx).get('case')
if selected is not None:return selected
source=record.get('report_source_case_path')
return _saved_source_case(str(contained_path(ctx.source_root,source,reject_symlinks=True))) if source and ctx.source_root is not None else record.get('report_source_case') or fallback

def result_href(record,kind,base='', *, ctx):
"""Resolve a retained evidence route relative to the report root."""
Expand Down Expand Up @@ -2055,7 +2063,7 @@ def _write_uncalled_participants(out,model, *, ctx):

@with_measured_method_labels
def _render_model(out,dataset,records,manifests,*,model,scope):
ctx=model_render_context(model,methods=scope)
ctx=model_render_context(model,methods=scope,source_root=out)
options=model.options
include_english,authored_interpretation,presentation_only=options.include_english,options.authored_interpretation,options.presentation_only
show_local_status_banners,detail_attempt_ids,dataset_case_ids=options.show_local_status_banners,options.detail_attempt_ids,options.dataset_case_ids
Expand All @@ -2068,6 +2076,7 @@ def _render_model(out,dataset,records,manifests,*,model,scope):
score_binding=dataset.get('comparison',{}).get('score_audit')
score_audit=json.loads(contained_path(out,score_binding['path']).read_text(encoding='utf-8')) if score_binding else None
diagnostic=bool(score_audit) or (local_snapshot and not local_pass_rate_ranking(dataset))
ctx=replace(ctx,comparison_highlights=not diagnostic)
if local_snapshot and not show_local_status_banners:
raise ValueError('Uncertified local diagnostic status cannot be hidden')
reliability=assess_reliability(dataset,records)
Expand Down
8 changes: 4 additions & 4 deletions src/harness/web_fetch/report_explainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -1098,7 +1098,7 @@ def handle_endtag(self,tag):

def _saved_failure_chapters(cases, records, *, ctx):
"""Explain the full failure population using recorded program evidence only."""
from harness.web_fetch.report import provider_label, measured, succeeded, result_case, result_href
from harness.web_fetch.report import provider_label, measured, succeeded, result_case, result_href, failure_category
heading = t('saved_failure_chapters', 'Why each method did not pass')
note = t('saved_failure_categories_note', 'These categories cover every failed result and come from program checks and returned evidence. One category can have different causes; unreviewed results do not establish a site or provider root cause.')
chapters = []
Expand All @@ -1108,8 +1108,7 @@ def _saved_failure_chapters(cases, records, *, ctx):
failed = [row for row in eligible if not succeeded(row, cases[row['case_id']], ctx=ctx)]
grouped = {}
for row in failed:
category = (row.get('diagnosis') or {}).get('category') or t(
'failed_without_detailed_diagnosis', 'Failed without a detailed diagnosis')
category = failure_category(row, cases[row['case_id']], ctx=ctx)
grouped.setdefault(category, []).append(row)
rows, examples = [], []
for category, members in sorted(grouped.items(), key=lambda item: (-len(item[1]), item[0])):
Expand Down Expand Up @@ -1173,7 +1172,8 @@ def render_explainer(out, cases, records, *, table=None, cell=None, link=None, a
context = '<div role="region" aria-label="'+escape(title)+'">'+report_table(
[t('method', 'Method'), t('saved_results', 'Saved results'),
t('saved_passed', 'Passed'), t('saved_pass_rate', 'Pass rate')],
comparative_rows(rows,{3:('saved-guide-pass-rate','max')}, ctx=ctx),metrics=[])+'</div>'
comparative_rows(rows,{} if scope.get('presentation') == 'audit' else {
3:('saved-guide-pass-rate','max')}, ctx=ctx),metrics=[])+'</div>'
context += '<p>'+t('saved_task_acceptance_note', 'Passing requires every applicable task check to succeed. Returned content can still omit required passages, records, resources or files; result details retain the full returned output and frozen reference.')+'</p>'
context += _saved_failure_chapters(cases, records, ctx=ctx)
context += '<h2>' + bilingual_text('结果说明与限制', 'Findings and limitations') + '</h2>'
Expand Down
Loading