Skip to content

[refactor] Unify validator count validation across YAML/TOML/CLI (SSOT) #107

@kangeunchan

Description

@kangeunchan

Enhancement Description

Unify validator count rules across YAML/TOML/CLI paths to prevent late runtime failures and inconsistent behavior.

Background

Validator count validation differs by entry point (YAML vs TOML vs CLI), allowing configs that pass validation but fail at runtime after long operations.

Scope

Create single validator count validation function (SSOT)

  • Files: internal/config/validator.go (new or existing canonical location)

Replace inconsistent validators to call SSOT

  • Files: internal/config/validate.go
  • Files: internal/config/yaml_validator.go
  • Files: cmd/devnet-builder/commands/manage/deploy.go
  • Files: cmd/dvb/provision.go

Rules

  • Local mode: 1–4 validators
  • Docker mode: 1–100 validators

Non-Goals

  • Changing validator semantics beyond enforcing documented limits
  • Adding new modes beyond local/docker in this issue
  • Reworking config file formats

Risks and Open Questions

  • Existing users may rely on permissive validation; need clear error messaging
  • Ensure CLI and config validators share the exact same rule function
  • Confirm edge cases (0, negative, extremely large numbers) are handled consistently

Validation Plan

Unit and Integration Checks

  • go test ./... for internal/config and affected commands
  • Unit tests for SSOT validator function across modes and bounds
  • Snapshot tests for error messages (optional)

End-to-End Checks

  • Provision a network using YAML/TOML with boundary values
  • Confirm invalid configs fail early (before provisioning work)

Evidence Required in Issue Updates

  • Before/after examples showing YAML config that previously passed now fails with correct message
  • Test outputs covering boundary cases

Acceptance Criteria

  • Single validation function used across YAML/TOML/CLI/interactive paths
  • YAML validation matches runtime constraints
  • CLI provision enforces upper bound
  • Rules are documented in one place

Deliverables

  • PR introducing SSOT validator and updating all call sites
  • Regression notes for any breaking validation tightening

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions