This commit includes comprehensive work on Phase 6 features: ## Admission Control (Phase 6 admission middleware) - AdmissionStore implementation backed by TrustRankStore - PoW verification with tier-based difficulty computation - Trust tier progression (Newcomer → Established → Trusted → Authority) - API integration with admission status endpoints ## HLC Recency Lens (Phase 6C) - HlcRecencyLens for distributed system ordering - Hybrid logical clock integration with causality preservation ## Cluster Coordination (Phase 6C) - Multi-node cluster tests (availability, partition tolerance) - CRDT convergence tests for anti-entropy sync - Gateway handler improvements ## Aphoria Code Linter (Phase 2A) - RFC/OWASP corpus builders with network fetching and caching - Concept hierarchy with auto-alias creation on conflict detection - Multiple security extractors (TLS, JWT, CORS, secrets, rate limiting) ## Code Organization - Split large files into modules to comply with 500-line limit - Improved test organization with separate test modules - Fixed rkyv serialization for EigenTrustState (AgentScore struct) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
74 lines
2.5 KiB
Rust
74 lines
2.5 KiB
Rust
//! Truth Lenses for resolving conflicting assertions.
|
|
//!
|
|
//! In Episteme, multiple assertions can exist for the same subject+predicate.
|
|
//! A Lens determines which assertion(s) to return based on a resolution strategy.
|
|
//!
|
|
//! # Design Philosophy
|
|
//!
|
|
//! Following "Deep Module" principle: simple `resolve()` interface hides
|
|
//! complex resolution logic. Lenses are stateless and deterministic.
|
|
//!
|
|
//! # Two Types of Lenses
|
|
//!
|
|
//! | Type | Returns | Purpose |
|
|
//! |------|---------|---------|
|
|
//! | Resolution Lenses | Single winner | "Give me the answer" |
|
|
//! | Analysis Lenses | All claims | "Show me the disagreement" |
|
|
//!
|
|
//! # Standard Resolution Lenses
|
|
//!
|
|
//! | Lens | Strategy | Use Case |
|
|
//! |------|----------|----------|
|
|
//! | Recency | Latest timestamp wins | News, real-time |
|
|
//! | Consensus | Most common object value | Democratic truth (basic) |
|
|
//! | VoteAwareConsensus | Highest vote weight from VoteStore | Democratic truth (advanced) |
|
|
//! | Confidence | Highest assertion confidence field | Source-declared certainty |
|
|
//! | TrustAwareAuthority | Weighted by TrustRank reputation | Expert truth (The Hive) |
|
|
//! | EpochAware | Filters superseded epochs first | Paradigm-safe queries |
|
|
//!
|
|
//! # Analysis Lenses
|
|
//!
|
|
//! | Lens | Strategy | Use Case |
|
|
//! |------|----------|----------|
|
|
//! | Skeptic | Surfaces all claims with conflict score | "Trust but Verify" dashboards |
|
|
//!
|
|
//! # Example
|
|
//!
|
|
//! ```
|
|
//! use stemedb_lens::{Lens, RecencyLens};
|
|
//! use stemedb_core::types::Assertion;
|
|
//!
|
|
//! let lens = RecencyLens;
|
|
//! let assertions: Vec<Assertion> = vec![/* ... */];
|
|
//! let winner = lens.resolve(&assertions);
|
|
//! ```
|
|
|
|
mod confidence;
|
|
mod consensus;
|
|
mod constraints;
|
|
mod eigentrust_authority;
|
|
mod epoch_aware;
|
|
mod hlc_recency;
|
|
mod layered_consensus;
|
|
mod recency;
|
|
mod skeptic;
|
|
mod traits;
|
|
mod trust_aware_authority;
|
|
mod vote_aware_consensus;
|
|
|
|
pub use confidence::ConfidenceLens;
|
|
pub use consensus::ConsensusLens;
|
|
pub use constraints::{ConstraintSet, ConstraintsLens};
|
|
pub use eigentrust_authority::EigenTrustAuthorityLens;
|
|
pub use epoch_aware::{EpochAwareLens, SyncLensWrapper};
|
|
pub use hlc_recency::HlcRecencyLens;
|
|
pub use layered_consensus::LayeredConsensusLens;
|
|
pub use recency::RecencyLens;
|
|
pub use skeptic::SkepticLens;
|
|
pub use traits::{
|
|
compute_conflict_score, AnalysisLens, LayeredLens, LayeredResolution, Lens, Resolution,
|
|
TierResolution,
|
|
};
|
|
pub use trust_aware_authority::TrustAwareAuthorityLens;
|
|
pub use vote_aware_consensus::{AsyncLens, VoteAwareConsensusLens};
|