Skip to content

fix(config): add config validation + deny_unknown_fields (#334 P3-core)#342

Merged
ajianaz merged 1 commit into
developfrom
fix/p3-config-validation
Jul 16, 2026
Merged

fix(config): add config validation + deny_unknown_fields (#334 P3-core)#342
ajianaz merged 1 commit into
developfrom
fix/p3-config-validation

Conversation

@ajianaz

@ajianaz ajianaz commented Jul 16, 2026

Copy link
Copy Markdown
Collaborator

Summary

Resolves the P3-core items from #334. Config and profile values were accepted without semantic checks, so typos and out-of-range values propagated silently to runtime — config "appeared to work" but settings were ignored or produced wrong behavior.

Fixes

# Issue Fix
#94 Config values accepted without validation Config::validate() runs at load time: temperature (0.0–2.0), max_tokens/timeout (≥1), max_tokens_param, response_format, output.format, hook.mode/on_violation/min_severity, provider.base_url scheme. Multiple errors aggregated.
#81 Profile values unvalidated Profile::validate(): focus weight 1–10, recognized action/tone/detail_level. All built-in profiles pass.
#57 Unknown category actions silently blocking CategoryAction enum with case-insensitive deserialization. A typo like blok now fails loudly at config load instead of silently becoming a blocking failure.
#58 Quality gate ignores enabled flag evaluate() forces GateStatus::Pass when enabled: false. A disabled gate can never block a merge. Counts are still computed for reporting.
#80 Misspelled YAML keys silently dropped #[serde(deny_unknown_fields)] on all config sections (CoraFile, ProviderSection, LlmSection, QualityGateConfig, …). quailty_gate / temprature now rejected at parse time.

Design notes

Testing

  • 24 new tests (validation acceptance/rejection, deny_unknown_fields, case-insensitive enum, disabled gate).
  • All 637 tests pass (615 unit + 16 CLI + 6 config integration).
  • Clippy clean, fmt clean, cargo audit clean.

Refs #334

Resolves the P3-core items from #334 — config values and profile values
were accepted without semantic checks, so typos and out-of-range values
propagated silently to runtime.

#94 — Config::validate() at load time:
  - temperature 0.0..=2.0, max_tokens/timeout >= 1
  - max_tokens_param, response_format, output.format, hook.mode/on_violation/min_severity
  - provider.base_url must have an http(s)/ws/unix scheme
  - multiple errors aggregated into one message

#81 — Profile::validate(): focus weight 1-10, recognized action/tone/detail_level

#57 — CategoryAction enum (case-insensitive deserialize): unknown values
  like 'blok' now fail loudly instead of silently becoming blocking

#58 — evaluate() forces Pass when enabled=false (disabled gate never fails)

#80 — deny_unknown_fields on all config sections: misspelled YAML keys
  (e.g. 'quailty_gate', 'temprature') rejected at parse time

24 new tests covering validation acceptance/rejection and deny_unknown_fields.
All 637 tests pass; clippy + fmt clean.

Refs #334
@ajianaz
ajianaz merged commit 3ac8a77 into develop Jul 16, 2026
10 checks passed
@ajianaz
ajianaz deleted the fix/p3-config-validation branch July 16, 2026 01:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant