{"record":{"id":"41b6b7445b05e0dc","repo":"Hmbown/CodeWhale","slug":"serialize-rotated-fixture","errorCode":null,"errorMessage":"serialize rotated fixture","messagePattern":"serialize rotated fixture","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"crates/tui/src/client.rs","lineNumber":8301,"sourceCode":"            }),\n            ..Config::default()\n        };\n\n        crate::external_credentials::reset_side_effect_trap();\n        let client = CodewhaleClient::new(&config).expect(\"Codex client\");\n        assert_eq!(client.api_key, token_a);\n        assert_eq!(client.codex_account_id.as_deref(), Some(\"account-a\"));\n        assert_eq!(\n            crate::external_credentials::side_effect_trap_counts(),\n            (1, 1),\n            \"bearer and account id must come from one secure open/read\"\n        );\n\n        // An owner rotation after construction cannot splice account B into\n        // the already-resolved bearer snapshot.\n        std::fs::write(\n            &path,\n            serde_json::to_string(&serde_json::json!({\"tokens\": {\"access_token\": crate::test_support::future_test_jwt(\"b\"), \"account_id\": \"account-b\"}})).expect(\"serialize rotated fixture\"),\n        )\n        .expect(\"rotate fixture\");\n        assert_eq!(client.api_key, token_a);\n        assert_eq!(client.codex_account_id.as_deref(), Some(\"account-a\"));\n    }\n\n    fn client_with_config_secret_sentinels() -> CodewhaleClient {\n        let _ = rustls::crypto::ring::default_provider().install_default();\n        CodewhaleClient::new(&Config {\n            provider: Some(\"zai\".to_string()),\n            api_key: Some(CONFIG_SECRET_SENTINELS[0].to_string()),\n            providers: Some(ProvidersConfig {\n                arcee: ProviderConfig {\n                    api_key: Some(CONFIG_SECRET_SENTINELS[1].to_string()),\n                    ..ProviderConfig::default()\n                },\n                moonshot: ProviderConfig {\n                    api_key: Some(CONFIG_SECRET_SENTINELS[2].to_string()),","sourceCodeStart":8283,"sourceCodeEnd":8319,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/73e0f67d83c59909b571efdfc88c4bc28c309cb1/crates/tui/src/client.rs#L8283-L8319","documentation":"A panic from `serde_json::to_string(...).expect(\"serialize rotated fixture\")` in the rotation branch of the credential-snapshot test. After construction, the test rewrites auth.json with account-B credentials to prove the client keeps its original snapshot; serializing that replacement JSON failed. As with the initial serialize, an in-memory json! literal failing to serialize signals allocation failure or serde_json version inconsistency, not bad data.","triggerScenarios":"`serde_json::to_string(&serde_json::json!({\"tokens\": {\"access_token\": ..., \"account_id\": \"account-b\"}})).expect(\"serialize rotated fixture\")` returns Err during the rotation step of the test.","commonSituations":"OOM on constrained CI runners; inconsistent serde/serde_json versions after a dependency update.","solutions":["Re-run the test and check CI logs for OOM kills.","Ensure one serde_json version via cargo tree -d / cargo update -p serde_json.","Compare with the earlier to_vec call in the same test — if only this one fails, suspect a local edit to the literal.","Raise memory limits if running under tight container constraints."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"let rotated = serde_json::to_string(&serde_json::json!({...}))\n    .unwrap_or_else(|e| panic!(\"serialize rotated fixture: {e}\"));","preventionTips":["Keep serde/serde_json versions consistent across the workspace.","Check CI for OOM when serialization of literal json! values fails.","Mirror the working to_vec pattern earlier in the test when adding rotation steps."],"tags":["rust","serde-json","serialization","test-fixture"],"backgroundTag":"json-serialization-failed","analyzedSha":"73e0f67d83c59909b571efdfc88c4bc28c309cb1","analyzedAt":"2026-09-22T01:30:00.501Z","contentChangedAt":"2026-09-22T01:30:00.501Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}