Skip to content

Commit b400aa2

Browse files
etoyamaclaude
andcommitted
fix: resolve ty type check errors for CI
- Fix _load_claude_md_state return type to dict[str, Any] for nested JSON - Add None guard for entry.source in reviews.py - Import TypeAliasType from typing_extensions for Python 3.11 compat - Add type: ignore for CORSMiddleware (known starlette typing issue) - Remove stale type: ignore comments - Install ty in dev dependencies (was declared but not installed) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent ac1532f commit b400aa2

6 files changed

Lines changed: 19 additions & 8 deletions

File tree

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,4 +114,5 @@ sequence = ["lint", "typecheck", "test"]
114114
[dependency-groups]
115115
dev = [
116116
"httpx>=0.27",
117+
"ty>=0.0.17",
117118
]

src/insight_blueprint/core/reviews.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -375,7 +375,11 @@ def save_extracted_knowledge(
375375
comment_keys: dict[str, list[str]] = {}
376376
for entry in saved:
377377
# source format: "review:{comment_id}@{design_id}"
378-
if entry.source.startswith("review:") and "@" in entry.source:
378+
if (
379+
entry.source
380+
and entry.source.startswith("review:")
381+
and "@" in entry.source
382+
):
379383
comment_id = entry.source[len("review:") : entry.source.index("@")]
380384
comment_keys.setdefault(comment_id, []).append(entry.key)
381385

src/insight_blueprint/models/review.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
"""Pydantic data models for review comments (SPEC-3)."""
22

33
from datetime import datetime
4-
from typing import Self, TypeAliasType
4+
from typing import Self
55

66
from pydantic import BaseModel, Field, model_validator
7+
from typing_extensions import TypeAliasType
78

89
from insight_blueprint.models.common import now_jst
910
from insight_blueprint.models.design import DesignStatus

src/insight_blueprint/storage/project.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
from datetime import UTC, datetime
1212
from importlib.resources.abc import Traversable
1313
from pathlib import Path
14+
from typing import Any
1415

1516
from filelock import FileLock
1617
from packaging.version import InvalidVersion, Version
@@ -480,7 +481,7 @@ def _hash_content(content: str) -> str:
480481
return hashlib.sha256(content.replace("\r\n", "\n").encode("utf-8")).hexdigest()
481482

482483

483-
def _load_claude_md_state(project_path: Path) -> dict[str, str | None]:
484+
def _load_claude_md_state(project_path: Path) -> dict[str, Any]:
484485
"""Load state for CLAUDE.md and rules from .claude/.insight-blueprint-state.json."""
485486
state_file = project_path / ".claude" / _STATE_FILENAME
486487
if not state_file.exists():
@@ -492,7 +493,7 @@ def _load_claude_md_state(project_path: Path) -> dict[str, str | None]:
492493
return {}
493494

494495

495-
def _save_claude_md_state(project_path: Path, state: dict[str, str | None]) -> None:
496+
def _save_claude_md_state(project_path: Path, state: dict[str, Any]) -> None:
496497
"""Save state for CLAUDE.md and rules to .claude/.insight-blueprint-state.json."""
497498
state_file = project_path / ".claude" / _STATE_FILENAME
498499
state_file.parent.mkdir(parents=True, exist_ok=True)
@@ -593,7 +594,7 @@ def _copy_rules_template(project_path: Path) -> None:
593594
rules_dest.mkdir(parents=True, exist_ok=True)
594595

595596
state = _load_claude_md_state(project_path)
596-
rules_state: dict[str, dict[str, str | None]] = state.get("rules", {}) # type: ignore[assignment]
597+
rules_state: dict[str, dict[str, str | None]] = state.get("rules", {})
597598
changed = False
598599

599600
for rule_name in _discover_bundled_rules():
@@ -666,5 +667,5 @@ def _copy_rules_template(project_path: Path) -> None:
666667
)
667668

668669
if changed:
669-
state["rules"] = rules_state # type: ignore[assignment]
670+
state["rules"] = rules_state
670671
_save_claude_md_state(project_path, state)

src/insight_blueprint/web.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626

2727
# CORS: allow localhost origins only
2828
app.add_middleware(
29-
CORSMiddleware,
29+
CORSMiddleware, # type: ignore[arg-type]
3030
allow_origins=[
3131
"http://localhost:3000",
3232
"http://127.0.0.1:3000",

uv.lock

Lines changed: 5 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)