Skip to main content

anomalyx_core/
lib.rs

1//! # ax-core — the anomalyx contract
2//!
3//! This crate is the *executable contract* the [article][1] argues for: the
4//! typed record model every input collapses into, the anomaly taxonomy, the
5//! deterministic reductions detectors are built on, and the `tq1` output
6//! envelope. It deliberately depends on nothing heavy (no Polars, no math
7//! crates) so the contract stays engine-independent and the mutation-test gate
8//! stays fast.
9//!
10//! Design commitments, straight from the article:
11//! - **Determinism is UX**: see [`det`] — every reduction is order-independent.
12//! - **Honest absence**: [`value::Value::Null`] never becomes a `0.0`;
13//!   detectors that can't run are recorded in [`envelope::Absence`].
14//! - **Handle-based evidence**: compact [`finding::Finding`]s carry stable
15//!   [`finding::Handle`]s that `explain` resolves on demand.
16//! - **Versioned protocol**: [`envelope::PROTOCOL`] and committed
17//!   [`envelope::ExitCode`]s.
18//!
19//! [1]: https://dev.to/copyleftdev/ai-tools-need-contracts-not-prompts-5ca3
20
21pub mod det;
22pub mod dict;
23pub mod envelope;
24pub mod error;
25pub mod finding;
26pub mod record;
27pub mod roles;
28pub mod value;
29
30pub use error::{AxError, Result};
31pub use finding::{AnomalyClass, Finding, Handle, Severity};
32pub use record::{Column, RecordSet};
33pub use roles::{ColumnRole, Role};
34pub use value::{ColType, Value};