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
35 lines
1.3 KiB
Rust
35 lines
1.3 KiB
Rust
use lean_ctx::core::intent_protocol;
|
|
|
|
#[test]
|
|
fn ctx_intent_knowledge_fact_routes_to_project_knowledge() {
|
|
let tmp = tempfile::tempdir().expect("tempdir");
|
|
// TODO: Audit that the environment access only happens in single-threaded code.
|
|
unsafe {
|
|
std::env::set_var(
|
|
"LEAN_CTX_DATA_DIR",
|
|
tmp.path().to_string_lossy().to_string(),
|
|
);
|
|
};
|
|
|
|
let project_root = tmp.path().join("proj");
|
|
std::fs::create_dir_all(&project_root).expect("mkdir");
|
|
let project_root_str = project_root.to_string_lossy().to_string();
|
|
|
|
let query = r#"{"intent_type":"knowledge_fact","category":"decision","key":"k1","value":"v1","confidence":0.9}"#;
|
|
let intent = intent_protocol::intent_from_query(query, Some(&project_root_str));
|
|
intent_protocol::apply_side_effects(&intent, Some(&project_root_str), "s1")
|
|
.expect("apply_side_effects");
|
|
|
|
let knowledge = lean_ctx::core::knowledge::ProjectKnowledge::load(&project_root_str)
|
|
.expect("knowledge should exist");
|
|
assert!(
|
|
knowledge.facts.iter().any(|f| f.is_current()
|
|
&& f.category == "decision"
|
|
&& f.key == "k1"
|
|
&& f.value == "v1")
|
|
);
|
|
|
|
// TODO: Audit that the environment access only happens in single-threaded code.
|
|
unsafe { std::env::remove_var("LEAN_CTX_DATA_DIR") };
|
|
}
|