Repository navigation
feat(ci): check benchmark cards against the expected source identity - #340
Merged
Merged
Conversation
Add --expected-source-repository, --expected-source-revision and --expected-evaluator-container-revision to check_public_benchmarks.py. A publishing pipeline can then fail a card, of any verdict, whose Evaluated source, Evaluated source revision or Evaluator container revision line is missing, not recorded, duplicated or different from the source it asked to evaluate. Both sides are normalized through skillevaluator.source_identity, so hex case does not cause a false mismatch. An expectation implies --require-files, and a non-canonical expected value is a usage error. The default scan is unchanged. ruff format also wraps four existing lines in the gate script that fail ruff format --check on main. Signed-off-by: Narendran Raghavan <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]>
Describe the --expected-* options of check_public_benchmarks.py in the publication gate step of the rollout runbook, add an Unreleased > Added CHANGELOG entry, and pin the documented flags in the runbook test. Signed-off-by: Narendran Raghavan <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]>
When a card has the Evaluated source, Evaluated source revision or Evaluator container revision line but its value is not canonical (bare text, a doubled code span, text after the span, a short commit or an untagged container), the expected-source check now reports "<field> is not a canonical value, so it cannot match". The "not recorded" reason is kept for a missing line, an empty value and a "not recorded" placeholder, so an operator is pointed at the right problem. The card still fails in every case. Signed-off-by: Narendran Raghavan <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]>
The runbook said hex digits are compared without regard to case, but only the Evaluated source revision is folded. An expected container digest or implementation commit in upper case is a usage error, and a registry host is compared as written. Say so, pin the wording in the runbook test, and add a test for the exact container comparison. Signed-off-by: Narendran Raghavan <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]>
rng1995
commented
Nov 4, 2026
rng1995
left a comment
Collaborator
Author
There was a problem hiding this comment.
Automated review: 3 findings (0 P1, 0 P2, 3 P3); 2 posted inline.
Findings outside the diff or about the description:
scripts/ci/check_public_benchmarks.py: P3: The message of commit 5c241de says ruff format 'wraps four existing lines'. The diff has one wrap (the _HTMLAttributeParser events.append) and three joins (the Environment skeleton concatenation, the semantic_document 'or', and _contains_disallowed_category_c). The PR text correctly says 'reformats four existing statements'. The author already reported this.
Suggested fix: No amend is allowed. Leave it, or record the correct wording in the PR description, which already has it.
The gate reads metadata only from plain one-line list items. An item with a link or inline HTML, or one that continues onto a second line, is left out, so the expected-source check reports that field as not recorded rather than as not canonical. The strict provenance scan treats it as missing too, so the two checks agree and the card still fails. Say so in the runbook and in the check's docstring, pin the wording in the runbook test, and add a test for the link, inline HTML and continuation-line cases. The parser is unchanged. Signed-off-by: Narendran Raghavan <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]>
rng1995
marked this pull request as ready for review
November 5, 2026 17:50
rng1995
requested review from
chrisknvidia,
mosheabr and
rmalani-nv
as code owners
November 5, 2026 17:50
A code-span value with leading or trailing whitespace, including a no-break space or a tab, matched the expected source after stripping. The reporter never renders one, and a parser reading the raw value would not see the canonical identity, so it is now reported as not canonical. The runbook and the check's docstring also say that only top-level Evaluation Metadata items are read, so a nested item is ignored rather than counted as a duplicate. Signed-off-by: Narendran Raghavan <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]>
Conflicts: CHANGELOG.md (kept main's new Added entries, then this PR's). Signed-off-by: Narendran Raghavan <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]>
7 of 8 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
scripts/ci/check_public_benchmarks.pygets three optional options:--expected-source-repository,--expected-source-revisionand--expected-evaluator-container-revision. Each one checks one metadata line of every scanned card:Evaluated source,Evaluated source revisionorEvaluator container revision.not recordedplaceholder, is not a canonical value, appears more than once inEvaluation Metadata, or names a different value. New offender reasons:<field> does not match the expected value<field> not recorded, but an expected value was given(no line, an empty value or anot recordedplaceholder)<field> is not a canonical value, so it cannot match(the line is there but malformed)<field> recorded more than once, so it cannot matchBenchmarkReporterrenders it. An item with a link or inline HTML, or one that continues onto a second line, is treated as missing: the new check reports it as not recorded, and--require-source-provenancereports a missing metadata field. The parser is not loosened. Only top-level items are read, so a nested item is ignored rather than counted as a duplicate, and a value padded with whitespace inside its code span is not canonical.skillevaluator.source_identity.normalized_evaluated_source, so hex case in the source revision does not cause a false mismatch.merge_evaluated_sourcescompares it. A container digest or implementation commit must be lower case, assource_identityrequires, and a registry host must be written as the card records it.--expected-source-revisionaccepts either shape and matches that line.owner/name, untagged container name) is a usage error (exit 2) instead of a silent pass.--expected-*option implies--require-files, so finding no card to check fails.ExpectedSourceplus a newexpected_source=keyword onscan_fileandfind_offenders.tests/golden.docs/benchmark-rollout.mdxand adds a CHANGELOG entry under Unreleased > Added.Why
Since #131, cards record the evaluated source and the evaluator container revision, and
--require-source-provenancemakes a PASS card name them. The gate still cannot tell whether that identity is the one the publishing pipeline asked for. A stale card, or one generated for a different commit or repository, passes the strict scan as long as it names some valid source. A publishing CI that knows the requested repository, revision and evaluator image can now bind each card to that request before it signs or copies the card.Kept from public
source_identity.pyis unchanged and is the only definition of a valid value: strictowner/namerepository, full Git object ids,sha256/sha384/sha512digests at their exact widths, and the container reference grammar.--require-source-provenancestays opt-in and keeps its own checks (PASS needs a recorded source, digest-pinned container). The new options do not imply it; the runbook example uses both.validateoptions, environment variables or dirty-snapshot marker. The identity still comes only from--evaluated-source-repository,--evaluated-source-revisionand--evaluator-container-revision.ruff formatreformats four existing statements incheck_public_benchmarks.pythat failruff format --checkonmain: it wraps one and joins three. There are no other unrelated changes.ruff formatwraps four lines and that hex case never causes a false mismatch. This description has the accurate wording: one wrap and three joins, and only the source revision is compared without regard to case.check_public_benchmarks.py(imports and thescan_filebody) anddocs/benchmark-rollout.mdx. Whichever lands second needs a small rebase.Tests
TestExpectedSourceBindingandTestExpectedSourceEntryPointsintests/test_benchmark_source_provenance.py:--require-source-provenancenot recordedplaceholders, or without the lines, fails each expected fieldnot recordedplaceholder is reported as not recordedBenchmarkReportermatches the identity it was givenValueError, and the expectation is stored in canonical formmain()accepts the requested card, rejects another commit or a missing identity, fails an empty tree when an expectation is given, and exits 2 on a malformed flag;find_offenders()passes the expectation throughtest_rollout_runbook_documents_the_expected_source_optionsintests/test_benchmark_rollout_docs.pypins the flags, the implied--require-files, the rule that only the source revision is compared without regard to case, and the rule that only a plain one-line list item counts.main's gate script and runbook, those two modules give 43 failed, 160 passed. The 43 failures are exactly the 43 new tests, and every existing test passes.tests/test_benchmark_source_provenance.py,tests/test_public_benchmark_gate.py,tests/test_benchmark_rollout_docs.py,tests/test_ci_workflows.py,tests/test_oss_packaging.py,tests/test_ci_change_classifier.py,tests/test_publication_identity.py,tests/test_publication_evidence.py,tests/reporting/test_advisory_skip_verdict.py,tests/golden/test_benchmark_card.py,tests/ci/test_image_build.py,tests/tier3/test_private_loose_source.py,tests/test_accuracy_arithmetic.pyandtests/test_tier3_public_runtime.py: 1988 passed, 2 skipped.check_public_benchmarks.py --require-files tests/golden --require-source-provenance(the CI invocation) still passes.ruff checkandruff format --checkare clean on the changed Python files.scripts/check_oss_boundary.pypassed.🤖 Generated with Claude Code