feat: optional per-kind schema validation#30
Merged
Conversation
Introduces SchemaValidator that validates node metadata against per-kind schema definitions in cortex.toml. Kinds without schemas pass freely (backward compatible). Supports required fields, type checking (string, number, boolean, array), numeric range constraints (min/max), and allowed values (enum-like). - New schema module in cortex-core gate with validator logic - Schema GateCheck variant integrates with WriteGate - Config parsing for [schemas.*] sections in cortex.toml - 10 unit tests covering all validation paths Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.
Summary
cortex.tomlfor write-time validationConfig example
Changes
crates/cortex-core/src/gate/schema.rs(NEW) — SchemaValidator, field types, violationscrates/cortex-core/src/gate/mod.rs— Schema variant in GateCheck,check_schema()methodcrates/cortex-core/src/lib.rs— re-exportscrates/cortex-server/src/config.rs— schemas config parsingcrates/cortex-server/src/cli/init.rs— schemas field in init configTest plan
cargo test --workspacepassescargo clippy --workspaceclean🤖 Generated with Claude Code