Skip to content

fix(validator): disclose cordoned GPU nodes in check-nvidia-smi - #1936

Merged
njhensley merged 8 commits into
NVIDIA:mainfrom
rsd-darshan:fix/validator-cordoned-gpu-nodes
Jul 31, 2026
Merged

njhensley merged 8 commits into
NVIDIA:mainfrom
rsd-darshan:fix/validator-cordoned-gpu-nodes

Conversation

@rsd-darshan

@rsd-darshan rsd-darshan commented Jul 28, 2026 •

Copy link
Copy Markdown
Contributor

Summary

check-nvidia-smi now enumerates every GPU node, validates only the schedulable ones, and explicitly discloses cordoned nodes plus a coverage line — instead of silently narrowing scope with no signal in the evidence.

Motivation / Context

A cordon (Node.Spec.Unschedulable) means "do not schedule new pods," not "exclude from GPU service" — it's commonly transient maintenance, not deliberate exclusion. check-nvidia-smi enumerated only the schedulable GPU cohort (helper.FindSchedulableGpuNodes), so a cordoned GPU node silently disappeared from the reported node count (Found 1 GPU node(s) on a two-GPU-node cluster) with nothing indicating reduced coverage. Meanwhile cluster-aggregate checks (gpu-operator-health, expected-resources) already include cordoned nodes via ClusterPolicy aggregation, so the two check families disagreed on scope with no disclosure of the mismatch — the spuriously-passing-check failure mode this project's own conventions treat as fail-closed territory.

Fixes: #1668
Related: N/A

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update
  • Refactoring (no functional changes)
  • Build/CI/tooling

Component(s) Affected

  • Validator (pkg/validator)
  • Docs/examples (docs/, examples/)

Implementation Notes

  • Added helper.FindGpuNodes, which returns every node with allocatable nvidia.com/gpu, each tagged with its cordon state. helper.FindSchedulableGpuNodes is now a thin filter on top of it, so its signature and behavior for existing callers (RDMA fabric gate, performance worker sizing) are unchanged.
  • checkNvidiaSMI partitions the result into schedulable vs. cordoned, validates only the schedulable subset, and prints <node>: skipped (cordoned) plus nodesValidated: <validated>/<total> to stdout evidence (which flows into the CTRF report per the existing // → CTRF evidence convention).
  • If a GPU node exists but every GPU node is cordoned, the check now skips with a reason that discloses the cordoned count (all N GPU node(s) are cordoned; nothing to verify) rather than reusing the generic "no GPU nodes found" message, so the two distinct conditions stay distinguishable in evidence.
  • Cluster-aggregate checks (gpu-operator-health, expected-resources) are unaffected — they already cover cordoned nodes since DaemonSet operands ignore cordons.
  • Documented the GPU Operator's nvidia.com/gpu.deploy.operands=false node label in docs/contributor/validator.md as the supported signal for deliberate, durable exclusion, as distinct from a cordon.
  • Out of scope (left for follow-up if wanted): an opt-in --require-all-nodes strict flag for release-gate attestations, mentioned as optional in the issue.

Testing

GOFLAGS="-mod=vendor" go build ./validators/...
GOFLAGS="-mod=vendor" go vet ./validators/...
GOFLAGS="-mod=vendor" go test -race ./validators/helper/... ./validators/deployment/...
golangci-lint -c .golangci.yaml run ./validators/helper/... ./validators/deployment/...
  • go test -race — full pass, validators/helper and validators/deployment.
  • golangci-lint (pinned v2.12.2) — 0 issues on both affected packages.
  • New tests: helper.TestFindGpuNodes, helper.TestFindSchedulableGpuNodes (cordon partitioning), and TestCheckNvidiaSMI_{NoGPUNodes,AllNodesCordoned,MixedCordonAndNonGPU} (skip-reason disclosure).
  • Note: validators/ is excluded from the repo-wide make test-coverage floor (Makefile test target filters -e /validators), so the package-coverage delta gate in CONTRIBUTING does not apply here.
  • Full make qualify (e2e/scan/license-check) was not run locally — those need chainsaw/goreleaser/grype/go-licenses, not present in this environment; deferring to CI.

Risk Assessment

  • Low — Isolated change to one check's node enumeration and evidence output; existing callers of FindSchedulableGpuNodes are behaviorally unchanged.

Rollout notes: N/A — evidence-format addition only, no schema or API change.

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)

Node-scoped checks that deploy a per-node test pod (check-nvidia-smi)
enumerated only schedulable GPU nodes, so a cordoned GPU node silently
disappeared from the reported node count with nothing indicating
reduced coverage. A cordon means "do not schedule new pods," not
"exclude from GPU service," so this conflated transient maintenance
with deliberate exclusion and let a check pass while validating fewer
nodes than the cluster actually has.

check-nvidia-smi now enumerates every GPU node via the new
helper.FindGpuNodes (which tags each node with its cordon state),
validates only the schedulable subset, and explicitly discloses
cordoned nodes plus a nodesValidated coverage line in the check's
evidence. Cluster-aggregate checks (gpu-operator-health,
expected-resources) already cover cordoned nodes via ClusterPolicy
aggregation and are unaffected. Documents the GPU Operator's
nvidia.com/gpu.deploy.operands=false label as the supported signal
for deliberate, durable node exclusion.

Fixes NVIDIA#1668
@rsd-darshan
rsd-darshan requested a review from a team as a code owner July 28, 2026 17:21
@copy-pr-bot

copy-pr-bot Bot commented Jul 28, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@coderabbitai

coderabbitai Bot commented Jul 28, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

GPU node discovery now returns all GPU-capable nodes with cordon state. checkNvidiaSMI validates schedulable nodes, reports cordoned nodes, handles fully cordoned clusters with a skip, and emits validation coverage. Tests cover discovery, skip scenarios, and skip classification. Documentation and validator catalog entries describe the updated behavior.

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

Possibly related issues

Suggested labels: area/validator, area/tests

Suggested reviewers: njhensley

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed The PR meets #1668 by enumerating all GPU nodes, skipping only schedulable ones, and recording cordoned-node coverage.
Out of Scope Changes check ✅ Passed The added helpers, tests, docs, and skip-classification support are all in service of the cordoned-node disclosure fix.
Title check ✅ Passed The title clearly and concisely describes the main change: disclosing cordoned GPU nodes in check-nvidia-smi.
Description check ✅ Passed The description is directly related to the changeset and explains the motivation, implementation, testing, and scope.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@validators/deployment/nvidia_smi_test.go`:
- Around line 121-179: Refactor the three skip-scenario tests around
checkNvidiaSMI into one table-driven test with subtests covering no GPU nodes,
all GPU nodes cordoned, and mixed cordoned/non-GPU nodes. Keep each case’s
cluster objects, skip expectation, and distinct expected message substring
unchanged, including the cordoned counts.

In `@validators/deployment/nvidia_smi.go`:
- Around line 44-47: Update the error branch in the deployment validation flow
around helper.FindGpuNodes to return err directly instead of wrapping it with
errors.Wrap. Preserve the helper’s existing pkg/errors value and structured
error chain unchanged.

In `@validators/helper/gpu.go`:
- Around line 74-78: Update the GPU-node discovery loop in
validators/helper/gpu.go (lines 74-78) and schedulable-node filtering loop
(lines 90-94) to check ctx.Done() on each iteration and return an appropriately
wrapped context cancellation error. Apply the same cancellation check and
wrapped failure return to the cordon-partitioning loop in
validators/deployment/nvidia_smi.go (lines 55-61), using its ctx.Ctx context.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Enterprise

Run ID: 1a26a2e9-5c53-4148-98b7-d0326f542ec2

📥 Commits

Reviewing files that changed from the base of the PR and between 2abbd2b and 061bf84.

📒 Files selected for processing (5)
  • docs/contributor/validator.md
  • validators/deployment/nvidia_smi.go
  • validators/deployment/nvidia_smi_test.go
  • validators/helper/gpu.go
  • validators/helper/gpu_test.go

Comment thread validators/deployment/nvidia_smi.go Resolved
Comment thread validators/helper/gpu.go Resolved
- Propagate helper.FindGpuNodes' error as-is instead of re-wrapping an
  already-correctly-coded pkg/errors value with a second ErrCodeInternal.
- Check ctx.Done() while iterating node lists in FindGpuNodes,
  FindSchedulableGpuNodes, and checkNvidiaSMI's cordon-partition loop,
  matching the existing pattern in rdmaFabricProbe.
- Collapse the three checkNvidiaSMI skip-scenario tests into one
  table-driven test per repo convention.
@rsd-darshan

Copy link
Copy Markdown
Contributor Author

Addressed all 3 actionable findings in cd806b5:

  1. Table-driven test (nvidia_smi_test.go) — collapsed the three skip-scenario tests into one table-driven TestCheckNvidiaSMI_SkipScenarios with subtests.
  2. Double error-wrap (nvidia_smi.go:47) — checkNvidiaSMI now returns helper.FindGpuNodes's error as-is instead of re-wrapping an already-correctly-coded value.
  3. Context cancellation in loops (gpu.go, nvidia_smi.go) — added ctx.Done() checks in FindGpuNodes, FindSchedulableGpuNodes, and the cordon-partition loop in checkNvidiaSMI, matching the existing pattern in rdmaFabricProbe.

go build/vet/test -race and golangci-lint (pinned v2.12.2) all pass clean on validators/helper and validators/deployment.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
validators/deployment/nvidia_smi.go (2)

78-80: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Emit validation coverage before early skips.

The all-cordoned path returns before line 130, so it never records nodesValidated: 0/<total> despite explicitly requiring coverage for cordoned-node handling. The busy and failed-validation paths also bypass this evidence. Emit coverage immediately after partitioning, with the actual validated count for each exit path.

Based on PR objectives, validation coverage must be recorded in evidence.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@validators/deployment/nvidia_smi.go` around lines 78 - 80, Update the
GPU-node validation flow after partitioning in the nvidia_smi validator to emit
validation coverage evidence before any early return, including the
all-cordoned, busy, and failed-validation paths. Record the actual
validated-node count against the total node count for each exit path, while
preserving the existing skip and failure outcomes.

69-75: 📐 Maintainability & Code Quality | 🟠 Major | 🏗️ Heavy lift

Route validator evidence through the configured writer.

Direct fmt.Printf binds new validation evidence to process stdout, preventing callers from capturing or routing it consistently.

  • validators/deployment/nvidia_smi.go#L69-L75: write node and cordon-disclosure output through the injected/root writer.
  • validators/deployment/nvidia_smi.go#L130-L132: write coverage and success evidence through that same writer.

As per coding guidelines, CLI user-facing output must go through cmd.Root().Writer or an injected writer.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@validators/deployment/nvidia_smi.go` around lines 69 - 75, Replace the direct
fmt.Printf calls in validators/deployment/nvidia_smi.go at lines 69-75 with the
configured/root writer for node and cordon-disclosure output, and update lines
130-132 to use that same writer for coverage and success evidence. Preserve the
existing messages and formatting while routing all user-facing validator output
through the injected writer.

Source: Coding guidelines

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In `@validators/deployment/nvidia_smi.go`:
- Around line 78-80: Update the GPU-node validation flow after partitioning in
the nvidia_smi validator to emit validation coverage evidence before any early
return, including the all-cordoned, busy, and failed-validation paths. Record
the actual validated-node count against the total node count for each exit path,
while preserving the existing skip and failure outcomes.
- Around line 69-75: Replace the direct fmt.Printf calls in
validators/deployment/nvidia_smi.go at lines 69-75 with the configured/root
writer for node and cordon-disclosure output, and update lines 130-132 to use
that same writer for coverage and success evidence. Preserve the existing
messages and formatting while routing all user-facing validator output through
the injected writer.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Enterprise

Run ID: 72756ee0-8193-4907-89d5-8dbb9c16fcb5

📥 Commits

Reviewing files that changed from the base of the PR and between 061bf84 and cd806b5.

📒 Files selected for processing (3)
  • validators/deployment/nvidia_smi.go
  • validators/deployment/nvidia_smi_test.go
  • validators/helper/gpu.go

@yuanchen8911 yuanchen8911 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

A few issues from a review of this change, mostly around whether the new disclosure actually reaches the surfaces that matter. Inline comments below; three items could not be anchored inline because their files are not in this diff:

The unit tests added here never execute in CI. Makefile:229 runs go test over $(go list ./... | grep -v -e /tests/chainsaw/ -e /validators), which filters out both validators/deployment and validators/helper. .github/actions/go-test/action.yml:72 is the only CI step that runs Go unit tests and it invokes make test. So TestCheckNvidiaSMI_SkipScenarios, TestFindGpuNodes and TestFindSchedulableGpuNodes are compiled by go vet and golangci-lint but never run, and the coverage gate cannot see the new exported FindGpuNodes and GpuNode surface. PR #1918 appears to address this exclusion.

The check catalog still overclaims coverage. recipes/validators/catalog.yaml:63 and recipes/validators/README.md:43 both describe check-nvidia-smi as verifying nvidia-smi on all GPU nodes, while the check now covers the schedulable subset only.

The same narrowing pattern exists in the performance validators. validators/performance/nccl_all_reduce_bw_constraint.go:729 and validators/performance/inference_perf_constraint.go:641 size their workloads from helper.FindSchedulableGpuNodes with no cordon disclosure and no coverage line, so the new documentation section's taxonomy does not cover them.

Comment thread validators/deployment/nvidia_smi.go Resolved
Comment thread docs/contributor/validator.md Resolved
Comment thread docs/contributor/validator.md Resolved
Comment thread validators/deployment/nvidia_smi.go Resolved
Comment thread validators/helper/gpu.go Resolved
Comment thread validators/helper/gpu_test.go Resolved
…sure

- Refactor checkNvidiaSMI's evidence into a pure gpuNodeCoverage struct
  (partitionGpuNodes/enumerationLines/coverageLine) so the coverage line
  now prints on every exit path (all-cordoned skip, busy skip, failed
  validation, success), not only success, and is independently unit
  testable without a fake clientset or pod-lifecycle simulation.
- Add TestGpuNodeCoverage_MixedCordonedAndSchedulable, exercising the
  headline mixed schedulable+cordoned scenario the prior tests missed.
- Fix TestFindGpuNodes/TestFindSchedulableGpuNodes: a duplicate result
  could previously mask a missing expected node since only length and
  membership were checked; now explicitly detected via a seen-set, and
  presence of every expected node is asserted. Added a zero-allocatable
  GPU node fixture.
- Export validators.IsSkip so tests classify a Skip() error via
  errors.Is instead of matching the rendered ": skip" suffix.
- Correct docs/contributor/validator.md: check-nvidia-smi's probe pod is
  nodeName-pinned and tolerates all taints, so a cordon does not
  actually block it from scheduling — excluding cordoned nodes is a
  deliberate policy choice (respecting drain/maintenance intent), not a
  technical necessity, and the doc no longer claims otherwise. Also
  narrows the "cluster-aggregate checks are unaffected" claim: expected-
  resources' rdmaFabricProbe is itself node-scoped with the same
  undisclosed narrowing (tracked as NVIDIA#1952), and notes the coverage
  line's disclosure does not survive default evidence redaction
  (tracked as NVIDIA#1951).
- Update recipes/validators/catalog.yaml and README.md: check-nvidia-smi
  now covers schedulable GPU nodes, not "all GPU nodes" as previously
  documented.

Addresses review feedback from CodeRabbit and yuanchen8911 on NVIDIA#1936.
@rsd-darshan
rsd-darshan requested a review from a team as a code owner July 29, 2026 15:00
@rsd-darshan

Copy link
Copy Markdown
Contributor Author

Addressed both CodeRabbit findings from the 2nd pass in 977854e:

  1. Coverage line only on success path — refactored the disclosure into a pure gpuNodeCoverage struct (partitionGpuNodes/enumerationLines/coverageLine) so nodesValidated now prints on every exit: all-cordoned skip, busy skip, failed validation, and success.
  2. Route output through a configured writer — declined. This check (and every other check in validators/deployment) writes evidence via direct fmt.Printf/fmt.Println per the documented convention (// → CTRF evidence, see docs/contributor/validator.md); introducing a writer abstraction for just this one check would be inconsistent with the rest of the package and isn't something this PR's scope calls for.

go build/vet/test -race and golangci-lint all pass clean.

@rsd-darshan

Copy link
Copy Markdown
Contributor Author

Thanks for the thorough review — went through each point and pushed fixes in 977854e:

  1. Tests never run in CI — confirmed: my branch forked from before #1918 (merged today) fixed the Makefile /validators exclusion from make test. Since #1918 is already on main, the merge-ref this PR's CI actually tests against will include it, so TestCheckNvidiaSMI_SkipScenarios/TestFindGpuNodes/TestFindSchedulableGpuNodes (and the new tests added in this round) will run. No action needed here since it's already resolved upstream — happy to double check once CI actually runs on this PR.

  2. Catalog/README overclaim coverage — fixed. recipes/validators/catalog.yaml and recipes/validators/README.md now say "all schedulable GPU nodes (cordoned nodes are disclosed, not silently skipped)".

  3. Coverage disclosure stripped by default redaction — confirmed, and it's a real gap: the nodesValidated line only reaches TestResult.Stdout/.Message, which pkg/evidence/redact's default "minimal" policy strips. I corrected the doc to say this explicitly (visible for live/--output/--full, not guaranteed in a default signed bundle) rather than overclaiming, and filed Validator evidence disclosure (e.g. node coverage lines) is stripped by default redaction #1951 to track carrying this kind of outcome data in a structured field that survives redaction — that's a cross-cutting change to the shared CTRF/evidence pipeline, so it didn't feel right to fold into this PR's scope.

  4. Cordon rationale is factually wrong for this probe — confirmed and fixed. You're right that nodeName + tolerate-all bypasses the scheduler entirely, so Unschedulable never actually blocks this pod. Reworded the doc section to state plainly that excluding cordoned nodes here is a deliberate policy choice (respecting drain/maintenance intent), not a technical necessity, and to flag that a future check with a different tradeoff should say so explicitly rather than assume cordons are unconditionally unschedulable.

  5. rdmaFabricProbe has the same undisclosed narrowing — confirmed, my "cluster-aggregate checks are unaffected" claim was too broad. Narrowed the doc to call out that rdmaFabricProbe is itself node-scoped with the identical gap, and filed Other node-scoped checks silently narrow to schedulable GPU nodes without disclosure #1952 to track applying the same disclosure pattern there (and auditing the performance workload-sizing call sites you flagged, which are a different kind of narrowing — sizing vs. "verify every node" — so I didn't want to assume they need identical treatment without a closer look).

  6. Coverage line missing on busy/failed exit paths — fixed as part of the same refactor in point 3/1 above: gpuNodeCoverage.coverageLine() is now called from every return path.

  7. ctx.Done() checks over an already-materialized slice, and the ErrCodeTimeout distinction gets lost when re-wrapped as ErrCodeInternal by existing FindSchedulableGpuNodes callers — left as-is. Agreed this is largely cosmetic for the in-memory loop itself, but it matches the existing rdmaFabricProbe precedent in this same file for a near-identical loop, and removing it now would mean the two loops disagree on convention. Not worth relitigating in this PR.

  8. Test correctness: map-membership check doesn't catch a duplicate masking a missing node — fixed. TestFindGpuNodes/TestFindSchedulableGpuNodes now use a seen-set to explicitly reject duplicates and assert every expected node is present, and added a zero-allocatable-GPU node fixture.

  9. isSkipError string-matching is brittle — fixed, but scoped to this PR's own files: exported validators.IsSkip (uses errors.Is against the sentinel) and switched nvidia_smi_test.go to it. Left validators/conformance/dra_support_check_test.go's copy alone since that file isn't otherwise touched by this PR.

  10. Missing headline test: mixed cordoned+schedulable disclosure/coverage — added TestGpuNodeCoverage_MixedCordonedAndSchedulable, which exercises partitionGpuNodes/enumerationLines/coverageLine directly against a mixed node set. I went this route rather than a full pod-lifecycle simulation (no existing check test in this repo simulates WaitForPodSucceeded+GetLogs via the fake clientset, and building that from scratch felt like a bigger, more fragile lift than the disclosure logic itself warranted) — the refactor in point 6 pulls the disclosure into pure functions specifically so this scenario is testable without needing that machinery.

go build/vet/test -race (full validators/... tree) and golangci-lint all pass clean.

Prefix the coverageLine with "RESULT: ", the existing
pkg/validator/validator.go resultSummaryPrefix convention: the
validator runtime echoes the trailing text of any such stdout line
into live CLI output via slog.Info, unconditionally. Without it, the
coverage figure was only visible after the run inside the (possibly
redacted) report — a gap flagged in review that the prior commit's
redaction writeup didn't fully close.

Updates the doc section and coverageLine test expectations to match.
@rsd-darshan

Copy link
Copy Markdown
Contributor Author

One sub-point I'd only partially addressed: the coverage line lacking the `RESULT: ` prefix (`pkg/validator/validator.go`'s `resultSummaryPrefix`), so it was invisible during a live run regardless of redaction — not just stripped from the signed bundle. Fixed in cfc271c: `coverageLine()` now emits `RESULT: nodesValidated: ...`, which the validator runtime echoes via `slog.Info` unconditionally after each check. Updated the doc section and test expectations to match.

To be precise about what's now covered vs. still tracked in #1951: the coverage figure is visible in live CLI output on every exit path regardless of `--full`/redaction; only the redacted signed-bundle artifact still lacks it (structured-field follow-up in #1951 unchanged).

go build/vet/test -race (full validators/...) and golangci-lint pass clean.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@validators/deployment/nvidia_smi.go`:
- Around line 93-97: Update printLines to accept the validator’s injected or CLI
writer and write each line through it instead of calling fmt.Println. Update all
callers of printLines to pass the configured writer, preserving the existing
line order and output content.
- Around line 115-119: Update the no-GPU early-return path in the surrounding
validation function to initialize and render zero-node coverage before
returning. Ensure it emits nodesValidated: 0/0, while preserving the existing
partitionGpuNodes and coverage.enumerationLines flow for non-empty allNodes.

In `@validators/runner_test.go`:
- Around line 77-94: The TestIsSkip test currently uses string concatenation
rather than a real wrapped Skip error. Convert TestIsSkip into a table-driven
test, retaining nil, plain errors, direct Skip, and text-only cases, and add a
fmt.Errorf("outer: %w", Skip(...)) case expecting true to exercise wrap-chain
classification.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Enterprise

Run ID: b1d8b4ca-729f-4767-898c-34a59a3623a9

📥 Commits

Reviewing files that changed from the base of the PR and between cd806b5 and 977854e.

📒 Files selected for processing (8)
  • docs/contributor/validator.md
  • recipes/validators/README.md
  • recipes/validators/catalog.yaml
  • validators/deployment/nvidia_smi.go
  • validators/deployment/nvidia_smi_test.go
  • validators/helper/gpu_test.go
  • validators/runner.go
  • validators/runner_test.go

Comment thread validators/deployment/nvidia_smi.go Resolved
Comment thread validators/deployment/nvidia_smi.go Resolved
Comment thread validators/runner_test.go Resolved

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@docs/contributor/validator.md`:
- Line 429: Remove the trailing space inside the Markdown code spans containing
RESULT: in docs/contributor/validator.md, including both occurrences referenced
near lines 429 and 437, so each span uses `RESULT:` without internal spaces.
- Around line 426-428: Update the checkNvidiaSMI empty-discovery skip path to
emit the required coverage line before returning when len(allNodes) == 0, using
the explicit 0/0 nodesValidated result. Keep the existing skip behavior
unchanged after reporting coverage.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Enterprise

Run ID: 4074970b-3e4c-4542-b54c-ba4bc38e428a

📥 Commits

Reviewing files that changed from the base of the PR and between 977854e and cfc271c.

📒 Files selected for processing (3)
  • docs/contributor/validator.md
  • validators/deployment/nvidia_smi.go
  • validators/deployment/nvidia_smi_test.go

Comment thread docs/contributor/validator.md Resolved
Comment thread docs/contributor/validator.md Resolved
…p test

- checkNvidiaSMI now runs the (trivially empty) partition + prints
  enumeration/coverage lines before the "no GPU nodes found" skip too,
  so nodesValidated: 0/0 appears on that exit path like every other —
  it was the one exit this refactor's own stated invariant missed.
- Convert TestIsSkip to table-driven (repo convention for multi-case
  tests) and add a case that wraps Skip() through a real fmt.Errorf
  %w chain, not just a string-concatenated lookalike, to prove IsSkip
  classifies via errors.Is across an actual wrap chain.
@rsd-darshan

Copy link
Copy Markdown
Contributor Author

Addressed the 3rd CodeRabbit pass in 74f4538:

  1. No-GPU-nodes exit missing coverage line — fixed. `checkNvidiaSMI` now runs the partition and prints `enumerationLines`/`coverageLine(0)` before that skip too, so `nodesValidated: 0/0` appears there like every other exit — this was the one path my own "every exit path" refactor missed.
  2. `TestIsSkip` should be table-driven with a real wrap-chain case — fixed. Converted to table-driven (repo convention) and added a `fmt.Errorf("outer: %w", Skip(...))` case so the test actually proves `IsSkip` classifies through a genuine Go error-wrap chain, not just a string-concatenated lookalike.
  3. Route output through a configured writer — declined again, same reasoning as the prior pass: every check in this package writes evidence via direct `fmt.Printf`/`fmt.Println`, and introducing a writer abstraction for just this one check would be inconsistent with the rest of `validators/deployment`.

`go build`/`vet`/`test -race` (full `validators/...`) and `golangci-lint` all pass clean.

Drop the trailing space inside the isolated `RESULT: ` code spans
(the prefix's own two lines of explanation) per markdownlint-cli2
MD038; the code span containing the full example line
(`RESULT: nodesValidated: ...`) was already fine since the space
there isn't adjacent to a backtick.
@rsd-darshan

Copy link
Copy Markdown
Contributor Author

Addressed the 4th CodeRabbit pass in d2aedc7:

  1. Empty-discovery skip path missing coverage line — already fixed in 74f4538 (pushed just before this pass ran, so the review caught the pre-fix state).
  2. MD038 markdownlint: spaces inside `RESULT: ` code spans — fixed, dropped the trailing space in both isolated-prefix code spans (lines 429/437). The code span containing the full example line (`RESULT: nodesValidated: ...`) was already fine since the space there isn't adjacent to a backtick.

@yuanchen8911 yuanchen8911 added the theme/validation Constraint evaluation, health checks, and conformance evidence label Jul 30, 2026

@yuanchen8911 yuanchen8911 left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for the PR!

The implementation satisfies the agreed scope of #1668 — cordoned nodes are disclosed on every exit path, the RESULT: convention is used correctly, and the helper refactor preserves existing callers' behavior. One documentation-contract mismatch and two cosmetic nits:

Documented coverage numerator doesn't match the implementation. The new rule in docs/contributor/validator.md documents the coverage line as RESULT: nodesValidated: <schedulable>/<total>, but checkNvidiaSMI passes the validated count: 0 on the busy-skip path (nvidia_smi.go#L148) even though schedulable nodes exist there, and only the successful-node count on the failure path (nvidia_smi.go#L179). So <schedulable> documents the wrong numerator on exactly the skip and failure paths the rule explicitly covers. The implementation's semantics are the better contract — the test even asserts them deliberately ("validated tracks nodes actually confirmed, not nodes attempted") — so suggest changing the placeholder to <validated> and defining that term in the doc.

Nits:

  • With zero GPU nodes the enumeration prints Found 0 GPU node(s), 0 schedulable, 0 cordoned: — a trailing colon introducing an empty list. Consider suppressing the listing when the total is 0.
  • The busy-skip coverage line renders nodesValidated: 0/2 (0 cordoned, skipped) when nothing is cordoned — accurate but reads oddly. Consider omitting the parenthetical when the cordoned count is 0.

Rebase too.

@yuanchen8911 yuanchen8911 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Requesting the documentation-contract fix from my earlier review comment: the coverage-line rule in docs/contributor/validator.md documents the numerator as <schedulable>, but the implementation passes the validated count (0 on the busy-skip path, successful-node count on the failure path) — the doc should say <validated> and define it, since the implementation's semantics are the better contract and the tests assert them deliberately. The two output-phrasing nits from the same comment are optional. Implementation itself is solid and satisfies the #1668 scope.

njhensley added a commit to njhensley/aicr that referenced this pull request Jul 30, 2026
…#1951)

Validator coverage disclosure (e.g. check-nvidia-smi's
nodesValidated/nodesTotal and skip reasons from NVIDIA#1936) only reached
TestResult.Stdout/.Message, which the default "minimal" redaction policy
strips from a signed evidence bundle. A downstream consumer verifying
the default artifact could not distinguish a 1-of-2-node pass from a
2-of-2 pass, and an all-cordoned skip lost its reason.

Carry that signal in a structured, low-cardinality CTRF field instead of
overloading free-form log text:

- ctrf.TestResult gains an Extra map[string]string mirroring the CTRF
  spec's `extra` object, plus an ExtraLinePrefix contract shared between
  the in-pod producer and the orchestrator consumer.
- validators.EmitExtra marshals a check's Extra map to a single
  prefixed stdout line; job.ExtractResult parses each sentinel line and
  keeps the last VALID non-empty payload (a later malformed line no
  longer discards an earlier valid one), stripping all prefixed lines
  from human-readable Stdout.
- redact.CTRF rebuilds Extra against a fail-closed key AND value
  allowlist (ctrfExtraAllowlist): a surviving key's value must also match
  its canonical shape (decimal count / kebab-case enum code), so an
  identifier smuggled under an allowed key is dropped at the publication
  boundary — emission-side validation alone is bypassable. Unknown keys
  and empty results ship nothing; PolicyVersion bumps to v2.
- checkNvidiaSMI computes the coverage denominator before verification
  and emits coverage on BOTH pass and fail paths, counting only nodes
  that passed and omitting nodesTotal when node discovery failed rather
  than fabricating a full-coverage claim; helper adds FindAllGpuNodes.
- builder.AddResult defensively copies Extra so later caller mutation
  cannot alter the built report.
- docs/contributor/validator.md documents the field, the contract, the
  value-shape enforcement, and the allowlist.

The contract is enforced by godoc and the redact allowlist: values must
be counts or enum codes only, never node names, IPs, or hostnames.

Signed-off-by: Nathan Hensley <[email protected]>
njhensley added a commit to njhensley/aicr that referenced this pull request Jul 30, 2026
…#1951)

Validator coverage disclosure (e.g. check-nvidia-smi's
nodesValidated/nodesTotal and skip reasons from NVIDIA#1936) only reached
TestResult.Stdout/.Message, which the default "minimal" redaction policy
strips from a signed evidence bundle. A downstream consumer verifying
the default artifact could not distinguish a 1-of-2-node pass from a
2-of-2 pass, and an all-cordoned skip lost its reason.

Carry that signal in a structured, low-cardinality CTRF field instead of
overloading free-form log text:

- ctrf.TestResult gains an Extra map[string]string mirroring the CTRF
  spec's `extra` object, plus an ExtraLinePrefix contract shared between
  the in-pod producer and the orchestrator consumer.
- validators.EmitExtra marshals a check's Extra map to a single
  prefixed stdout line; job.ExtractResult parses each sentinel line and
  keeps the last VALID non-empty payload (a later malformed line no
  longer discards an earlier valid one), stripping all prefixed lines
  from human-readable Stdout.
- redact.CTRF rebuilds Extra against a fail-closed key AND value
  allowlist (ctrfExtraAllowlist): a surviving key's value must also match
  its canonical shape (decimal count / kebab-case enum code), so an
  identifier smuggled under an allowed key is dropped at the publication
  boundary — emission-side validation alone is bypassable. Unknown keys
  and empty results ship nothing; PolicyVersion bumps to v2.
- checkNvidiaSMI computes the coverage denominator before verification
  and emits coverage on BOTH pass and fail paths, counting only nodes
  that passed and omitting nodesTotal when node discovery failed rather
  than fabricating a full-coverage claim; helper adds FindAllGpuNodes.
- builder.AddResult defensively copies Extra so later caller mutation
  cannot alter the built report.
- docs/contributor/validator.md documents the field, the contract, the
  value-shape enforcement, and the allowlist.

The contract is enforced by godoc and the redact allowlist: values must
be counts or enum codes only, never node names, IPs, or hostnames.

Signed-off-by: Nathan Hensley <[email protected]>
njhensley added a commit to njhensley/aicr that referenced this pull request Jul 30, 2026
…#1951)

Validator coverage disclosure (e.g. check-nvidia-smi's
nodesValidated/nodesTotal and skip reasons from NVIDIA#1936) only reached
TestResult.Stdout/.Message, which the default "minimal" redaction policy
strips from a signed evidence bundle. A downstream consumer verifying
the default artifact could not distinguish a 1-of-2-node pass from a
2-of-2 pass, and an all-cordoned skip lost its reason.

Carry that signal in a structured, low-cardinality CTRF field instead of
overloading free-form log text:

- ctrf.TestResult gains an Extra map[string]string mirroring the CTRF
  spec's `extra` object, plus an ExtraLinePrefix contract shared between
  the in-pod producer and the orchestrator consumer.
- validators.EmitExtra marshals a check's Extra map to a single
  prefixed stdout line; job.ExtractResult parses each sentinel line and
  keeps the last VALID non-empty payload (a later malformed line no
  longer discards an earlier valid one), stripping all prefixed lines
  from human-readable Stdout.
- redact.CTRF rebuilds Extra against a fail-closed key AND value
  allowlist (ctrfExtraAllowlist): a surviving key's value must also match
  its canonical shape (decimal count / kebab-case enum code), so an
  identifier smuggled under an allowed key is dropped at the publication
  boundary — emission-side validation alone is bypassable. Unknown keys
  and empty results ship nothing; PolicyVersion bumps to v2.
- checkNvidiaSMI computes the coverage denominator before verification
  and emits coverage on BOTH pass and fail paths, counting only nodes
  that passed and omitting nodesTotal when node discovery failed rather
  than fabricating a full-coverage claim; helper adds FindAllGpuNodes.
- builder.AddResult defensively copies Extra so later caller mutation
  cannot alter the built report.
- docs/contributor/validator.md documents the field, the contract, the
  value-shape enforcement, and the allowlist.

The contract is enforced by godoc and the redact allowlist: values must
be counts or enum codes only, never node names, IPs, or hostnames.

Signed-off-by: Nathan Hensley <[email protected]>
njhensley added a commit to njhensley/aicr that referenced this pull request Jul 30, 2026
…#1951)

Validator coverage disclosure (e.g. check-nvidia-smi's
nodesValidated/nodesTotal and skip reasons from NVIDIA#1936) only reached
TestResult.Stdout/.Message, which the default "minimal" redaction policy
strips from a signed evidence bundle. A downstream consumer verifying
the default artifact could not distinguish a 1-of-2-node pass from a
2-of-2 pass, and an all-cordoned skip lost its reason.

Carry that signal in a structured, low-cardinality CTRF field instead of
overloading free-form log text:

- ctrf.TestResult gains an Extra map[string]string mirroring the CTRF
  spec's `extra` object, plus an ExtraLinePrefix contract shared between
  the in-pod producer and the orchestrator consumer.
- validators.EmitExtra marshals a check's Extra map to a single
  prefixed stdout line; job.ExtractResult parses each sentinel line and
  keeps the last VALID non-empty payload (a later malformed line no
  longer discards an earlier valid one), stripping all prefixed lines
  from human-readable Stdout.
- redact.CTRF rebuilds Extra against a fail-closed key AND value
  allowlist (ctrfExtraAllowlist): a surviving key's value must also match
  its canonical shape (decimal count / kebab-case enum code), so an
  identifier smuggled under an allowed key is dropped at the publication
  boundary — emission-side validation alone is bypassable. Unknown keys
  and empty results ship nothing; PolicyVersion bumps to v2.
- checkNvidiaSMI computes the coverage denominator before verification
  and emits coverage on BOTH pass and fail paths, counting only nodes
  that passed and omitting nodesTotal when node discovery failed rather
  than fabricating a full-coverage claim; helper adds FindAllGpuNodes.
- builder.AddResult defensively copies Extra so later caller mutation
  cannot alter the built report.
- docs/contributor/validator.md documents the field, the contract, the
  value-shape enforcement, and the allowlist.

The contract is enforced by godoc and the redact allowlist: values must
be counts or enum codes only, never node names, IPs, or hostnames.

Signed-off-by: Nathan Hensley <[email protected]>
njhensley added a commit to njhensley/aicr that referenced this pull request Jul 31, 2026
…#1951)

Validator coverage disclosure (e.g. check-nvidia-smi's
nodesValidated/nodesTotal and skip reasons from NVIDIA#1936) only reached
TestResult.Stdout/.Message, which the default "minimal" redaction policy
strips from a signed evidence bundle. A downstream consumer verifying
the default artifact could not distinguish a 1-of-2-node pass from a
2-of-2 pass, and an all-cordoned skip lost its reason.

Carry that signal in a structured, low-cardinality CTRF field instead of
overloading free-form log text:

- ctrf.TestResult gains an Extra map[string]string mirroring the CTRF
  spec's `extra` object, plus an ExtraLinePrefix contract shared between
  the in-pod producer and the orchestrator consumer.
- validators.EmitExtra marshals a check's Extra map to a single
  prefixed stdout line; job.ExtractResult parses each sentinel line and
  keeps the last VALID non-empty payload (a later malformed line no
  longer discards an earlier valid one), stripping all prefixed lines
  from human-readable Stdout.
- redact.CTRF rebuilds Extra against a fail-closed key AND value
  allowlist (ctrfExtraAllowlist): a surviving key's value must also match
  its canonical shape (decimal count / kebab-case enum code), so an
  identifier smuggled under an allowed key is dropped at the publication
  boundary — emission-side validation alone is bypassable. Unknown keys
  and empty results ship nothing; PolicyVersion bumps to v2.
- checkNvidiaSMI computes the coverage denominator before verification
  and emits coverage on BOTH pass and fail paths, counting only nodes
  that passed and omitting nodesTotal when node discovery failed rather
  than fabricating a full-coverage claim; helper adds FindAllGpuNodes.
- builder.AddResult defensively copies Extra so later caller mutation
  cannot alter the built report.
- docs/contributor/validator.md documents the field, the contract, the
  value-shape enforcement, and the allowlist.

The contract is enforced by godoc and the redact allowlist: values must
be counts or enum codes only, never node names, IPs, or hostnames.

Signed-off-by: Nathan Hensley <[email protected]>
docs/contributor/validator.md documented the coverage line's numerator
as <schedulable>, but checkNvidiaSMI passes the validated count, which
differs on the busy-skip (0, nothing attempted) and failure (successful
subset) paths -- exactly the paths the rule exists to cover. The
implementation's semantics are the correct contract (the mixed-scenario
test already asserts this deliberately), so the doc now says
<validated> and defines it, instead of the code being wrong.

Also fold in the two phrasing nits from the same review: an empty
cluster now prints "Found 0 GPU node(s)." instead of a header with a
trailing colon over an empty list, and the coverage line omits the
"(0 cordoned, skipped)" parenthetical when nothing is cordoned.
@rsd-darshan

Copy link
Copy Markdown
Contributor Author

Thanks — fixed in 71014dc:

Doc-contract mismatch (blocking): you're right, the doc said <schedulable> but the code passes the validated count, which diverges on the busy-skip (0, nothing attempted) and failure (successful-subset) paths — exactly the paths this rule exists for. Rather than change the code's behavior (the mixed-scenario test already asserts the validated-count semantics deliberately, and it's the more useful signal), I fixed the doc: it now says <validated> and defines what that means on each exit path.

Both nits: also applied — empty cluster now prints Found 0 GPU node(s). instead of a header over an empty list, and the coverage line omits (0 cordoned, skipped) when nothing is cordoned. Added TestGpuNodeCoverage_EdgeCasePhrasing covering both.

On "Rebase too": deliberately not doing this one. This branch was created fresh from upstream/main per a standing rule for this workflow — no rebasing or updating a branch after creation, always start clean per issue — so I'm keeping it as-is rather than making an exception mid-review. It doesn't block anything mechanically: the PR is MERGEABLE with no conflicts against main, and #1918's CI fix (the make test /validators exclusion you flagged earlier) is already on main, so it'll be picked up automatically in the merge-ref this PR's CI tests against, without needing a rebase on my end.

go build/vet/test -race (full validators/...) and golangci-lint all pass clean.

@github-actions github-actions Bot added size/XL and removed size/L labels Jul 31, 2026
njhensley added a commit to njhensley/aicr that referenced this pull request Jul 31, 2026
…#1951)

Validator coverage disclosure (e.g. check-nvidia-smi's
nodesValidated/nodesTotal and skip reasons from NVIDIA#1936) only reached
TestResult.Stdout/.Message, which the default "minimal" redaction policy
strips from a signed evidence bundle. A downstream consumer verifying
the default artifact could not distinguish a 1-of-2-node pass from a
2-of-2 pass, and an all-cordoned skip lost its reason.

Carry that signal in a structured, low-cardinality CTRF field instead of
overloading free-form log text:

- ctrf.TestResult gains an Extra map[string]string mirroring the CTRF
  spec's `extra` object, plus an ExtraLinePrefix contract shared between
  the in-pod producer and the orchestrator consumer.
- validators.EmitExtra marshals a check's Extra map to a single
  prefixed stdout line; job.ExtractResult parses each sentinel line and
  keeps the last VALID non-empty payload (a later malformed line no
  longer discards an earlier valid one), stripping all prefixed lines
  from human-readable Stdout.
- redact.CTRF rebuilds Extra against a fail-closed key AND value
  allowlist (ctrfExtraAllowlist): a surviving key's value must also match
  its canonical shape (decimal count / kebab-case enum code), so an
  identifier smuggled under an allowed key is dropped at the publication
  boundary — emission-side validation alone is bypassable. Unknown keys
  and empty results ship nothing; PolicyVersion bumps to v2.
- checkNvidiaSMI computes the coverage denominator before verification
  and emits coverage on BOTH pass and fail paths, counting only nodes
  that passed and omitting nodesTotal when node discovery failed rather
  than fabricating a full-coverage claim; helper adds FindAllGpuNodes.
- builder.AddResult defensively copies Extra so later caller mutation
  cannot alter the built report.
- docs/contributor/validator.md documents the field, the contract, the
  value-shape enforcement, and the allowlist.

The contract is enforced by godoc and the redact allowlist: values must
be counts or enum codes only, never node names, IPs, or hostnames.

Signed-off-by: Nathan Hensley <[email protected]>

@yuanchen8911 yuanchen8911 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

71014dc verified — the coverage-line rule now documents <validated> with a definition that matches the implementation exactly (0 on the all-cordoned and busy-skip paths, successful-node count on the failure path), and both optional phrasing nits are implemented with tests asserting the exact strings. Approving.

One staleness to fix before merge: the PR body's summary bullet still describes the coverage line as nodesValidated: <schedulable>/<total> — please update it to <validated> so the body matches the doc and implementation.

@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.

@njhensley
njhensley merged commit 8cf4179 into NVIDIA:main Jul 31, 2026
155 of 157 checks passed
njhensley added a commit to njhensley/aicr that referenced this pull request Jul 31, 2026
…#1951)

Validator coverage disclosure (e.g. check-nvidia-smi's
nodesValidated/nodesTotal and skip reasons from NVIDIA#1936) only reached
TestResult.Stdout/.Message, which the default "minimal" redaction policy
strips from a signed evidence bundle. A downstream consumer verifying
the default artifact could not distinguish a 1-of-2-node pass from a
2-of-2 pass, and an all-cordoned skip lost its reason.

Carry that signal in a structured, low-cardinality CTRF field instead of
overloading free-form log text:

- ctrf.TestResult gains an Extra map[string]string mirroring the CTRF
  spec's `extra` object, plus an ExtraLinePrefix contract shared between
  the in-pod producer and the orchestrator consumer.
- validators.EmitExtra marshals a check's Extra map to a single
  prefixed stdout line; job.ExtractResult parses each sentinel line and
  keeps the last VALID non-empty payload (a later malformed line no
  longer discards an earlier valid one), stripping all prefixed lines
  from human-readable Stdout.
- redact.CTRF rebuilds Extra against a fail-closed key AND value
  allowlist (ctrfExtraAllowlist): a surviving key's value must also match
  its canonical shape (decimal count / kebab-case enum code), so an
  identifier smuggled under an allowed key is dropped at the publication
  boundary — emission-side validation alone is bypassable. Unknown keys
  and empty results ship nothing; PolicyVersion bumps to v2.
- checkNvidiaSMI computes the coverage denominator before verification
  and emits coverage on BOTH pass and fail paths, counting only nodes
  that passed and omitting nodesTotal when node discovery failed rather
  than fabricating a full-coverage claim; helper adds FindAllGpuNodes.
- builder.AddResult defensively copies Extra so later caller mutation
  cannot alter the built report.
- docs/contributor/validator.md documents the field, the contract, the
  value-shape enforcement, and the allowlist.

The contract is enforced by godoc and the redact allowlist: values must
be counts or enum codes only, never node names, IPs, or hostnames.

Signed-off-by: Nathan Hensley <[email protected]>
njhensley added a commit to njhensley/aicr that referenced this pull request Jul 31, 2026
…#1951)

Validator coverage disclosure (e.g. check-nvidia-smi's
nodesValidated/nodesTotal and skip reasons from NVIDIA#1936) only reached
TestResult.Stdout/.Message, which the default "minimal" redaction policy
strips from a signed evidence bundle. A downstream consumer verifying
the default artifact could not distinguish a 1-of-2-node pass from a
2-of-2 pass, and an all-cordoned skip lost its reason.

Carry that signal in a structured, low-cardinality CTRF field instead of
overloading free-form log text:

- ctrf.TestResult gains an Extra map[string]string mirroring the CTRF
  spec's `extra` object, plus an ExtraLinePrefix contract shared between
  the in-pod producer and the orchestrator consumer.
- validators.EmitExtra marshals a check's Extra map to a single
  prefixed stdout line; job.ExtractResult parses each sentinel line and
  keeps the last VALID non-empty payload (a later malformed line no
  longer discards an earlier valid one), stripping all prefixed lines
  from human-readable Stdout.
- redact.CTRF rebuilds Extra against a fail-closed key AND value
  allowlist (ctrfExtraAllowlist): a surviving key's value must also match
  its canonical shape (decimal count / kebab-case enum code), so an
  identifier smuggled under an allowed key is dropped at the publication
  boundary — emission-side validation alone is bypassable. Unknown keys
  and empty results ship nothing; PolicyVersion bumps to v2.
- checkNvidiaSMI computes the coverage denominator before verification
  and emits coverage on BOTH pass and fail paths, counting only nodes
  that passed and omitting nodesTotal when node discovery failed rather
  than fabricating a full-coverage claim; helper adds FindAllGpuNodes.
- builder.AddResult defensively copies Extra so later caller mutation
  cannot alter the built report.
- docs/contributor/validator.md documents the field, the contract, the
  value-shape enforcement, and the allowlist.

The contract is enforced by godoc and the redact allowlist: values must
be counts or enum codes only, never node names, IPs, or hostnames.

Signed-off-by: Nathan Hensley <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/docs area/recipes size/XL theme/validation Constraint evaluation, health checks, and conformance evidence

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Validator handles cordoned GPU nodes inconsistently across checks

3 participants