{"record":{"id":"75425ff5aba400a0","repo":"astrid-runtime/astrid","slug":"reply-deserializes","errorCode":null,"errorMessage":"reply deserializes","messagePattern":"reply deserializes","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/astrid-gateway/src/routes/sessions_tests.rs","lineNumber":441,"sourceCode":"    });\n\n    let payload = build_list_payload(correlation_id, None, DEFAULT_LIMIT, false);\n    let value = request_capsule(\n        &bus,\n        TOPIC_LIST_REQUEST,\n        &response_topic,\n        payload,\n        correlation_id,\n        &principal,\n        None,\n        &[live_source],\n        CAPSULE_TIMEOUT,\n    )\n    .await\n    .expect(\"helper accepts the registry-provided source id\");\n\n    capsule.await.expect(\"stand-in capsule task joins\");\n    let parsed = parse_list_response(value).expect(\"reply deserializes\");\n    assert!(parsed.sessions.is_empty());\n}\n\n#[test]\nfn resolve_search_limit_defaults_and_caps() {\n    assert_eq!(resolve_search_limit(None).unwrap(), DEFAULT_SEARCH_LIMIT);\n    assert_eq!(resolve_search_limit(Some(0)).unwrap(), DEFAULT_SEARCH_LIMIT);\n    assert_eq!(resolve_search_limit(Some(50)).unwrap(), 50);\n    assert_eq!(\n        resolve_search_limit(Some(MAX_SEARCH_LIMIT)).unwrap(),\n        MAX_SEARCH_LIMIT\n    );\n    assert!(matches!(\n        resolve_search_limit(Some(MAX_SEARCH_LIMIT + 1)).unwrap_err(),\n        GatewayError::BadRequest(_)\n    ));\n}\n","sourceCodeStart":423,"sourceCodeEnd":459,"githubUrl":"https://github.com/astrid-runtime/astrid/blob/affd8760f44190dbdfbec23403f4c4b642c33112/crates/astrid-gateway/src/routes/sessions_tests.rs#L423-L459","documentation":"In the gateway sessions test request_capsule_accepts_live_registry_source_id, the reply from the sessions route is parsed with parse_list_response and unwrapped via expect(\"reply deserializes\"). A panic here means the HTTP response body no longer matches the JSON shape parse_list_response expects (sessions list schema changed or the handler returned an error body).","triggerScenarios":"Running the test after changing the sessions list response serialization (renamed/removed fields, changed envelope), or when the route under test returns an error/empty body instead of the expected list JSON.","commonSituations":"Schema drift between the handler and the test's frozen parser; a regression in the route returning a JSON error object; serde field-type changes making deserialization fail.","solutions":["Diff the route's actual response JSON against what parse_list_response expects and update the parser or handler","Run the test with the response body printed/logged to see the mismatched shape","Restore the wire-format field names/types required by the frozen schema","Check that the registry-provided source id path actually succeeded (an earlier failure can yield an error body)"],"exampleFix":"// before\nlet parsed = parse_list_response(value).expect(\"reply deserializes\");\n// after\nlet parsed = parse_list_response(&value)\n    .unwrap_or_else(|e| panic!(\"reply deserializes: {e}; body={value}\"));","handlingStrategy":"try-catch","validationCode":"// assert the shape before parsing in test helpers\nassert!(value.get(\"sessions\").map_or(false, |s| s.is_array()),\n    \"unexpected reply shape: {value}\");","typeGuard":"fn is_list_reply(v: &serde_json::Value) -> bool {\n    v.get(\"sessions\").map_or(false, serde_json::Value::is_array)\n}","tryCatchPattern":"let parsed = parse_list_response(&value)\n    .unwrap_or_else(|e| panic!(\"reply deserializes: {e}; body={value}\"));","preventionTips":["Keep a frozen-schema test per route response type","Print the response body in parser failure messages","Treat any wire-format change as a deliberate schema-version bump"],"tags":["tests","json","deserialization","schema"],"backgroundTag":"json-unmarshal-failed","analyzedSha":"affd8760f44190dbdfbec23403f4c4b642c33112","analyzedAt":"2026-09-09T21:28:12.402Z","contentChangedAt":"2026-09-09T21:28:12.402Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}