CDD-CMDB

A Configuration Management Database defined entirely as a test suite

View the Project on GitHub syndicalt/cdd-cmdb

Architecture

The Core Idea

Traditional software ships code. This project ships tests.

The test suites in this repository define what a Configuration Management Database must do — its API surface, data model, behavioral invariants, performance baselines, and security requirements. Any implementation that passes the tests is a valid CMDB instance. The implementation itself is disposable; the specification is the product.

Why Tests as Specification?

A test suite is a better specification than documentation because:

  1. It’s executable. There’s no ambiguity about what “correctly handles concurrent updates” means — either the test passes or it doesn’t.
  2. It’s versionable. Upgrading the CMDB means pulling new tests and regenerating. No migration scripts, no backwards-compatibility baggage.
  3. It’s composable. Need a lightweight CMDB? Use the minimal profile. Need full compliance? Use enterprise. Need discovery but not governance? Make a custom profile.
  4. It enables AI generation. An LLM can produce an implementation from a test suite more reliably than from prose documentation, because it gets immediate feedback on correctness.

Layers

┌──────────────────────────────────────────────┐
│              specs/                          │
│  OpenAPI 3.1 + JSON Schema                  │
│  (the API contract — what endpoints exist)   │
├──────────────────────────────────────────────┤
│              suites/                         │
│  pytest test suites                          │
│  (the behavioral spec — how they must work)  │
├──────────────────────────────────────────────┤
│              harness/                        │
│  HTTP client + fixtures + strategies         │
│  (the test infrastructure)                   │
├──────────────────────────────────────────────┤
│              profiles/                       │
│  Compliance tiers                            │
│  (which suites to run)                       │
├──────────────────────────────────────────────┤
│              generator/                      │
│  AI-driven code generation                   │
│  (turns the spec into a running server)      │
└──────────────────────────────────────────────┘

Specs Layer

The specs/ directory contains the API contract in two formats:

Suites Layer

The suites/ directory contains pytest modules organized by capability. Each module’s docstring lists the invariants it verifies. Tests use three complementary styles:

Harness Layer

The test infrastructure that makes all suites implementation-agnostic:

Profiles Layer

Profiles select which suites constitute a compliance tier. They’re standard pytest .ini files:

[pytest]
testpaths = suites/core suites/discovery suites/audit suites/graph
addopts = --tb=short -q

Generator Layer

The generator is optional tooling that turns the spec into a running server. It’s not the core product — you can ignore it entirely and validate a hand-written CMDB against the tests.

The Decoupling Point

The entire specification connects to any implementation through a single environment variable:

CMDB_BASE_URL=http://localhost:8080

This is deliberate. The test suite knows nothing about:

It only knows the URL. This means the same tests validate a FastAPI prototype on localhost and a production Kubernetes deployment behind a load balancer.

Data Flow

User / Generator
      │
      │  CMDB_BASE_URL
      ▼
  harness/client.py  ──HTTP──▶  Any CMDB Implementation
      │                              │
      │                              │
  conftest.py fixtures               ▼
      │                         Database (any)
      ▼
  suites/test_*.py
      │
      ▼
  pytest exit code (0 = compliant, 1 = non-compliant)

Extending the Specification

The spec grows by adding tests:

  1. New capability → new suite directory under suites/
  2. New endpoint → new client method in harness/client.py, new response model if needed
  3. New invariant → new test in an existing suite
  4. New compliance tier → new .ini in profiles/

The spec never grows by adding implementation code. If you find yourself writing business logic in the harness, something has gone wrong.