feat(sdk): derive evidence attestation options from AICRConfig - #2542
Conversation
Signed-off-by: Mark Chmarny <mark@chmarny.com>
Signed-off-by: Mark Chmarny <mark@chmarny.com>
|
🌿 Preview your docs: https://nvidia-preview-fix-2245-facade-followups.docs.buildwithfern.com/aicr |
Recipe evidence checkNo leaf overlays affected by this PR. This gate is warning-only and never blocks merge. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Enterprise Run ID: 📒 Files selected for processing (6)
Included review availability: Your plan provides up to 12 included reviews per hour; 8 remain after this review. 📝 WalkthroughWalkthroughThe Go client now derives recipe-evidence attestation options from Estimated code review effort: 3 (Moderate) | ~20 minutes Merge Risk: 🔵 Low · up to The new SDK method exposes evidence settings that can select local files, registry destinations, and insecure transport modes when evidence is explicitly emitted. The change is mergeable, but integrations should treat these configuration values as trusted input and apply appropriate policy before use. Suggested reviewers: 🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
Coverage Report ✅
Coverage BadgeMerging this branch will increase overall coverage
Coverage by fileChanged files (no unit tests)
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. |
Summary
Adds
Config.EvidenceAttestationOptions(), the derivation forspec.validate.evidence.attestation, and clears the three review nits deferredfrom #2243.
Motivation / Context
#2538 landed the last of the three facade derivations (slices 1-3 of #2245).
This picks up the pieces that were scoped into #2245 but not delivered with
them: the evidence derivation the
spec.validatebreakdown calls for, and thethree nits the issue folds in "because they are cheaper to do alongside this
work than on their own".
Also corrects a docs table row from #2538 that claimed
SnapshotAgentConfig()reads
spec.snapshot.output. It does not, and the godoc plus the detailedsection both say so explicitly — the summary table was the only place that
disagreed.
Fixes: N/A
Related: #2245, #2243, #2538
Type of Change
Component(s) Affected
cmd/aicr,pkg/cli)cmd/aicrd,pkg/server)pkg/recipe)pkg/bundler,pkg/component/*)pkg/collector,pkg/snapshotter)pkg/validator)pkg/errors,pkg/k8s)docs/,examples/)pkg/client/v1)Implementation Notes
Why
EvidenceAttestationOptions()and notEvidenceOptions().spec.validate.evidencecarries two kinds —cncfandattestation— andEvidenceOptionsmaps only to the attestation half. There is no facade entrypoint that emits CNCF AI Conformance evidence, so a method named for the whole
section would advertise coverage it does not have. Naming it for the half it
carries also leaves room for an
EvidenceCNCFOptions()later without abreaking rename.
Why it returns a
bool.outis the enable gate, matchingEvidenceAttestationSpec.Out's own contract: an emptyoutleaves the path offeven when the other fields are populated.
EmitRecipeEvidencerejects an emptyOutDirwithErrCodeInvalidRequest, so a zero-valueEvidenceOptionsalonecould not tell a caller whether the document declined the bundle or fumbled it.
The
boolseparates the two; a malformed section is still an error.Four fields stay caller-owned, and two of them are a control, not a gap.
Commitnames the running binary andOIDCResolveis a short-lived secret thespec deliberately excludes.
NoSignandFullare command-line-only for thesame reason as
IgnoreTLogandfailOnError: both weaken a run, and achecked-in file that can silently disable signing is a supply-chain downgrade
no reviewer would see in a diff. That reasoning is in the godoc so it does not
get "fixed" later.
Known duplication.
buildRecipeEvidenceConfig(pkg/cli/validate_evidence.go)still maps the same five fields inline. Migrating it is slice 4's job, which
#2245 defers on purpose; the coupling is noted in the godoc so a change to one
prompts a look at the other.
Nits from #2243:
pkg/cli/root.gonow logs the concretedirectoryon thespec.recipe.databranch, as the
--databranch already did. Read from the sameRecipe().DataDir()accessorRecipeSource()uses, so the two cannotdisagree. Deliberately did not add a
Config.RecipeDataDir()accessor forthis — new SDK surface for a log line is the wrong trade this close to the
freeze, and slice 4 is the right place to revisit it.
TestConfig_RawAccessorscould only count opaque options. The folded valuesare now asserted in a new internal test that applies them against
recipeResolveConfig. Usescustomer-managed+enabledrather thandisabledtwice, since both enums acceptdisabledand a same-value fixturewould not catch a swap.
WrapConfig-reachable error branches onBundleVerifyOptions,RecipeResolveOptions, andRecipeAccountingModenow have a table-driventest asserting
ErrCodeInvalidRequest, with the new derivation covered bythe same table.
Testing
make qualify golangci-lint run -c .golangci.yaml ./pkg/client/v1/... ./pkg/cli/... go test -race ./pkg/client/v1/... ./pkg/cli/...make qualifypasses.api-diffreports(*Config).EvidenceAttestationOptions: addedunder Compatible changes, with "No incompatible SDK facade or transparent-alias
target changes since v0.20.0" — the new surface is purely additive.
openapi-diffreports 0 breaking changes. golangci-lint: 0 issues. Race tests pass on both
changed packages.
Coverage, measured against
origin/mainvia a baseline worktree:pkg/client/v1: 84.1% → 84.4% (+0.3%)pkg/cli: 75.8% → 75.8% (0.0%)EvidenceAttestationOptionsis at 100% statement coverage.The new tests were mutation-checked rather than assumed: removing the
outgate fails
TestConfig_EvidenceAttestationOptions_OutIsTheGate, and swappingBOMPath/PushfailsTestConfig_EvidenceAttestationOptions.Risk Assessment
Rollout notes: Purely additive to the SDK facade — one new method, no
signature or behavior changes to existing surface, confirmed by
api-diffagainst
v0.20.0. The only behavior change outsidepkg/client/v1is oneadditional
slogkey on an existing INFO line. N/A for migration.Checklist
make testwith-race)make lint)git commit -S) — GPG signing info