Skip to content

[c21 follow-up] kkernel kg --rules: YAML configurable rule loader (ADR-034 §10) #382

@ohdearquant

Description

@ohdearquant

Context

PR #371 (cluster-21) parsed the --rules <path> flag but the configurable rule evaluation was never implemented.

ADR-034 §10 specifies:

  • rules.yaml validated against a JSON Schema before evaluation
  • Malformed yaml → exit code 2 with structured error naming the offending field
  • 6 built-in configurable rules: orphan-entities, self-loops, min-edge-density, required-properties, naming-convention, max-count
  • Pack-provided rule loader (§9)

Current state

kkernel kg validate --rules path/to/rules.yaml returns:

Error: configurable rule loading (--rules) is not yet implemented (ADR-034 §10 deferred to follow-up)...

--no-rules suppresses this error and runs only structural checks.

Required work

  1. Implement rules.yaml JSON Schema validation with exit code 2 on malformed files
  2. Implement the 6 built-in configurable rules
  3. Implement pack-provided rule loader (ADR-034 §9)
  4. Tests: verify exit code 2 on malformed yaml, verify each built-in rule fires on fixture data

Labels

adr-alignment, follow-up, adr-034

Metadata

Metadata

Assignees

No one assigned

    Labels

    adr-alignmentADR v1 series alignment work

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions