Files
yvgude--lean-ctx/rust/tests/reference_docs_drift.rs
wehub-resource-sync 26382a7ac6
CodeQL / Analyze (javascript-typescript) (push) Waiting to run
JetBrains Plugin / Actionlint (push) Waiting to run
CodeQL / Analyze (actions) (push) Waiting to run
CodeQL / Analyze (rust) (push) Waiting to run
JetBrains Plugin / Validation (push) Waiting to run
JetBrains Plugin / Build (push) Waiting to run
JetBrains Plugin / Test (push) Blocked by required conditions
Security Check / Security Scan (push) Waiting to run
CI / Clippy (push) Failing after 15m13s
CI / Test (ubuntu-latest) (push) Failing after 16m1s
CI / Test (macos-latest) (push) Has been cancelled
CI / Test (windows-latest) (push) Has been cancelled
CI / Build (no embeddings / no ORT) (push) Has been cancelled
CI / Format (push) Has been cancelled
CI / Cookbook (Node) (push) Has been cancelled
CI / Pi Extension (Node) (push) Has been cancelled
CI / Rust SDK (lean-ctx-client) (push) Has been cancelled
CI / Embed SDK (lean-ctx-sdk) (push) Has been cancelled
CI / Python SDK (leanctx) (push) Has been cancelled
CI / Hermes Plugin (Python) (push) Has been cancelled
CI / SDK Conformance Matrix (push) Has been cancelled
CI / Coverage (push) Has been cancelled
CI / cargo-deny (push) Has been cancelled
CI / Adversarial Safety (push) Has been cancelled
CI / Benchmarks (push) Has been cancelled
CI / Output-Quality Gate (eval A/B) (push) Has been cancelled
CI / Documentation (push) Has been cancelled
CI / CI Green (push) Has been cancelled
chore: import upstream snapshot with attribution
2026-07-13 12:35:30 +08:00

41 lines
1.6 KiB
Rust

//! Drift gate for the code-generated reference appendices.
//!
//! `docs/reference/generated/*.md` are rendered from the in-code single sources
//! of truth (MCP registry + `Config` schema). If a new MCP tool or config key
//! is added without regenerating, this test fails — mirroring the CI
//! `gen_docs --check` step so the gap is also caught by `cargo test`.
use lean_ctx::core::reference_docs;
#[test]
fn generated_reference_docs_are_committed_and_current() {
let dir = reference_docs::generated_dir();
for (name, expected) in reference_docs::generated_docs() {
let path = dir.join(name);
let on_disk = std::fs::read_to_string(&path).unwrap_or_else(|e| {
panic!(
"missing generated doc {} ({e}). Run: cargo run --example gen_docs --features dev-tools",
path.display()
)
});
assert!(
reference_docs::content_matches(&on_disk, &expected),
"{} is out of date. Run: cargo run --example gen_docs --features dev-tools",
path.display()
);
}
}
#[test]
fn mcp_tool_count_matches_registry() {
// The MCP-tool appendix is derived from the manifest, which is derived from
// the registry — guard that the registry count is what we document.
let manifest = lean_ctx::core::mcp_manifest::manifest_value();
let granular = manifest["counts"]["granular"].as_u64().unwrap_or(0) as usize;
assert_eq!(
granular,
lean_ctx::server::registry::tool_count(),
"manifest granular tool count must equal registry tool_count()"
);
}