ATlast — you'll never need to find your favorites on another platform again. Find your favs in the ATmosphere.
atproto

fix extension api-client: unwrap ApiResponse.data structure

Backend endpoints use successResponse() which wraps data in:
{ success: true, data: {...} }

Extension was expecting flat response structure, causing:
- uploadToATlast to return undefined (missing importId, redirectUrl)
- checkSession to return wrapped object instead of user data
- Invalid URL error: "http://127.0.0.1:8888undefined"

Fixed both uploadToATlast and checkSession to access apiResponse.data

byarielm.fyi 95636330 a203bc34

verified
Changed files
+115 -14
docs
packages
extension
src
+109 -10
docs/graph-data.json
··· 3130 3130 "node_type": "outcome", 3131 3131 "title": "Extension built successfully for dev environment", 3132 3132 "description": null, 3133 - "status": "pending", 3133 + "status": "completed", 3134 3134 "created_at": "2025-12-26T00:24:02.307648100-05:00", 3135 - "updated_at": "2025-12-26T00:24:02.307648100-05:00", 3135 + "updated_at": "2025-12-26T13:22:38.789519700-05:00", 3136 3136 "metadata_json": "{\"branch\":\"master\",\"confidence\":95,\"files\":[\"packages/extension/build.js\",\"packages/extension/dist/\"]}" 3137 3137 }, 3138 3138 { ··· 3141 3141 "node_type": "outcome", 3142 3142 "title": "Committed extension refactor with decision graph", 3143 3143 "description": null, 3144 - "status": "pending", 3144 + "status": "completed", 3145 3145 "created_at": "2025-12-26T00:26:17.378515100-05:00", 3146 - "updated_at": "2025-12-26T00:26:17.378515100-05:00", 3146 + "updated_at": "2025-12-26T13:22:40.829054100-05:00", 3147 3147 "metadata_json": "{\"branch\":\"master\",\"commit\":\"d0bcf33\",\"confidence\":100}" 3148 3148 }, 3149 3149 { ··· 3152 3152 "node_type": "action", 3153 3153 "title": "Fixed NaN database error in extension-import", 3154 3154 "description": null, 3155 - "status": "pending", 3155 + "status": "completed", 3156 3156 "created_at": "2025-12-26T00:33:28.860934100-05:00", 3157 - "updated_at": "2025-12-26T00:33:28.860934100-05:00", 3157 + "updated_at": "2025-12-26T13:22:42.926736300-05:00", 3158 3158 "metadata_json": "{\"branch\":\"master\",\"commit\":\"1a355fe\",\"confidence\":95,\"files\":[\"packages/functions/src/extension-import.ts\"]}" 3159 3159 }, 3160 3160 { ··· 3163 3163 "node_type": "outcome", 3164 3164 "title": "Database initialized successfully for dev environment", 3165 3165 "description": null, 3166 - "status": "pending", 3166 + "status": "completed", 3167 3167 "created_at": "2025-12-26T00:47:09.629444300-05:00", 3168 - "updated_at": "2025-12-26T00:47:09.629444300-05:00", 3168 + "updated_at": "2025-12-26T13:22:45.174366200-05:00", 3169 3169 "metadata_json": "{\"branch\":\"master\",\"confidence\":100,\"files\":[\"packages/functions/src/init-db.ts\"]}" 3170 3170 }, 3171 3171 { ··· 3174 3174 "node_type": "action", 3175 3175 "title": "Updated PLAN.md and EXTENSION_STATUS.md with current debugging status", 3176 3176 "description": null, 3177 - "status": "pending", 3177 + "status": "completed", 3178 3178 "created_at": "2025-12-26T00:50:51.291667400-05:00", 3179 - "updated_at": "2025-12-26T00:50:51.291667400-05:00", 3179 + "updated_at": "2025-12-26T13:22:47.378106200-05:00", 3180 3180 "metadata_json": "{\"branch\":\"master\",\"commit\":\"34bd9dc\",\"confidence\":100,\"files\":[\"PLAN.md\",\"EXTENSION_STATUS.md\"]}" 3181 + }, 3182 + { 3183 + "id": 290, 3184 + "change_id": "d73fc969-78c0-4721-8db5-88014cb4a0a6", 3185 + "node_type": "goal", 3186 + "title": "Fix extension upload errors - undefined response and invalid URL", 3187 + "description": null, 3188 + "status": "pending", 3189 + "created_at": "2025-12-26T13:31:45.695565800-05:00", 3190 + "updated_at": "2025-12-26T13:31:45.695565800-05:00", 3191 + "metadata_json": "{\"branch\":\"master\",\"confidence\":85}" 3192 + }, 3193 + { 3194 + "id": 291, 3195 + "change_id": "1d88fcb9-3f0e-400b-aabd-7b1564064fd9", 3196 + "node_type": "observation", 3197 + "title": "Backend returns correct structure but response might be wrapped by successResponse helper", 3198 + "description": null, 3199 + "status": "pending", 3200 + "created_at": "2025-12-26T13:32:20.697112800-05:00", 3201 + "updated_at": "2025-12-26T13:32:20.697112800-05:00", 3202 + "metadata_json": "{\"branch\":\"master\",\"confidence\":90}" 3203 + }, 3204 + { 3205 + "id": 292, 3206 + "change_id": "22c007f9-6e84-4a72-bc6f-462b94655b40", 3207 + "node_type": "observation", 3208 + "title": "successResponse wraps data in {success: true, data: {...}} structure - extension expects flat response", 3209 + "description": null, 3210 + "status": "pending", 3211 + "created_at": "2025-12-26T13:32:50.409160400-05:00", 3212 + "updated_at": "2025-12-26T13:32:50.409160400-05:00", 3213 + "metadata_json": "{\"branch\":\"master\",\"confidence\":95}" 3214 + }, 3215 + { 3216 + "id": 293, 3217 + "change_id": "59087762-06cf-4be1-8a15-fb2244070951", 3218 + "node_type": "action", 3219 + "title": "Fix api-client.ts to unwrap ApiResponse.data field", 3220 + "description": null, 3221 + "status": "pending", 3222 + "created_at": "2025-12-26T13:32:54.625124500-05:00", 3223 + "updated_at": "2025-12-26T13:32:54.625124500-05:00", 3224 + "metadata_json": "{\"branch\":\"master\",\"confidence\":90}" 3225 + }, 3226 + { 3227 + "id": 294, 3228 + "change_id": "6a2f6150-4b32-45ee-b2c7-cd5094fdd8c6", 3229 + "node_type": "outcome", 3230 + "title": "Fixed API client to unwrap ApiResponse.data - both uploadToATlast and checkSession now correctly access nested data field", 3231 + "description": null, 3232 + "status": "pending", 3233 + "created_at": "2025-12-26T13:34:09.012837500-05:00", 3234 + "updated_at": "2025-12-26T13:34:09.012837500-05:00", 3235 + "metadata_json": "{\"branch\":\"master\",\"confidence\":95}" 3181 3236 } 3182 3237 ], 3183 3238 "edges": [ ··· 6227 6282 "weight": 1.0, 6228 6283 "rationale": "Documented current state after fixes", 6229 6284 "created_at": "2025-12-26T00:50:58.391390400-05:00" 6285 + }, 6286 + { 6287 + "id": 278, 6288 + "from_node_id": 290, 6289 + "to_node_id": 291, 6290 + "from_change_id": "d73fc969-78c0-4721-8db5-88014cb4a0a6", 6291 + "to_change_id": "1d88fcb9-3f0e-400b-aabd-7b1564064fd9", 6292 + "edge_type": "leads_to", 6293 + "weight": 1.0, 6294 + "rationale": "Initial observation", 6295 + "created_at": "2025-12-26T13:32:22.732622800-05:00" 6296 + }, 6297 + { 6298 + "id": 279, 6299 + "from_node_id": 291, 6300 + "to_node_id": 292, 6301 + "from_change_id": "1d88fcb9-3f0e-400b-aabd-7b1564064fd9", 6302 + "to_change_id": "22c007f9-6e84-4a72-bc6f-462b94655b40", 6303 + "edge_type": "leads_to", 6304 + "weight": 1.0, 6305 + "rationale": "Found root cause", 6306 + "created_at": "2025-12-26T13:32:52.519089400-05:00" 6307 + }, 6308 + { 6309 + "id": 280, 6310 + "from_node_id": 292, 6311 + "to_node_id": 293, 6312 + "from_change_id": "22c007f9-6e84-4a72-bc6f-462b94655b40", 6313 + "to_change_id": "59087762-06cf-4be1-8a15-fb2244070951", 6314 + "edge_type": "leads_to", 6315 + "weight": 1.0, 6316 + "rationale": "Action to fix", 6317 + "created_at": "2025-12-26T13:32:56.783062600-05:00" 6318 + }, 6319 + { 6320 + "id": 281, 6321 + "from_node_id": 293, 6322 + "to_node_id": 294, 6323 + "from_change_id": "59087762-06cf-4be1-8a15-fb2244070951", 6324 + "to_change_id": "6a2f6150-4b32-45ee-b2c7-cd5094fdd8c6", 6325 + "edge_type": "leads_to", 6326 + "weight": 1.0, 6327 + "rationale": "Implementation complete", 6328 + "created_at": "2025-12-26T13:34:11.125730600-05:00" 6230 6329 } 6231 6330 ] 6232 6331 }
+6 -4
packages/extension/src/lib/api-client.ts
··· 52 52 throw new Error(`Upload failed: ${response.status} ${errorText}`); 53 53 } 54 54 55 - const data: ExtensionImportResponse = await response.json(); 56 - return data; 55 + // Backend wraps response in ApiResponse structure: { success: true, data: {...} } 56 + const apiResponse: { success: boolean; data: ExtensionImportResponse } = await response.json(); 57 + return apiResponse.data; 57 58 } catch (error) { 58 59 console.error('[API Client] Upload error:', error); 59 60 throw error instanceof Error ··· 125 126 return null; 126 127 } 127 128 128 - const data = await response.json(); 129 - return data; 129 + // Backend wraps response in ApiResponse structure: { success: true, data: {...} } 130 + const apiResponse: { success: boolean; data: any } = await response.json(); 131 + return apiResponse.data; 130 132 } catch (error) { 131 133 console.error('[API Client] Session check failed:', error); 132 134 return null;