Skip to content

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

fix(build): suggest the full feature union, and stop a malformed error passing as a dispatch

M3gA-Mind1fcc2348cda1
diff --git a/build.rs b/build.rs
index f7c5b2e5ae..c4382d3550 100644
--- a/build.rs
+++ b/build.rs
@@ -121,7 +121,11 @@ fn warn_about_silently_skipped_test_targets(manifest_dir: &Path) {
return;
};
- let mut skipped: BTreeMap<String, Vec<String>> = BTreeMap::new();
+ // Per target: what is missing NOW (the diagnostic) and what the target
+ // requires IN FULL (the remediation). They differ whenever a caller has
+ // some of the gates already, and conflating them is what made the
+ // suggested command wrong — see the `all` union below.
+ let mut skipped: BTreeMap<String, (Vec<String>, Vec<String>)> = BTreeMap::new();
for (target, required) in gated_test_targets(&manifest) {
let missing: Vec<String> = required
.iter()
@@ -136,7 +140,7 @@ fn warn_about_silently_skipped_test_targets(manifest_dir: &Path) {
.cloned()
.collect();
if !missing.is_empty() {
- skipped.insert(target, missing);
+ skipped.insert(target, (missing, required));
}
}
if skipped.is_empty() {
@@ -145,13 +149,21 @@ fn warn_about_silently_skipped_test_targets(manifest_dir: &Path) {
let detail = skipped
.iter()
- .map(|(target, missing)| format!("{target} (needs {})", missing.join(" + ")))
+ .map(|(target, (missing, _))| format!("{target} (needs {})", missing.join(" + ")))
.collect::<Vec<_>>()
.join(", ");
+ // The union of every skipped target's FULL `required-features`, not just
+ // the subset currently missing. `--features` is the complete set to
+ // activate, not a delta applied to the current one, so a command built from
+ // the missing subset drops the gates the caller already had: with `voice`
+ // on, `raw_coverage_all` is missing only `inference`, and
+ // `--features inference` would silently skip both voice targets again — the
+ // warning would be handing out a command that reproduces the exact failure
+ // it exists to prevent.
let all: Vec<&str> = {
let mut features: Vec<&str> = skipped
.values()
- .flat_map(|missing| missing.iter().map(String::as_str))
+ .flat_map(|(_, required)| required.iter().map(String::as_str))
.collect();
features.sort_unstable();
features.dedup();
diff --git a/tests/worker_c_modules_e2e.rs b/tests/worker_c_modules_e2e.rs
index bfbc410a0b..39dd431b23 100644
--- a/tests/worker_c_modules_e2e.rs
+++ b/tests/worker_c_modules_e2e.rs
@@ -245,12 +245,24 @@ fn assert_rpc_completed(value: &Value, context: &str) {
),
(None, None) => panic!("{context}: response carries neither result nor error: {value}"),
};
- let message = error
- .get("message")
- .and_then(Value::as_str)
- .unwrap_or_default();
+ // Not `unwrap_or_default()`: that turns a missing, null or non-string
+ // `message` into `""`, which then satisfies the check below and lets a
+ // malformed error-only response count as a completed dispatch — the same
+ // vacuous-pass shape this helper was rewritten to remove.
+ let Some(message) = error.get("message").and_then(Value::as_str) else {
+ panic!(
+ "{context}: error response carries no string `message`, so nothing can be \
+ concluded about whether the method dispatched: {value}"
+ );
+ };
+ // `starts_with`, not `contains`: `dispatch.rs:96` builds the string as
+ // `format!("{UNKNOWN_METHOD_PREFIX}{method}")`, so the marker is always at
+ // byte zero — `dispatch.rs:151` reads it back with `strip_prefix` for the
+ // same reason. `contains` would additionally reject a REGISTERED method
+ // whose own validation error quoted the phrase later in the message,
+ // turning a reachable surface into a false failure.
assert!(
- !message.contains(UNKNOWN_METHOD_PREFIX),
+ !message.starts_with(UNKNOWN_METHOD_PREFIX),
"{context}: the core does not serve this method, so the surface is NOT reachable \
— the registry entry is missing or its namespace was renamed. Got: {message}"
);