{"record":{"id":"eae42dddaca14e7e","repo":"block/buzz","slug":"mentions-a-shared","errorCode":null,"errorMessage":"mentions a-shared","messagePattern":"mentions a-shared","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/buzz-db/src/runtime/tests.rs","lineNumber":1938,"sourceCode":"            .sign_with_keys(&author)\n            .expect(\"sign event\")\n    };\n    let tagged = |content: &str, secs: u64| tagged_kind(9, content, secs);\n\n    let base = 1_700_000_000u64;\n    // Shared rows (both DBs) + replica-only rows (divergence) per community.\n    let a_shared = tagged(\"a-shared\", base);\n    let b_shared = tagged(\"b-shared\", base + 1);\n    for pool in [&writer, &replica] {\n        insert_top_level(pool, comm_a, chan_a, &a_shared).await;\n        insert_mentions(\n            pool,\n            CommunityId::from_uuid(comm_a),\n            &a_shared,\n            Some(chan_a),\n        )\n        .await\n        .expect(\"mentions a-shared\");\n        insert_top_level(pool, comm_b, chan_b, &b_shared).await;\n        insert_mentions(\n            pool,\n            CommunityId::from_uuid(comm_b),\n            &b_shared,\n            Some(chan_b),\n        )\n        .await\n        .expect(\"mentions b-shared\");\n    }\n    let a_replica_only = tagged(\"a-replica-only\", base + 10);\n    let b_replica_only = tagged(\"b-replica-only\", base + 11);\n    insert_top_level(&replica, comm_a, chan_a, &a_replica_only).await;\n    insert_mentions(\n        &replica,\n        CommunityId::from_uuid(comm_a),\n        &a_replica_only,\n        Some(chan_a),","sourceCodeStart":1920,"sourceCodeEnd":1956,"githubUrl":"https://github.com/block/buzz/blob/dad5a33865fc81a2e55b3b60746632f615ec1e3a/crates/buzz-db/src/runtime/tests.rs#L1920-L1956","documentation":"Panic from `.expect(\"mentions a-shared\")` on `insert_mentions(...)` in the community-routing test. insert_mentions returns a Result; Err means the mention rows for event `a_shared` in community A failed to insert (constraint violation, pool/connection failure, or schema mismatch).","triggerScenarios":"insert_mentions called with CommunityId comm_a and event a_shared while Postgres is down, the events/mentions schema is missing, or the event was not inserted first (FK failure).","commonSituations":"Integration test run without the required Postgres, stale migrations in the scratch DB, inserting mentions before the parent event exists.","solutions":["Ensure a running Postgres and correct DATABASE_URL before running ignored tests","Run migrations on the scratch DB before inserts (insert_top_level first, then insert_mentions)","Check the returned error message inside the expect to distinguish FK vs connection errors"],"exampleFix":"// before\n.await.expect(\"mentions a-shared\");\n// after\n.await.unwrap_or_else(|e| panic!(\"mentions a-shared: {e}\"));","handlingStrategy":"try-catch","validationCode":"sqlx::query(\"SELECT 1\").execute(pool).await?; // pool liveness before seeding\n// ensure parent event exists:\nassert!(fetch_event(pool, &a_shared.id).await.is_some(), \"parent event must exist before insert_mentions\");","typeGuard":null,"tryCatchPattern":"insert_mentions(pool, comm_a, &a_shared, Some(chan_a)).await\n    .unwrap_or_else(|e| panic!(\"mentions a-shared: {e}\"));","preventionTips":["Seed parent events before mentions to satisfy FKs","Run ignored tests only with Postgres up (just test)","Use unwrap_or_else to surface the underlying sqlx error"],"tags":["postgres","test-setup","insert","panic"],"backgroundTag":"expect-panic-on-result","analyzedSha":"dad5a33865fc81a2e55b3b60746632f615ec1e3a","analyzedAt":"2026-08-30T13:49:18.474Z","contentChangedAt":"2026-08-30T13:49:18.474Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}