Skip to content

fix(core): root re-export deprecated chat/ai type aliases#147

Merged
patrick-chinchill merged 1 commit into
mainfrom
fix/core-ai-type-reexports
Jun 18, 2026
Merged

fix(core): root re-export deprecated chat/ai type aliases#147
patrick-chinchill merged 1 commit into
mainfrom
fix/core-ai-type-reexports

Conversation

@patrick-chinchill

@patrick-chinchill patrick-chinchill commented Jun 18, 2026

Copy link
Copy Markdown
Collaborator

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-27 re-exports toAiMessages plus eight deprecated AI type aliases from the package root for backwards compatibility, each marked @deprecated and pointing at the canonical chat/ai subpath:

  • AiAssistantMessage
  • AiFilePart
  • AiImagePart
  • AiMessage
  • AiMessagePart
  • AiTextPart
  • AiUserMessage
  • ToAiMessagesOptions

Ours (src/chat_sdk/__init__.py) re-exported only to_ai_messages, so hasattr(chat_sdk, "AiMessage") == False. This adds the eight deprecated root re-exports from chat_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 from chat_sdk.ai (alongside the existing to_ai_messages) and list them in __all__. The root re-export is the same object as the chat_sdk.ai canonical type, so identity/isinstance checks agree. 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.
  • tests/test_root_reexports.py — new test asserting each alias resolves at the root, is identical to its chat_sdk.ai home, and appears in chat_sdk.__all__; plus that to_ai_messages stays re-exported.

Verification

Gauntlet green from the worktree:

  • ruff check — all checks passed
  • ruff format --check — 258 files already formatted
  • audit_test_quality.py — 0 hard failures
  • pyrefly check — 0 errors
  • pytest tests/ — 4777 passed, 3 skipped

The three alias-resolution tests fail on the pre-fix code (aliases absent from root + __all__) and pass after.

Summary by CodeRabbit

  • Improvements
    • AI message types (AiMessage, AiUserMessage, AiAssistantMessage) and message components (AiTextPart, AiImagePart, AiFilePart) are now directly accessible from the package root for simpler imports.

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.
@coderabbitai

coderabbitai Bot commented Jun 18, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 66c0f32d-235c-4bb0-9555-8aeae2ef0f8f

📥 Commits

Reviewing files that changed from the base of the PR and between 17aa41a and b43e8d9.

📒 Files selected for processing (2)
  • src/chat_sdk/__init__.py
  • tests/test_root_reexports.py

📝 Walkthrough

Walkthrough

chat_sdk/__init__.py is updated to import and re-export eight AI type aliases (AiAssistantMessage, AiFilePart, AiImagePart, AiMessage, AiMessagePart, AiTextPart, AiUserMessage, ToAiMessagesOptions) from chat_sdk.ai alongside the existing to_ai_messages, and all are added to __all__. A new test module verifies each alias resolves at the root, is the canonical object from chat_sdk.ai, and is listed in __all__.

Changes

AI Type Alias Root Re-exports

Layer / File(s) Summary
Re-export imports and __all__ extension
src/chat_sdk/__init__.py
Broadens the import from chat_sdk.ai to include eight AI message part/type aliases and ToAiMessagesOptions, and adds all of them to __all__.
Root re-export contract tests
tests/test_root_reexports.py
Introduces _DEPRECATED_AI_TYPE_ALIASES and four test functions that assert attribute presence, object identity against chat_sdk.ai, __all__ membership, and continued availability of to_ai_messages.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Poem

🐇 Hop hop, the aliases bloom,
Re-exported to lighten the gloom!
AiMessage here, AiFilePart there,
All in __all__ beyond compare.
The root package greets them with cheer~ 🌸

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'fix(core): root re-export deprecated chat/ai type aliases' is specific and accurately summarizes the main change: adding type alias re-exports to the package root for backwards compatibility parity with upstream.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@patrick-chinchill patrick-chinchill marked this pull request as ready for review June 18, 2026 23:52
@patrick-chinchill patrick-chinchill merged commit 08b7a0f into main Jun 18, 2026
9 checks passed
patrick-chinchill added a commit that referenced this pull request Jun 19, 2026
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').
patrick-chinchill added a commit that referenced this pull request Jun 19, 2026
…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)
@patrick-chinchill patrick-chinchill deleted the fix/core-ai-type-reexports branch June 19, 2026 09:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant