Skip to content

feat: add ValidateConfig trait and per-service validation#1212

Closed
geoffjay wants to merge 2 commits into
issue-1197from
issue-1198-2
Closed

feat: add ValidateConfig trait and per-service validation#1212
geoffjay wants to merge 2 commits into
issue-1197from
issue-1198-2

Conversation

@geoffjay
Copy link
Copy Markdown
Owner

Adds a `ValidateConfig` trait to `agentd_common` and implements it across all 12 service configuration sections. Wires `cfg.validate()?` into every service's startup so misconfigurations surface immediately with descriptive error messages before any ports are bound.

Changes:

  • `agentd_common::config::ValidateConfig` trait with `fn validate(&self) -> Result<()>`
  • `AgentdConfig::validate()` that collects errors from all 12 sections (does not short-circuit)
  • `impl ValidateConfig` on all shared config section structs (port > 0, backend enum, URL format, alert thresholds, etc.)
  • `impl ValidateConfig` on all 12 service-level config structs in their respective crates (including memory)
  • `cfg.validate()?` called in `main()` of: core, orchestrator, wrap, ask, notify, communicate, hook, monitor, mcp, ui, index, memory
  • Unit tests for both valid and invalid cases per service

Review feedback addressed:

  • Add `ValidateConfig` impls for `EmbeddingConfig` and `LanceConfig` in memory crate; wire validation and shared-config port/host in `memory/main.rs`
  • Remove `validate_inner()` indirection in `index/config.rs`; logic now lives directly in `impl ValidateConfig for IndexConfig`
  • Make `validate_url()` pub in `agentd-common` for reuse by service crates

Closes #1198

geoffjay and others added 2 commits May 11, 2026 23:24
Add a ValidateConfig trait to agentd_common with implementations for all
12 shared config sections. Add AgentdConfig::validate() that collects
errors from every section. Implement ValidateConfig on all service-level
config structs and wire validate() into each service's startup path so
misconfigurations fail early with descriptive error messages.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Add impl ValidateConfig for EmbeddingConfig and LanceConfig in
  crates/memory/src/config.rs (blocking gap: memory was the only service
  with no validation at startup)
- Wire validation in memory/main.rs: call validate() on embedding and
  lance configs, load shared config for port/host so port=0 is caught
  before any I/O with a clear error message
- Remove validate_inner() indirection in crates/index/src/config.rs;
  move logic directly into impl ValidateConfig for IndexConfig and
  import the trait in index/main.rs and the test module
- Make validate_url() pub in agentd-common so service crates can reuse
  it without duplicating the http/https check

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@geoffjay geoffjay added the review-agent Used to invoke a review by an agent tracking this label label May 12, 2026
@geoffjay
Copy link
Copy Markdown
Owner Author

This change is part of the following stack:

Change managed by git-spice.

@geoffjay
Copy link
Copy Markdown
Owner Author

Duplicate of #1206 — created by git-spice confusion over branch HEAD. Closing in favour of the original PR.

@geoffjay geoffjay closed this May 12, 2026
@geoffjay geoffjay removed the review-agent Used to invoke a review by an agent tracking this label label May 12, 2026
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