The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.
Rust agent-orchestrationai-agentsai-assistantdesktopllmlocal-firstmcppersonal-aiprivacyrustsecond-braintauri
test(observability): assert the wallet reporting decision at Sentry, not in logs\n\nCodex on #5967: this file's module doc says the observable contract is "this\ndoes not page", but the assertions were on tracing output, and paging is not\ndecided there. `report_error_message` reaches Sentry by calling\n`sentry::with_scope` / `capture_message` directly (core/observability.rs), not\nthrough a tracing layer, and no Sentry tracing layer is installed here. So the\nINFO/ERROR assertions would keep passing if the expected case started paging,\nor if the genuine-error capture stopped.\n\nThe gate matters for where the fix belongs: that capture is\n`#[cfg(feature = "crash-reporting")]`, which is absent from `[features]\ndefault` but present in scripts/ci/product-features.txt — and the e2e lane\nruns this target with that set (scripts/test-rust-e2e.sh passes\nproduct-features.sh). The gap is real in the lane that runs it.\n\nAdd a `#[cfg(feature = "crash-reporting")] mod paging` counting envelopes on a\n`sentry::test::TestTransport`, wired as tests/observability_smoke.rs does,\nincluding its process-global `sentry::init` lock — cargo runs these functions\non parallel threads.\n\n a_wrapped_wallet_state_pages_nobody -> 0 captured\n a_genuine_wallet_failure_still_pages -> 1 captured\n\nAdded, not substituted: the INFO/ERROR assertions pin the breadcrumb's level\nand its `kind` field, which is what makes a demotion attributable and which\nTestTransport does not see. `#[cfg]` on the module rather than\n`required-features` on the target: with the gate off there is nothing to\ncapture and both counts would be a vacuous 0, while `required-features` would\ntake the classification tests down with it in every contributor build — the\nblunt instrument Cargo.toml already warns about on `observability_smoke`.\n\nProved non-vacuous: swapping the two inputs fails both new tests.\n\ncargo test --features crash-reporting --test observability_wallet_expected_e2e\n -> 8 passed; 0 failed\n
M3gA-Mindfda6f5bb7139
diff --git a/tests/observability_wallet_expected_e2e.rs b/tests/observability_wallet_expected_e2e.rsindex 334eab701d..640c33a458 100644--- a/tests/observability_wallet_expected_e2e.rs+++ b/tests/observability_wallet_expected_e2e.rs@@ -223,3 +223,100 @@ fn reporting_a_genuine_wallet_failure_still_emits_error() {"a real wallet failure must still page. Captured output:\n{logged}");}++// ---------------------------------------------------------------------------+// the reporting decision, observed at Sentry+// ---------------------------------------------------------------------------++// The tracing assertions above pin the breadcrumb: its level, and the `kind`+// field that makes a demotion attributable. They do not pin *paging*, and this+// file's whole claim is that the wallet state "does not page".+//+// `report_error_message` reaches Sentry by calling `sentry::with_scope` /+// `capture_message` directly (`src/core/observability.rs`), not through a+// tracing layer, and no Sentry tracing layer is installed here. So a capture+// that started firing for the expected case — or one that stopped firing for a+// genuine failure — would leave the INFO/ERROR text untouched and every+// assertion above would still pass. These two tests close that gap by counting+// envelopes on a `TestTransport`, which is the same wiring+// `tests/observability_smoke.rs` uses.+//+// Gated, not `required-features`: the Sentry capture in `report_error_message`+// is `#[cfg(feature = "crash-reporting")]`, so with the gate off there is+// nothing to observe and both counts would be a vacuous 0. Putting+// `required-features` on the target instead would take the classification tests+// above down with it in every contributor build — the blunt instrument+// `Cargo.toml` warns about on `observability_smoke`. The e2e lane runs this+// target with the product feature set (`scripts/test-rust-e2e.sh` passes+// `product-features.sh`, which includes `crash-reporting`), so these run where+// it counts.+#[cfg(feature = "crash-reporting")]+mod paging {+ use super::*;++ /// Drive `report_error_or_expected` against an envelope-capturing Sentry+ /// client and return how many events it actually sent.+ ///+ /// `sentry::init` mutates the process-global hub and cargo runs these+ /// functions on parallel threads, so the critical section is serialized+ /// here rather than by imposing `--test-threads=1` on the whole binary —+ /// the same reasoning, and the same shape, as `observability_smoke.rs`.+ fn captured_events_for(message: &str) -> usize {+ static SENTRY_TEST_LOCK: Mutex<()> = Mutex::new(());+ let _guard = SENTRY_TEST_LOCK+ .lock()+ .unwrap_or_else(|poisoned| poisoned.into_inner());++ let transport = sentry::test::TestTransport::new();+ let transport_for_factory = transport.clone();+ let options = sentry::ClientOptions {+ dsn: Some(+ "https://[email protected]/1"+ .parse()+ .expect("dsn parses"),+ ),+ transport: Some(Arc::new(move |_opts: &sentry::ClientOptions| {+ transport_for_factory.clone() as Arc<dyn sentry::Transport>+ })),+ sample_rate: 1.0,+ ..sentry::ClientOptions::default()+ };+ let _sentry_guard = sentry::init(options);++ report_error_or_expected(message, "rpc", "invoke_method", &[]);++ sentry::Hub::current()+ .client()+ .map(|c| c.flush(Some(std::time::Duration::from_secs(2))));+ transport.fetch_and_clear_envelopes().len()+ }++ /// The contract #5805 is about, stated as the thing a user notices:+ /// an unconfigured wallet sends Sentry nothing at all.+ #[test]+ fn a_wrapped_wallet_state_pages_nobody() {+ let wrapped = wrapped_like_issue_5805();++ assert_eq!(+ captured_events_for(&wrapped),+ 0,+ "an unconfigured wallet is expected user-state; reaching Sentry at \+ all is the 55-events-in-72-minutes behaviour #5805 reported. \+ Message under test: {wrapped}"+ );+ }++ /// The contrast case. Without it, a change that demoted *everything* would+ /// satisfy the test above and this file would be pinning silence rather+ /// than a decision.+ #[test]+ fn a_genuine_wallet_failure_still_pages() {+ assert_eq!(+ captured_events_for("wallet signing failed: invalid nonce"),+ 1,+ "a real wallet defect must still reach Sentry; demotion that \+ swallowed it would hide exactly the failures #5805 found were \+ already invisible"+ );+ }+}