Skip to content

fix(evidence): record opt-in-only service values as not-inferable (#2631) - #2894

Merged
mchmarny merged 4 commits into
mainfrom
fix/2631-opt-in-only-criteria
Sep 22, 2026
Merged

mchmarny merged 4 commits into
mainfrom
fix/2631-opt-in-only-criteria

Conversation

@atif1996

@atif1996 atif1996 commented Sep 21, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Recipe evidence for an opt-in-only service value can now qualify. generic (#2568) is selectable only by --service generic; a snapshot fingerprints the provisioner it sees (metal3, rke2, …) and never generic, so Fingerprint.Match reported the service dimension as mismatched and every generic-recipe attestation carried criteriaMatch.matched: false. The dimension is now recorded as not-inferable, with the observed provider kept in fingerprintProvides, and does not flip matched.

Fixes: #2631
Related: #2568, #2851

Motivation / Context

The committed pointer for gb300-generic-ubuntu-training (#2851) is the live example. Its signed predicate reads:

criteriaMatch.matched: false
  service      recipeRequires=generic  fingerprintProvides=metal3  mismatched
  accelerator  gb300 / gb300           matched
  os           ubuntu / ubuntu         matched

The bundle is internally valid and the measurement stands, but the predicate says the recipe was validated on a cluster that did not match it, which is not what happened: the fingerprint cannot produce generic, so the comparison was never meaningful. The pointer merged because the per-source contract gate (evidence-pointercheck) is structural and never reads the predicate; this change is about the honesty of the predicate and readiness for design doc 007's step 7, not about unblocking CI.

Per @yuanchen8911's options in #2631 this implements (c), a per-dimension disposition, which carries (b), the observed provider, and delivers (a), an explicitly selected opt-in-only value no longer disqualifies the evidence.

Type of Change

  • Bug fix (non-breaking change that fixes an issue)

Component(s) Affected

  • Recipe engine / data (pkg/recipe)
  • Other: pkg/fingerprint, pkg/evidence/attestation, pkg/evidence/verifier
  • Docs/examples (docs/)

Implementation Notes

  • Registry classifies opt-in-only values (pkg/recipe/criteria_registry.go): CriteriaRegistry.IsOptInOnly(field, value) backed by a package-level set, seeded with service: generic. It is a property of the OSS value set, so a zero-value or --data-seeded registry answers the same; --data values are never opt-in-only.
  • Fourth disposition (pkg/fingerprint/types.go): DimensionNotInferable = "not-inferable". unknown was not reused: it means the fingerprint captured nothing, whereas here the fingerprint did capture metal3 and the predicate should say so.
  • Fingerprint.MatchWith(c, reg) (pkg/fingerprint/match.go): a service diff that matchDim would call mismatched is reclassified when the recipe value is opt-in-only. Match(c) keeps its signature and delegates with the embedded registry. Matched still flips only on mismatched. An uncaptured provider stays unknown; an inferable service (eks vs metal3) still mismatches.
  • Builder (pkg/evidence/attestation/builder.go) calls MatchWith with the embedded registry.
  • Verifier report (pkg/evidence/verifier/report.go) gains a third verdict, ✓ criteria satisfied; opt-in-only dimensions recorded as not-inferable (see rows), and the existing row format renders not-inferable recipe=generic snapshot=metal3.
  • No predicate type bump. Field names and the meaning of matched are unchanged; the only wire difference is a new string in perDimension[].match, which every consumer today renders as an opaque string (the dashboard and pointer check do not read criteriaMatch at all). Verifying the existing v3 bundle from docs(evidence): attest gb300-generic-ubuntu-training recipe-evidence v3 #2851 with this branch's binary passes 4/4 steps and still renders its mismatched row, so old bundles are unaffected. If maintainers prefer a PredicateTypeV4 for the enum addition, the fix(evidence): make recipe digest content-only via PredicateTypeV3 #2789 pattern applies.
  • Design doc 007: the criteriaMatch example was stale (map keyed by dimension, boolean match, v1 URI) and now shows the ordered array with the string enum; a new "Opt-in-only criteria values" section defines the rule; verification step 7 states that unknown and not-inferable do not fail the step and that a not-inferable row must carry fingerprintProvides.
  • User docs (api-reference.md, cli-reference.md, pkg/recipe/doc.go) now say the dimension is recorded as not-inferable and does not disqualify the evidence, replacing the "expected to report mismatched" wording.

Out of scope, as Yuan noted in #2631: the selection question (a snapshot of a metal3 rack does not select the generic leaf) and any change to what the pointer-check gate reads.

Testing

go test ./pkg/fingerprint/ ./pkg/recipe/ ./pkg/evidence/...   # ok
make lint                                                    # 0 issues
make test                                                    # Go suites pass; see test-shell note below
go build -o /tmp/aicr ./cmd/aicr && /tmp/aicr evidence verify \
  recipes/evidence/gb300-generic-ubuntu-training/728b071aed7124418b1fa9c7f0521e24/sha256-74c42dc3….yaml
# bundle valid — all checks passed (exit 0); fingerprint row still "mismatched recipe=generic snapshot=metal3"

New tests: TestMatch_OptInOnlyServiceIsNotInferable, TestMatch_OptInOnlyServiceUncapturedStaysUnknown, TestMatch_ConcreteServiceStillMismatches, TestMatchWith_NilRegistryUsesEmbedded (pkg/fingerprint); TestCriteriaRegistry_IsOptInOnly (pkg/recipe); TestBuild_OptInOnlyServiceIsNotInferable (pkg/evidence/attestation, generic GB300 recipe against a metal3 snapshot → matched: true, service not-inferable); TestRenderMarkdown_FingerprintVerdicts (pkg/evidence/verifier).

No goldens or schemas change: the predicate has no JSON schema, and no recipe content moved.

make test runs test-shell last; on my machine nine tools/api-diff_test.sh scenarios (reachable-internal-target-*, deleted-alias-target-*) fail with want rc=16 got rc=17. They fail identically on untouched main at fd9001aca with this branch stashed, so it is a local api-diff environment issue, not this change; CI is the arbiter.

Risk Assessment

  • Low — Isolated change, well-tested, easy to revert

Rollout notes: Additive. Existing bundles verify unchanged. New attestations of generic recipes carry matched: true with a not-inferable service row; the next gb300-generic-ubuntu-training republish (planned against the release that contains this fix, without a mutable validator tag per #2884) will be the first to show it.

Checklist

  • Tests pass locally (make test with -race)
  • Linter passes (make lint)
  • I did not skip/disable tests to make CI green
  • I added/updated tests for new functionality
  • I updated docs if user-facing behavior changed
  • Changes follow existing patterns in the codebase
  • Commits are cryptographically signed (git commit -S)

🤖 Generated with Claude Code

A generic recipe's service can never be produced by a snapshot fingerprint,
which reports the provisioner it sees (metal3, rke2, ...). Fingerprint.Match
therefore called the dimension mismatched and every generic-recipe
attestation carried criteriaMatch.matched: false, even when the run was
sound.

CriteriaRegistry.IsOptInOnly classifies such values (today: service
generic). Fingerprint.MatchWith records them as a fourth disposition,
not-inferable, keeping the observed provider in fingerprintProvides, and
Matched is no longer flipped by them. The verifier report gains a matching
verdict. Existing v3 bundles verify unchanged; no predicate type bump.

Fixes #2631

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Signed-off-by: Atif Mahmood <atif1996@users.noreply.github.com>
@github-actions

Copy link
Copy Markdown
Contributor

Recipe evidence check

No leaf overlays affected by this PR.

This gate is warning-only and never blocks merge.

@coderabbitai

coderabbitai Bot commented Sep 21, 2026 •

Copy link
Copy Markdown
Contributor

Review Change StackReview Change Stack

Understand this PR’s impact

Explore downstream dependencies and potential security impact with Blast Radius.

View blast radius →

Important

Review skipped

Review was skipped as selected files did not have any reviewable changes.

⚙️ Run configuration

Configuration used: Repository: NVIDIA/aicr/.coderabbit.yaml

Review profile: ASSERTIVE

Plan: Enterprise

Run ID: bc96ec27-9a51-4ae2-b822-a9d34094be11

📥 Commits

Reviewing files that changed from the base of the PR and between e3d6fbe and 5a1311a.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository: NVIDIA/aicr/.coderabbit.yaml

Review profile: ASSERTIVE

Plan: Enterprise

Run ID: 7e61ce5a-50d2-4e39-8652-1d1b66f59c04

📥 Commits

Reviewing files that changed from the base of the PR and between fd9001a and 5842233.

📒 Files selected for processing (15)
  • docs/design/007-recipe-evidence.md
  • docs/user/api-reference.md
  • docs/user/cli-reference.md
  • pkg/evidence/attestation/builder.go
  • pkg/evidence/attestation/builder_test.go
  • pkg/evidence/verifier/report.go
  • pkg/evidence/verifier/report_fingerprint_test.go
  • pkg/fingerprint/doc.go
  • pkg/fingerprint/match.go
  • pkg/fingerprint/match_test.go
  • pkg/fingerprint/types.go
  • pkg/recipe/criteria.go
  • pkg/recipe/criteria_registry.go
  • pkg/recipe/criteria_registry_test.go
  • pkg/recipe/doc.go

Included review availability: Your plan provides up to 12 included reviews per hour; 11 remain after this review.


📝 Walkthrough

Walkthrough

The change adds DimensionNotInferable and classifies generic service as opt-in-only. Fingerprint.MatchWith preserves the observed provider and keeps the overall match successful when the service cannot be inferred. Attestation building now uses the criteria registry. Verifier reports distinguish not-inferable results from mismatches. Tests and documentation cover the new criteria states and reporting behavior.

Priority: ➖ Normal

Estimated code review effort: 3 (Moderate) | ~25 minutes

Change: Bug fix · Severity of issue fixed: Medium

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed The PR meets the coding requirements in issue #2631. CriteriaRegistry.IsOptInOnly classifies service=generic. Fingerprint.MatchWith changes a differing opt-in-only service from mismatched to `…
Out of Scope Changes check ✅ Passed The changes stay within issue #2631. The registry classification, matcher behavior, attestation integration, verifier reporting, documentation, and automated tests all support the requested qualificat…
Title check ✅ Passed The title clearly and concisely identifies the main change: recording opt-in-only service values as not-inferable in evidence.
Description check ✅ Passed The description directly explains the changes to fingerprint matching, evidence qualification, reporting, documentation, testing, and scope.
✨ Finishing Touches 💡 1
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
🛠️ Fix failing CI checks 💡
  • Commit to this branch
  • Create a new PR

Comment @coderabbitai help to get the list of available commands.

@github-actions

Copy link
Copy Markdown
Contributor

@github-actions

Copy link
Copy Markdown
Contributor

Coverage Report ✅

Metric Value
Coverage 84.9%
Threshold 83%
Status Pass
Coverage Badge
![Coverage](https://img.shields.io/badge/coverage-84.9%25-brightgreen)

Merging this branch will increase overall coverage

Impacted Packages Coverage Δ 🤖
github.com/NVIDIA/aicr/pkg/evidence/attestation 78.56% (ø)
github.com/NVIDIA/aicr/pkg/evidence/verifier 74.53% (+0.22%) 👍
github.com/NVIDIA/aicr/pkg/fingerprint 99.19% (+0.02%) 👍
github.com/NVIDIA/aicr/pkg/recipe 90.21% (+0.00%) 👍

Coverage by file

Changed files (no unit tests)

Changed File Coverage Δ Total Covered Missed 🤖
github.com/NVIDIA/aicr/pkg/evidence/attestation/builder.go 83.33% (ø) 138 115 23
github.com/NVIDIA/aicr/pkg/evidence/verifier/report.go 93.02% (+1.09%) 129 (+5) 120 (+6) 9 (-1) 👍
github.com/NVIDIA/aicr/pkg/fingerprint/doc.go 0.00% (ø) 0 0 0
github.com/NVIDIA/aicr/pkg/fingerprint/match.go 100.00% (ø) 35 (+6) 35 (+6) 0
github.com/NVIDIA/aicr/pkg/fingerprint/types.go 100.00% (ø) 4 4 0
github.com/NVIDIA/aicr/pkg/recipe/criteria.go 76.15% (ø) 390 297 93
github.com/NVIDIA/aicr/pkg/recipe/criteria_registry.go 99.01% (+0.02%) 101 (+2) 100 (+2) 1 👍
github.com/NVIDIA/aicr/pkg/recipe/doc.go 0.00% (ø) 0 0 0

Please note that the "Total", "Covered", and "Missed" counts above refer to code statements instead of lines of code. The value in brackets refers to the test coverage of that file in the old version of the code.

@mchmarny mchmarny left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Approve: no findings against 5842233. Focused fingerprint, attestation, verifier, and recipe race tests pass.

@mchmarny
mchmarny enabled auto-merge (squash) September 22, 2026 12:32
@mchmarny
mchmarny merged commit 6db980d into main Sep 22, 2026
73 checks passed
@mchmarny
mchmarny deleted the fix/2631-opt-in-only-criteria branch September 22, 2026 13:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

evidence: define qualification semantics for opt-in-only service values (generic)

2 participants