Skip to content

P3: Add config validation and best practice fixes #334

Description

@ajianaz

Summary

Cora scan found 18 best-practice issues. Most are about missing validation — config values accepted without semantic checks, typos in config silently ignored, and doc/API inconsistencies.

Key Issues

Config values accepted without validation (#94src/config/schema.rs:343)

Free-form strings/numbers (provider, base_url, temperature, max_tokens, timeout, cache_ttl) merged without validation. Invalid values propagate to runtime.

Fix: Add validation step after deserialization.

Profile values unvalidated (#81src/engine/profiles.rs:58)

Focus weights documented as 1-10 but any u32 accepted. Actions documented as block/warn but any string accepted.

Fix: Validate ranges and enums after parsing.

deny_unknown_fields missing (#80src/engine/profiles.rs:145)

Misspelled YAML keys silently dropped. Config appears to work but settings are ignored.

Fix: Add #[serde(deny_unknown_fields)] to config structs.

Unknown category actions treated as blocking (#57src/engine/quality_gate.rs:215)

Typos like Warn or blok silently become blocking failures.

Fix: Use enum deserialization for action values, case-insensitive.

Quality gate ignores enabled flag (#58src/engine/quality_gate.rs:147)

evaluate() can return Fail even when enabled is false.

Fix: Short-circuit when disabled.

Test contains stray eprintln (#44src/engine/rules/mod.rs:440)

Debug output in tests adds noise to CI logs.

Fix: Remove or gate behind debug flag.

review.context_chain not merged (#93 — P1, also noted here)

Documented in P1 bugs issue.

Additional minor items

Effort estimate: 1 day for P3-core (#94, #81, #80, #57, #58), rest ongoing

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions