Skip to content

Commit 1561ea0

Browse files
committed
fix: review comments
1 parent 33db2e0 commit 1561ea0

4 files changed

Lines changed: 13 additions & 10 deletions

File tree

api/export_api.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,4 +222,4 @@ def export_chats():
222222
type(e).__name__,
223223
exc_info=True,
224224
)
225-
return jsonify({"error": f"Export failed: {str(e)}"}), 500
225+
return jsonify({"error": "Export failed"}), 500

api/pdf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ def footer(self):
176176
type(e).__name__,
177177
exc_info=True,
178178
)
179-
return jsonify({"error": f"Failed to generate PDF: {str(e)}"}), 500
179+
return jsonify({"error": "Failed to generate PDF"}), 500
180180

181181

182182
def _render_code_block(pdf, code_text: str):

static/js/app.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,8 @@ function normalizeWorkspacesResponse(body) {
9797
}
9898
if (body && typeof body === 'object') {
9999
return {
100-
projects: body.projects || [],
101-
warnings: body.warnings || [],
100+
projects: Array.isArray(body.projects) ? body.projects : [],
101+
warnings: Array.isArray(body.warnings) ? body.warnings : [],
102102
};
103103
}
104104
return { projects: [], warnings: [] };
@@ -117,10 +117,11 @@ function formatParseWarnings(warnings) {
117117
*/
118118
function showIncompleteResultsBanner(containerId, warnings) {
119119
const container = document.getElementById(containerId);
120-
if (!container || !warnings || !warnings.length) return;
120+
if (!container) return;
121121

122122
const existing = container.querySelector('.incomplete-results-banner');
123123
if (existing) existing.remove();
124+
if (!Array.isArray(warnings) || !warnings.length) return;
124125

125126
const text = formatParseWarnings(warnings);
126127
const banner = document.createElement('div');

tests/test_parse_failure_logging.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,10 @@ def _seed_tabs_with_drifted_bubble(parent: str) -> str:
6161

6262
ws_dir = os.path.join(ws_root, "ws-a")
6363
os.makedirs(ws_dir, exist_ok=True)
64+
proj_dir = os.path.join(ws_dir, "proj")
65+
os.makedirs(proj_dir, exist_ok=True)
6466
with open(os.path.join(ws_dir, "workspace.json"), "w", encoding="utf-8") as f:
65-
json.dump({"folder": "/tmp/proj"}, f)
67+
json.dump({"folder": f"file://{proj_dir}"}, f)
6668
sqlite3.connect(os.path.join(ws_dir, "state.vscdb")).close()
6769

6870
conn = sqlite3.connect(os.path.join(global_root, "state.vscdb"))
@@ -126,9 +128,9 @@ def test_workspace_tabs_logs_bubble_json_decode_failure(self) -> None:
126128
conn.commit()
127129
with self.assertLogs("services.workspace_tabs", level="WARNING") as cm:
128130
with app.test_request_context("/api/workspaces/global/tabs"):
129-
payload, status = assemble_workspace_tabs("global", ws_root, rules=[])
131+
_payload, _status = assemble_workspace_tabs("global", ws_root, rules=[])
130132

131-
self.assertEqual(status, 200)
133+
self.assertEqual(_status, 200)
132134
messages = [r.getMessage() for r in cm.records]
133135
self.assertTrue(
134136
any("decode Bubble" in m and "b-json" in m for m in messages),
@@ -156,9 +158,9 @@ def test_workspace_tabs_logs_composer_json_decode_failure(self) -> None:
156158
conn.commit()
157159
with self.assertLogs("services.workspace_tabs", level="WARNING") as cm:
158160
with app.test_request_context("/api/workspaces/global/tabs"):
159-
payload, status = assemble_workspace_tabs("global", ws_root, rules=[])
161+
_payload, _status = assemble_workspace_tabs("global", ws_root, rules=[])
160162

161-
self.assertEqual(status, 200)
163+
self.assertEqual(_status, 200)
162164
messages = [r.getMessage() for r in cm.records]
163165
self.assertTrue(
164166
any("decode Composer" in m and "cmp-json" in m for m in messages),

0 commit comments

Comments
 (0)