Skip to content

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

test(todos): pin the complete approvalMode variant set, not just the listed one\n\nThe enum check probed whatever the schema listed, so *removing* a variant\nslipped through: drop `not_required` and the surviving `required` probe\nstill round-trips, and the test goes green having verified less than it\ndid before. Assert the exact declared set first.\n\nThe expected set rides on the loop's own list rather than being a literal\nin the body, because the loop is generic over field names — a hard-coded\npair would be silently wrong for the next optional enum added to it.\n\nRevert-checked by dropping `not_required` from the declaration: fails at\nthe new assertion with `left: ["required"]`, `right: ["not_required",\n"required"]`, which is exactly the case the probe loop cannot catch.\n\nClaude-Session: https://claude.ai/code/session_01MPrQdTFHdXTvyZfhaJ1oAq\n

M3gA-Mind67c3a1734290
diff --git a/tests/raw_coverage/todos_lifecycle_e2e.rs b/tests/raw_coverage/todos_lifecycle_e2e.rs
index cfcc8cb1db..6fec60508c 100644
--- a/tests/raw_coverage/todos_lifecycle_e2e.rs
+++ b/tests/raw_coverage/todos_lifecycle_e2e.rs
@@ -858,7 +858,7 @@ async fn todos_replace_accepts_a_card_built_only_from_its_declared_schema() {
// free `Option(String)` — which `approvalMode` was — would let a
// catalog-valid value like "sometimes" through the schema and straight into
// an `invalid params` from the handler.
- for name in ["approvalMode"] {
+ for (name, expected) in [("approvalMode", ["not_required", "required"].as_slice())] {
let field = card_fields
.iter()
.find(|f| f.get("name").and_then(Value::as_str) == Some(name))
@@ -879,6 +879,24 @@ async fn todos_replace_accepts_a_card_built_only_from_its_declared_schema() {
})
.clone();
+ // Probing only what is listed would let a *removed* variant through:
+ // drop `not_required` and the surviving `required` probe still passes.
+ // The complete set is the thing being pinned, so assert it before
+ // probing. `expected` rides on the loop's own list so a second field
+ // brings its own set rather than widening a shared literal.
+ let mut declared = variants
+ .iter()
+ .map(|v| {
+ v.as_str()
+ .unwrap_or_else(|| panic!("`{name}`'s declared variants must be strings"))
+ })
+ .collect::<Vec<_>>();
+ declared.sort_unstable();
+ assert_eq!(
+ declared, expected,
+ "`{name}` must declare exactly the variants its wire type parses"
+ );
+
for (i, variant) in variants.iter().enumerate() {
let mut probe = card.clone();
probe.insert("id".to_string(), Value::String(format!("enum-{name}-{i}")));