MCPcopy Create free account
hub / github.com/AI45Lab/Code / compact_policy_applies_tighter_caps

Function compact_policy_applies_tighter_caps

core/src/context/assembler.rs:277–297  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

275
276 #[test]
277 fn compact_policy_applies_tighter_caps() {
278 let assembler = ContextAssembler::from_policy(ContextAssemblyPolicy::compact());
279 let assembly = assembler.assemble(&[result(
280 "test",
281 (0..10)
282 .map(|index| {
283 ContextItem::new(
284 format!("file-{index}"),
285 ContextType::Resource,
286 format!("file {index}"),
287 )
288 .with_source(format!("file://{index}"))
289 .with_relevance(1.0 - index as f32 * 0.01)
290 .with_token_count(1)
291 })
292 .collect(),
293 )]);
294
295 assert_eq!(assembly.items.len(), 4);
296 assert!(assembly.truncated);
297 }
298
299 #[test]
300 fn expansive_policy_allows_broader_context() {

Callers

nothing calls this directly

Calls 5

resultFunction · 0.85
assembleMethod · 0.80
with_token_countMethod · 0.80
with_relevanceMethod · 0.80
with_sourceMethod · 0.80

Tested by

no test coverage detected