Skip to main content

Crate keystate_core

Crate keystate_core 

Source
Expand description

§keystate-core

Canonical domain model, extraction ports, completeness verification, and idempotent output for Keystate — a read-only tool that pulls the complete, verified configuration state of an IAM system out of its database as a single backend-agnostic JSON document.

Core is deliberately backend-agnostic and carries no runtime or database dependency. Adapters (own repos) implement the Extractor, CompletenessVerifier and OutputSink ports against one backend’s schema. The canonical structs are a thin set of common fields plus an open native escape hatch, per the architecture document:

{
  "id": "a1b2c3d4",
  "name": "my-client",
  "enabled": true,
  "native": { /* backend-faithful representation, adapter-owned */ }
}

The three guarantees this crate provides are:

  1. Completeness — a FieldManifest describing every field a backend version must carry, checked by the ManifestVerifier into a VerificationReport that is part of the output, not a side log.
  2. Idempotency — canonical_bytes produces byte-stable output and content_hash fingerprints the config portion only, so a git diff on the output reflects real configuration change, never extraction noise or volatile churn.
  3. Testability — the testing module is a shared contract suite every adapter runs as part of CI.

See ARCHITECTURE.md in this repository for the full design.

§Module map

  • model — canonical entities and the extraction envelope.
  • port — the traits adapters implement.
  • verify — manifests, reports, the verification engine, path resolution.
  • canonical — deterministic serialization and content hashing.
  • error, version — cross-cutting types.

Re-exports§

pub use canonical::canonical_bytes;
pub use canonical::config_bytes;
pub use canonical::content_hash;
pub use canonical::roundtrip;
pub use error::Error;
pub use error::Result;
pub use port::CompletenessVerifier;
pub use port::Extractor;
pub use port::OutputSink;
pub use verify::EntityExpectation;
pub use verify::EntityPresence;
pub use verify::FieldExpectation;
pub use verify::FieldManifest;
pub use verify::IssueKind;
pub use verify::ManifestVerifier;
pub use verify::Severity;
pub use verify::VerificationIssue;
pub use verify::VerificationReport;
pub use verify::resolve_path;
pub use version::Version;
pub use model::*;

Modules§

canonical
Deterministic serialization and content hashing.
error
Error and result types shared across the crate and its ports.
model
The canonical (backend-agnostic) model.
port
The ports (traits) every backend adapter implements.
testing
Shared contract-test suite.
verify
Completeness verification: manifests, reports, the shared engine, and the path resolver.
version
Backend/schema version representation used to key manifests and reports.