Problem
The cppa-cursor-browser codebase has no type annotations on any function signatures. All structured data flows through untyped dicts with .get() chains and no TypedDict, dataclass, or mypy configuration. The baseline eval explicitly calls this out: "For a tool whose primary value is export fidelity — preserving the structure of AI conversations — the absence of a typed data model increases the risk of silent data corruption during format changes." The "bubble" concept has three different dict shapes across code paths with no type enforcement to catch shape mismatches at development time.
Acceptance Criteria
Implementation Notes
This is a large typing effort — prioritize the data model layer first, then route handlers. Create a models.py (or types.py) at the project root or under utils/ that defines TypedDict classes for the core shapes: BubbleDict (with metadata, tool, thinking fields), WorkspaceEntry, ConversationSummary, SearchHit. Replace dict annotations with these throughout api/workspaces.py, api/composers.py, api/search.py, and utils/. For functions that currently return implicit None (missing return statements on error paths), add explicit -> Optional[X] annotations and handle the None case. Add mypy to the CI workflow (.github/workflows/tests.yml if it exists). The three bubble shapes identified in the eval (workspace tabs shape, export shape, CLI reader shape) should converge on a single TypedDict or use a union type with discriminator.
References
- Eval finding: Test 6, cluster "type-safety"
- Related files:
api/workspaces.py, api/composers.py, api/search.py, api/export_api.py, utils/cli_chat_reader.py, app.py, requirements.txt
Problem
The cppa-cursor-browser codebase has no type annotations on any function signatures. All structured data flows through untyped dicts with
.get()chains and noTypedDict,dataclass, ormypyconfiguration. The baseline eval explicitly calls this out: "For a tool whose primary value is export fidelity — preserving the structure of AI conversations — the absence of a typed data model increases the risk of silent data corruption during format changes." The "bubble" concept has three different dict shapes across code paths with no type enforcement to catch shape mismatches at development time.Acceptance Criteria
mypyis added to project dependencies with a[tool.mypy]config section--strictmode is enabled (orstrict = truein config)TypedDictordataclass(at minimum: Bubble, Workspace, Conversation, SearchResult)utils/module functions have complete type annotationsmypypasses with zero errors on the annotated modules (use per-module overrides forscripts/export.pyif needed)Implementation Notes
This is a large typing effort — prioritize the data model layer first, then route handlers. Create a
models.py(ortypes.py) at the project root or underutils/that definesTypedDictclasses for the core shapes:BubbleDict(withmetadata,tool,thinkingfields),WorkspaceEntry,ConversationSummary,SearchHit. Replacedictannotations with these throughoutapi/workspaces.py,api/composers.py,api/search.py, andutils/. For functions that currently return implicitNone(missing return statements on error paths), add explicit-> Optional[X]annotations and handle theNonecase. Addmypyto the CI workflow (.github/workflows/tests.ymlif it exists). The three bubble shapes identified in the eval (workspace tabs shape, export shape, CLI reader shape) should converge on a singleTypedDictor use a union type with discriminator.References
api/workspaces.py,api/composers.py,api/search.py,api/export_api.py,utils/cli_chat_reader.py,app.py,requirements.txt