Claims now flow through StemeDB's append-only knowledge graph instead of mutable TOML files. This resolves all 6 critical claim-bypass code paths: - Bridge: lossless AuthoredClaim ↔ Assertion round-trip (comparison, status, lifecycle mapping) - LocalEpisteme: ingest_authored_claim() and fetch_authored_claims() with AUTHORED_CLAIM predicate index - EpistemeClaimStore: ClaimStore trait backed by StemeDB (append-only delete via deprecation) - CLI handlers: all claim commands read/write through StemeDB - Scanner: loads claims from StemeDB with auto-migration fallback to TOML - Export: new `aphoria claims export` serializes StemeDB claims to TOML/JSON Also cleans up dead code (EpistemeConfig.url), renames ingest_claims→ingest_observations, fixes ClaimFilter.authority_tier type, adds Draft variant to ClaimStatus, and fixes pre-existing clippy warnings (too_many_arguments, filter_next→rfind). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
82 lines
3.1 KiB
Rust
82 lines
3.1 KiB
Rust
//! Demonstrates scale-adaptive promotion thresholds.
|
|
//!
|
|
//! Run with: `cargo run --example scale_adaptive_demo`
|
|
|
|
use aphoria::corpus::thresholds::{ScaleAdaptiveThresholds, ScaleTier};
|
|
|
|
fn main() {
|
|
println!("=== Scale-Adaptive Promotion Thresholds Demo ===\n");
|
|
|
|
let thresholds = ScaleAdaptiveThresholds::default();
|
|
|
|
// Scenario 1: Micro Team (3 projects)
|
|
println!("📊 Scenario 1: Micro Team (3 projects)");
|
|
println!("Pattern appears in 2 out of 3 projects (67% adoption)\n");
|
|
|
|
let tier = ScaleTier::from_total_projects(3);
|
|
println!(" Scale Tier: {:?}", tier);
|
|
|
|
let decision = thresholds.evaluate(2, 3, false, None);
|
|
println!(" Decision: {:?}", decision);
|
|
println!(" ✅ Pattern VISIBLE to team (RequireReview)\n");
|
|
|
|
// Scenario 2: Small Team with RFC match
|
|
println!("📊 Scenario 2: Small Team (10 projects)");
|
|
println!("Pattern appears in 9 projects with RFC match (90% adoption)\n");
|
|
|
|
let tier = ScaleTier::from_total_projects(10);
|
|
println!(" Scale Tier: {:?}", tier);
|
|
|
|
let decision = thresholds.evaluate(9, 10, true, Some("rfc://5246"));
|
|
println!(" Decision: {:?}", decision);
|
|
println!(" ✅ Auto-promoted to Regulatory tier\n");
|
|
|
|
// Scenario 3: Enterprise (1000 projects)
|
|
println!("📊 Scenario 3: Enterprise (1000 projects)");
|
|
println!("Pattern appears in 950 projects with RFC match (95% adoption)\n");
|
|
|
|
let tier = ScaleTier::from_total_projects(1000);
|
|
println!(" Scale Tier: {:?}", tier);
|
|
|
|
let decision = thresholds.evaluate(950, 1000, true, Some("rfc://9110"));
|
|
println!(" Decision: {:?}", decision);
|
|
println!(" ✅ Auto-promoted to Regulatory tier (backward compatible)\n");
|
|
|
|
// Scenario 4: Noise prevention
|
|
println!("📊 Scenario 4: Noise Prevention (3 projects)");
|
|
println!("Pattern appears in only 1 project (33% adoption)\n");
|
|
|
|
let tier = ScaleTier::from_total_projects(3);
|
|
println!(" Scale Tier: {:?}", tier);
|
|
|
|
let decision = thresholds.evaluate(1, 3, false, None);
|
|
println!(" Decision: {:?}", decision);
|
|
println!(" ✅ Skipped (floor prevents single-project noise)\n");
|
|
|
|
// Show threshold matrix
|
|
println!("=== Threshold Matrix ===\n");
|
|
println!("| Tier | Projects | Emerging Floor | Regulatory Floor |");
|
|
println!("|------------|----------|----------------|------------------|");
|
|
|
|
for (name, total) in
|
|
[("Micro", 3), ("Small", 10), ("Medium", 50), ("Large", 200), ("Enterprise", 1000)]
|
|
{
|
|
let tier = ScaleTier::from_total_projects(total);
|
|
let tier_thresholds = thresholds.for_tier(tier);
|
|
|
|
let emerging_min = tier_thresholds.emerging.effective_min_projects(total);
|
|
|
|
let regulatory_min = if let Some(reg) = &tier_thresholds.regulatory {
|
|
format!("{}", reg.effective_min_projects(total))
|
|
} else {
|
|
"N/A".to_string()
|
|
};
|
|
|
|
println!("| {:10} | {:8} | {:14} | {:16} |", name, total, emerging_min, regulatory_min);
|
|
}
|
|
|
|
println!("\n✅ Small teams see value immediately!");
|
|
println!("✅ Quality maintained via floors and adoption rates!");
|
|
println!("✅ Enterprise behavior unchanged!");
|
|
}
|