Repository navigation
Validate profiles inside rc, as data, with no per-extension types - #13
Merged
Merged
Conversation
rc profile validate used the validator of go-rc-profiler, which is part of one language's profiler. The validator needs only the profile, the core profile schema and the extension definitions, so it now lives in rc, in internal/validate, where every profiler's output can use it. The profile is checked against the core profile schema, which the build embeds after checking its SHA-256 (scripts/build.go). A build without the schema refuses to validate instead of calling a profile valid. That covers the profile's own fields (apiVersion, kind, metadata, workload), the shape of the extension list, and that every condition has a kind and an interface type. Beyond that the validator knows nothing about any extension. Everything else comes from the definitions of the extensions the profile declares: - every other field of a condition has to be defined for its kind and interface type by one of the declared extensions, which also catches a field used without declaring its extension; - an interface field that an extension defines has to be defined for the condition's kind and type; - where extensions enumerate the values of a field path such as interface.operations[].method or configuration.env[].property, every string at that path has to be one of them; - the extension schemas are applied to the condition as written; - a profile has to name the whole dependency closure of its extensions. An extension can give a field any shape (a string, a list of strings, a list of objects, nested lists) and a new extension needs no change here. The tests use made-up extensions and a made-up core schema, not real ones, and cover each shape, malformed input, the core fields, the definition checks, catalog loading, 400 random combinations of shapes, and a fuzz test. The command's own tests use the same made-up extensions.
colinjlacy
reviewed
Nov 15, 2026
colinjlacy
reviewed
Nov 15, 2026
itvi-1234
force-pushed
the
validate-in-rc-cli
branch
from
November 16, 2026 06:02
102efbe to
adbebda
Compare
The core schema accepts conditions: [] with or without extensions, and rc already did. The if in the test schema only requires extensions when there are conditions, but it read as if it forbade an empty list, so it now has a comment. Tests cover an empty list with no extensions and with an extension declared, and a condition with no declared extensions.
itvi-1234
force-pushed
the
validate-in-rc-cli
branch
from
November 16, 2026 06:12
adbebda to
1d04b44
Compare
colinjlacy
approved these changes
Nov 16, 2026
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.
rc profile validate used the validator of go-rc-profiler, which is part of one language's profiler. The validator needs only the profile, the core profile schema and the extension definitions, so it now lives in rc, in internal/validate, where every profiler's output can use it.
The profile is checked against the core profile schema, which the build embeds after checking its SHA-256 (scripts/build.go). A build without the schema refuses to validate instead of calling a profile valid. That covers the profile's own fields (apiVersion, kind, metadata, workload), the shape of the extension list, and that every condition has a kind and an interface type.
Beyond that the validator knows nothing about any extension. Everything else comes from the definitions of the extensions the profile declares:
An extension can give a field any shape (a string, a list of strings, a list of objects, nested lists) and a new extension needs no change here.
The tests use made-up extensions and a made-up core schema, not real ones, and cover each shape, malformed input, the core fields, the definition checks, catalog loading, 400 random combinations of shapes, and a fuzz test. The command's own tests use the same made-up extensions.