Skip to content

Commit 82043a8

Browse files
committed
initial implementation of issue#69
1 parent 5b1e0ab commit 82043a8

5 files changed

Lines changed: 15 additions & 11 deletions

File tree

.github/workflows/tests.yml

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -135,11 +135,10 @@ jobs:
135135

136136
# ── Typecheck: mypy ───────────────────────────────────────────────────────
137137
# Codebase already has type hints across most of the surface (~70+ typed
138-
# functions). Mypy runs in lenient mode (--ignore-missing-imports for
139-
# untyped third-party deps; no strict-optional) so the gate isn't a wall
140-
# of false positives. The transitional `continue-on-error: true` was
141-
# removed in #29 once mypy reached zero errors on this repo — type
142-
# failures now block merges.
138+
# functions). Mypy runs with --ignore-missing-imports for untyped
139+
# third-party deps; strict-optional is enabled (mypy default). The
140+
# transitional `continue-on-error: true` was removed in #29 once mypy
141+
# reached zero errors on this repo — type failures now block merges.
143142
typecheck:
144143
name: Typecheck (mypy)
145144
runs-on: ubuntu-latest
@@ -162,7 +161,7 @@ jobs:
162161
- name: Run mypy
163162
# No `continue-on-error` — mypy now exits zero on this repo (closes #29),
164163
# so type errors must fail the job from here on.
165-
run: mypy --ignore-missing-imports --no-strict-optional --pretty .
164+
run: mypy --ignore-missing-imports --pretty .
166165

167166
# ── Secret scan: gitleaks ─────────────────────────────────────────────────
168167
# Catches accidentally committed credentials. Runs over full git history

pyproject.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,6 @@ include = [
8888
# and CI produce identical results.
8989
[tool.mypy]
9090
ignore_missing_imports = true
91-
no_strict_optional = true
9291
pretty = true
9392
# Exclude virtual-env and build artefact directories so that `mypy .` from the
9493
# repo root matches CI behaviour (CI runs in a clean runner without a local venv).

services/workspace_listing.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,9 +115,11 @@ def _safe_fetchall(query: str, params: tuple = ()) -> list:
115115

116116
headers = cd.get("fullConversationHeadersOnly") or []
117117
has_bubbles = any(
118-
bubble_map.get(h.get("bubbleId"))
118+
bubble_map.get(bubble_id)
119119
for h in headers
120120
if isinstance(h, dict)
121+
for bubble_id in [h.get("bubbleId")]
122+
if isinstance(bubble_id, str)
121123
)
122124
if not has_bubbles:
123125
continue

services/workspace_tabs.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,8 @@ def _safe_fetchall(query: str, params: tuple = ()) -> list:
260260
if not isinstance(header, dict):
261261
continue
262262
bubble_id = header.get("bubbleId")
263+
if not isinstance(bubble_id, str):
264+
continue
263265
bubble = bubble_map.get(bubble_id)
264266
if not bubble:
265267
continue
@@ -526,10 +528,11 @@ def _safe_fetchall(query: str, params: tuple = ()) -> list:
526528
if model_name_from_config and model_name_from_config != "default":
527529
if not tab_meta:
528530
tab_meta = {}
529-
if not tab_meta.get("modelsUsed"):
531+
models_used = tab_meta.get("modelsUsed")
532+
if not isinstance(models_used, list):
530533
tab_meta["modelsUsed"] = [model_name_from_config]
531-
elif model_name_from_config not in tab_meta["modelsUsed"]:
532-
tab_meta["modelsUsed"].insert(0, model_name_from_config)
534+
elif model_name_from_config not in models_used:
535+
models_used.insert(0, model_name_from_config)
533536

534537
tab = {
535538
"id": composer_id,

tests/test_workspace_tabs_malformed_nested.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@ def test_diffs_appear_in_code_block_diffs_field(self) -> None:
131131

132132
tab = next((t for t in payload["tabs"] if t["id"] == "cmp-d"), None)
133133
self.assertIsNotNone(tab)
134+
assert tab is not None
134135
self.assertTrue(tab["codeBlockDiffs"], "expected diffs on tab.codeBlockDiffs")
135136

136137
def test_diffs_do_not_appear_as_synthetic_bubbles(self) -> None:

0 commit comments

Comments
 (0)