Skip to content

Refactor PostableObject into dedicated module and add fallback support#191

Merged
haydenbleasel merged 2 commits intochat/plansfrom
v0/vishalyathish-resolve-malte-comments-8680
Mar 6, 2026
Merged

Refactor PostableObject into dedicated module and add fallback support#191
haydenbleasel merged 2 commits intochat/plansfrom
v0/vishalyathish-resolve-malte-comments-8680

Conversation

@visyat
Copy link
Collaborator

@visyat visyat commented Mar 6, 2026

Addresses @cramforce's code review comments from PR #115.

What changed

  • Created postable-object.ts as a dedicated module for the PostableObject interface and isPostableObject type guard
  • Moved plan-related types (PlanModel, PlanTask, etc.) from types.ts to plan.ts to keep them co-located with the Plan implementation
  • Made PostableObject generic (PostableObject<TData>) for better type safety
  • Added getFallbackText() method to PostableObject interface for adapters that don't support the object type
  • Updated handlePostableObject in both thread.ts and channel.ts to post fallback text when adapter doesn't support the object
  • Changed postObject and editObject in Slack adapter to log warnings and return fallback instead of throwing for unsupported kinds

How to test

  1. All existing tests pass (644 chat tests, 238 adapter-slack tests)
  2. Try posting a Plan object to a thread - it should work normally with native Slack blocks
  3. In an adapter that doesn't support Plans, the fallback text (emoji-based task list) should be posted instead

Slack Thread

Move PostableObject to dedicated file, update type exports, add fallback posts, and make PostableObject generic.

Slack-Thread: https://vercel.slack.com/archives/C0977L169MW/p1772755978706959?thread_ts=1772755978.706959&cid=C0977L169MW
Co-authored-by: Vishal Yathish <135551666+visyat@users.noreply.github.com>
@vercel
Copy link
Contributor

vercel bot commented Mar 6, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
chat Ready Ready Preview, Comment, Open in v0 Mar 6, 2026 10:47pm
chat-sdk-nextjs-chat Ready Ready Preview, Comment, Open in v0 Mar 6, 2026 10:47pm

- Plan mutations (addTask, updateTask, complete) now work in fallback
  mode by using editMessage with fallback text instead of no-oping
- Revert Slack adapter to throw on unsupported kinds (caller handles
  fallback, so adapter-level fallback strings are unnecessary)
- Remove redundant re-exports of isPostableObject/PostableObject from
  plan.ts — export from canonical postable-object.ts only
- Stop exporting POSTABLE_OBJECT symbol (internal implementation detail)
- Fix nested ternary lint error in getFallbackText
- Add tests for fallback post/edit path

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@haydenbleasel haydenbleasel merged commit 1cb01d4 into chat/plans Mar 6, 2026
2 of 4 checks passed
@haydenbleasel haydenbleasel deleted the v0/vishalyathish-resolve-malte-comments-8680 branch March 6, 2026 22:46
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.

2 participants