On current main (35765bd41b50a86aa3919eb352bc90321e010e68), cmd/validate accepts CDI documents whose fields do not match the declared cdiVersion.
Repro:
cd cmd/validate
go run . -schema builtin - <<'EOF'
cdiVersion: "1.1.0"
kind: "vendor.com/device"
containerEdits:
intelRdt:
enableCMT: true
devices:
- name: "gpu0"
containerEdits:
deviceNodes:
- path: "/dev/null"
EOF
Actual:
<stdin>: document is valid.
Expected:
Validation should fail because enableCMT / enableMBM are legacy Intel RDT fields and are not valid for a document declaring
cdiVersion: "1.1.0"
The inverse also appears to be accepted:
cdiVersion: "1.0.0"
containerEdits:
intelRdt:
enableMonitoring: false
Expected: validation should fail because enableMonitoring is a v1.1.0 field.
There also seems to be a related library compatibility issue: pkg/cdi.ParseSpec uses strict unmarshalling, while current specs-go.IntelRdt no longer includes enableCMT / enableMBM. That means older valid CDI specs using those legacy fields may be rejected instead of parsed and processed according to their declared spec version.
Suggested behavior: validation/parsing should select field rules based on the document’s declared cdiVersion: accept and process legacy Intel RDT fields for versions where they existed, reject them for v1.1.0+, and reject v1.1.0-only fields in older declared versions.
On current
main(35765bd41b50a86aa3919eb352bc90321e010e68),cmd/validateaccepts CDI documents whose fields do not match the declaredcdiVersion.Repro:
Actual:
<stdin>: document is valid.Expected:
Validation should fail because
enableCMT/enableMBMare legacy Intel RDT fields and are not valid for a document declaringcdiVersion: "1.1.0"The inverse also appears to be accepted:
Expected: validation should fail because enableMonitoring is a v1.1.0 field.
There also seems to be a related library compatibility issue:
pkg/cdi.ParseSpecuses strict unmarshalling, while currentspecs-go.IntelRdtno longer includes enableCMT / enableMBM. That means older valid CDI specs using those legacy fields may be rejected instead of parsed and processed according to their declared spec version.Suggested behavior: validation/parsing should select field rules based on the document’s declared cdiVersion: accept and process legacy Intel RDT fields for versions where they existed, reject them for v1.1.0+, and reject v1.1.0-only fields in older declared versions.