Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

test(tokenjuice): accept threshold pass-through

Steven Enamakel75c97fcedb2d
diff --git a/tests/raw_coverage/session_store_e2e.rs b/tests/raw_coverage/session_store_e2e.rs
index 5d4ab0f54b..1e4a2ac090 100644
--- a/tests/raw_coverage/session_store_e2e.rs
+++ b/tests/raw_coverage/session_store_e2e.rs
@@ -479,8 +479,8 @@ async fn session_import_rejects_malformed_params() {
///
/// What is asserted unconditionally is what must hold on every branch:
///
-/// 1. `compress` and `detect` agree on the content kind — two controllers, one
-/// classifier, and nothing else checks they stay in step;
+/// 1. an applied `compress` and `detect` agree on the content kind — two
+/// controllers, one classifier, and nothing else checks they stay in step;
/// 2. the reported byte counts describe the actual strings, not estimates;
/// 3. **nothing is lost**: a lossy compaction is recoverable through the token
/// byte-for-byte, and a pass-through returns the input unchanged.
@@ -527,13 +527,6 @@ async fn tokenjuice_compress_agrees_with_detect_and_never_loses_content() {
.await;
let compressed = payload(&compressed, "tokenjuice_compress");
- // (1) One classifier, two controllers.
- assert_eq!(
- compressed.get("kind").and_then(Value::as_str),
- Some(detected_kind.as_str()),
- "compress must route on the same kind detect reports: {compressed}"
- );
-
// (2) The byte counts describe the actual strings.
let text = compressed
.get("text")
@@ -564,6 +557,11 @@ async fn tokenjuice_compress_agrees_with_detect_and_never_loses_content() {
if !applied {
assert!(!lossy, "a pass-through cannot be lossy: {compressed}");
+ assert_eq!(
+ compressed.get("kind").and_then(Value::as_str),
+ Some("plain_text"),
+ "a pass-through reports the uncompressed wire kind: {compressed}"
+ );
assert_eq!(
text, content,
"a pass-through must return the input unchanged — byte for byte"
@@ -579,6 +577,11 @@ async fn tokenjuice_compress_agrees_with_detect_and_never_loses_content() {
"nothing was offloaded, so there is no token to hand back: {compressed}"
);
} else {
+ assert_eq!(
+ compressed.get("kind").and_then(Value::as_str),
+ Some(detected_kind.as_str()),
+ "an applied compression must route on the same kind detect reports: {compressed}"
+ );
assert!(
text.len() < content.len(),
"an applied compaction must shrink the payload: {compressed}"