fix(core): root re-export deprecated chat/ai type aliases#147
Conversation
Upstream packages/chat/src/index.ts:8-27 re-exports toAiMessages plus eight deprecated AI type aliases (AiAssistantMessage, AiFilePart, AiImagePart, AiMessage, AiMessagePart, AiTextPart, AiUserMessage, ToAiMessagesOptions) from the package root for backwards compatibility, each marked @deprecated pointing at the chat/ai subpath. Ours re-exported only to_ai_messages, so chat_sdk.AiMessage et al. did not resolve. Add the eight deprecated root re-exports from chat_sdk.ai (the canonical home) to match upstream's deprecated-alias surface, and pin the behavior with a root re-export test. No new optional-dep cost: chat_sdk.ai is already imported at the root for to_ai_messages, and the aliased types are plain TypedDict/dataclass/Union with no ai/zod peer-dep imports.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthrough
ChangesAI Type Alias Root Re-exports
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Code Review
This pull request re-exports several deprecated AI type aliases from 'chat_sdk.ai' at the root package level in 'src/chat_sdk/init.py' to maintain backwards compatibility and mirror the upstream TypeScript SDK. It also adds a new test suite in 'tests/test_root_reexports.py' to verify that these aliases resolve correctly, match their canonical objects, and are included in 'all'. There are no review comments, so I have no feedback to provide.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
CHANGELOG: add 'Pre-existing parity gaps closed (4.30 audit)' subsection covering the 7 ported fixes (PRs #147-#150) and a documented-exceptions note (Linear agent-sessions #151 deferred to 4.31 / #152; adapter-web and the GitHub/Linear native-client + message.subject halves stay Known Non-Parity). UPSTREAM_SYNC: - file-mapping table: add state-ioredis -> redis.py (IoRedisStateAdapter) and state-pg -> postgres.py rows (both ported + tested, were missing). - Known Non-Parity (platform gaps): add Linear agent-sessions row (#151) and an adapter-web row that splits the portable server-side WebAdapter (deferred) from the genuinely browser-only client subpaths, correcting the earlier over-broad 'browser-only; no Python runtime' note. - Correct the Google Chat file-uploads row: inbound attachment parsing is fully implemented (_create_attachment), so the gap is outbound file delivery only (post_message still logs 'not yet supported').
…PR 4/4) (#146) * chore(release): cut 0.4.30 — Teams SDK migration + 4.30.0 parity (#93 PR 4/4) Final PR of the Teams SDK migration (issue #93). PRs 1-3 (inbound+auth, outbound, native streaming) are merged; this cuts the 0.4.30 release. - Version bump: pyproject 0.4.29 -> 0.4.30; UPSTREAM_PARITY "4.29.0" -> "4.30.0". - Fidelity re-pin chat@4.29.0 -> chat@4.30.0 in lint.yml + verify_test_fidelity.py (docstring, default parity fallback, clone hint). packages/chat/src is byte-for-byte identical between the two tags, so zero new test ports: strict fidelity stays 100% (732/732, 0 missing) against chat@4.30.0. Baseline regenerated (ts_parity -> chat@4.30.0; the recorded total_ts_tests literal 731 -> 732 corrects a stale count from the merged adapter waves, not the re-pin — the count is identical against both tags). - Docs: project-instructions version map + fidelity pin; README status line; CHANGELOG 0.4.30 entry (Twilio adapter, Telegram streaming, Slack subpaths, WhatsApp/Slack/gchat fixes, Teams #93 PRs 1-4); UPSTREAM_SYNC.md parity header + the Teams deferral row flipped to delivered. - Version-label normalization: malformed `adapter-teams@chat@4.30.0` and loose `adapter-teams@4.30.0` -> `@chat-adapter/teams@4.30.0` in adapter.py (5), bridge.py (1), UPSTREAM_SYNC.md (4). Comment/doc-only. Does NOT tag/publish — the release is a separate maintainer-gated step (live Teams 429 streaming check + PyPI authorization). * docs(release): clarify 0.4.30 core-parity wording + finish label normalization Review fast-follow for PR 4. The CHANGELOG now states the mapped core is content-identical *between the chat@4.29.0 and chat@4.30.0 upstream tags* (verified: thread.ts/types.ts/thread.test.ts and the full packages/chat/src tree are byte-identical) — the prior 'unchanged from 4.29.0' phrasing was accurate but misread as a claim about our code. Also sweeps the two remaining old-style `adapter-teams@chat@4.30.0` labels in the Teams test docstrings to the canonical `@chat-adapter/teams@4.30.0` npm tag, completing the normalization the PR's scope called for. No logic change. * docs(release): document 0.4.30 parity-audit wave + remaining exceptions CHANGELOG: add 'Pre-existing parity gaps closed (4.30 audit)' subsection covering the 7 ported fixes (PRs #147-#150) and a documented-exceptions note (Linear agent-sessions #151 deferred to 4.31 / #152; adapter-web and the GitHub/Linear native-client + message.subject halves stay Known Non-Parity). UPSTREAM_SYNC: - file-mapping table: add state-ioredis -> redis.py (IoRedisStateAdapter) and state-pg -> postgres.py rows (both ported + tested, were missing). - Known Non-Parity (platform gaps): add Linear agent-sessions row (#151) and an adapter-web row that splits the portable server-side WebAdapter (deferred) from the genuinely browser-only client subpaths, correcting the earlier over-broad 'browser-only; no Python runtime' note. - Correct the Google Chat file-uploads row: inbound attachment parsing is fully implemented (_create_attachment), so the gap is outbound file delivery only (post_message still logs 'not yet supported'). * docs(release): correct phantom-feature framing before PyPI cut CHANGELOG: - Drop false gchat file-delivery bullet (PR #112 never merged; upstream itself does not implement gchat outbound file delivery) - Fix Slack DM block-action citation to merged PR #137 (supersedes #133) - Re-point 0.4.27.1 vehicle from unmerged #120 to tag v0.4.27.1 + #117 - Drop numberless Twilio 'scaffolding PR' (only #142 exists) UPSTREAM_SYNC: - Reframe Google Chat outbound file delivery as parity (upstream also logs 'not yet supported' + media.upload TODO, index.ts:1282-1289) - Correct Teams cert-auth row: TS is not 'Supported' — config throws at startup in both SDKs (types.ts:31, config.ts:13); parity, issue #58 - Add Messenger get_user row: upstream has no getUser; raising stub is parity, Graph-API impl tracked as #132 * docs(changelog): clarify 0.4.30 audit-gap count (8 closed + 1 deferred = 9)
Summary
Pre-existing parity gap from the 0.4.30 pre-ship upstream-parity audit (core-reexports group; not a regression).
Upstream
packages/chat/src/index.ts:8-27re-exportstoAiMessagesplus eight deprecated AI type aliases from the package root for backwards compatibility, each marked@deprecatedand pointing at the canonicalchat/aisubpath:AiAssistantMessageAiFilePartAiImagePartAiMessageAiMessagePartAiTextPartAiUserMessageToAiMessagesOptionsOurs (
src/chat_sdk/__init__.py) re-exported onlyto_ai_messages, sohasattr(chat_sdk, "AiMessage") == False. This adds the eight deprecated root re-exports fromchat_sdk.ai(which stays the canonical home), matching upstream's deprecated-alias surface.Changes
src/chat_sdk/__init__.py— import the eight AI type aliases fromchat_sdk.ai(alongside the existingto_ai_messages) and list them in__all__. The root re-export is the same object as thechat_sdk.aicanonical type, so identity/isinstancechecks agree. No new optional-dep cost:chat_sdk.aiis already imported at the root forto_ai_messages, and the aliased types are plainTypedDict/dataclass/Unionwith noai/zodpeer-dep imports.tests/test_root_reexports.py— new test asserting each alias resolves at the root, is identical to itschat_sdk.aihome, and appears inchat_sdk.__all__; plus thatto_ai_messagesstays re-exported.Verification
Gauntlet green from the worktree:
ruff check— all checks passedruff format --check— 258 files already formattedaudit_test_quality.py— 0 hard failurespyrefly check— 0 errorspytest tests/— 4777 passed, 3 skippedThe three alias-resolution tests fail on the pre-fix code (aliases absent from root +
__all__) and pass after.Summary by CodeRabbit
AiMessage,AiUserMessage,AiAssistantMessage) and message components (AiTextPart,AiImagePart,AiFilePart) are now directly accessible from the package root for simpler imports.