Skip to content

Commit 7dab40c

Browse files
KhrulkovVclaude
andcommitted
fix: _card_type Pydantic crash + E2E pipeline tests (Bug #3, PR #161)
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 71f1289 commit 7dab40c

3 files changed

Lines changed: 753 additions & 4 deletions

File tree

gigaevo/memory/memory_write_example.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
)
4141
from gigaevo.memory.runtime_config import to_bool
4242
from gigaevo.memory.shared_memory.card_conversion import normalize_memory_card
43+
from gigaevo.memory.shared_memory.models import AnyCard, ProgramCard
4344

4445

4546
class CardMemory(Protocol):
@@ -95,11 +96,14 @@ def _top_percent_count(total: int, percent: float) -> int:
9596
return max(1, ceil(total * (percent / 100.0)))
9697

9798

98-
def _card_type(card: dict[str, Any]) -> str:
99-
if str(card.get("category") or "").strip().lower() == "program":
100-
return "programs"
101-
if str(card.get("program_id") or "").strip():
99+
def _card_type(card: dict[str, Any] | AnyCard) -> str:
100+
if isinstance(card, ProgramCard):
102101
return "programs"
102+
if isinstance(card, dict):
103+
if str(card.get("category") or "").strip().lower() == "program":
104+
return "programs"
105+
if str(card.get("program_id") or "").strip():
106+
return "programs"
103107
return "ideas"
104108

105109

0 commit comments

Comments
 (0)