Skip to content

release: promote test to main#1727

Merged
sweetmantech merged 1 commit intomainfrom
test
May 1, 2026
Merged

release: promote test to main#1727
sweetmantech merged 1 commit intomainfrom
test

Conversation

@sweetmantech
Copy link
Copy Markdown
Collaborator

@sweetmantech sweetmantech commented May 1, 2026

Promote test to main. Includes:

🤖 Generated with Claude Code


Summary by cubic

Migrates the YouTube integration to Composio connectors and removes the legacy OAuth/supabase flow, simplifying connect/disconnect and unifying channel data fetching. The revenue tool remains custom on the API side.

  • Refactors

    • Added youtube to allowed artist connectors, display names, and connector metadata.
    • Replaced legacy OAuth routes and Supabase token storage with the connector authorize/disconnect flow; removed old /api/youtube/*, callback route, token libs, and unused UI.
    • Introduced executeConnectorActionApi and fetchYoutubeChannel; useYoutubeChannel now calls YOUTUBE_GET_CHANNEL_STATISTICS and reads items[].snippet/statistics.
    • Switched useConnectors to React Query with a shared cache; useYoutubeStatus derives state from connectors; updated ChannelInfo to the new response shape.
    • Updated ConnectYouTubeButton and YoutubeLogoutButton to use useConnectorHandlers and added onDisconnectSuccess support.
  • Bug Fixes

    • Requested part: "snippet,statistics" so channel title and thumbnail render correctly.
    • Shared connector refresh across hook instances and invalidated the channel query on disconnect.
    • Gated channel fetching on Privy authentication and surfaced connector errors.
    • Added aria-labels for icon-only connect/disconnect buttons.
    • Fixed "YouTube" display name and added a connector description; added a fallback error message in YouTubeRevenueResult.

Written for commit 8688505. Summary will update on new commits.

* chore(chat): migrate YouTube connector to Composio

- Add youtube to allowedArtistConnectors so the YouTube card appears in
  the artist settings Connectors tab alongside TikTok/Instagram
- Rewrite useYoutubeChannel to call POST /api/connectors/actions with
  YOUTUBE_GET_CHANNEL_STATISTICS; consume the raw Google channels.list
  response (snippet/statistics/thumbnails) directly, no remapping
- Rewrite useYoutubeStatus to derive connection state from the Composio
  connectors list instead of the legacy channel-info endpoint
- Rewrite ConnectYouTubeButton + YoutubeLogoutButton to use the Composio
  authorize/disconnect flow already used by TikTok/Instagram
- Drop legacy chat-side OAuth surface: /api/youtube/*,
  /api/auth/callback/google, lib/youtube OAuth/token helpers,
  lib/supabase/youtube_tokens, types/youtube.ts, useYouTubeLoginSuccess,
  the four LLM-tool result components for login/channels/playlist/thumb
  (those tools now come from Composio's YouTube toolkit)

Keeps the get_youtube_revenue MCP tool dispatch in ToolComponents and the
matching VercelChat result components — Composio has no YouTube
Analytics action, so revenue stays custom on the api side.

* fix(chat): request snippet+statistics from YOUTUBE_GET_CHANNEL_STATISTICS

Composio's action defaults the `part` parameter to "statistics" only,
so the response had `snippet: null` and the UI rendered without title
or thumbnail. Pass `part: "snippet,statistics"` so the channel name,
description, and thumbnail come back too.

* chore(chat): remove unused ChatInputYoutubeButton + popover

Both components were orphaned — ChatInputYoutubeButton had zero callers,
which made ChatInputYoutubeButtonPopover and its StatCard / PopoverContent
unreachable too. Drop them entirely.

* fix(chat): unwrap Composio envelope in executeConnectorActionApi

api now passes Composio's ToolExecuteResponse through unchanged
({successful, data, error}). Consumer adapter unwraps once so all
chat-side callers get the underlying provider payload directly
(e.g. youtube.channels.list with `items`); upstream failures throw.

* fix(chat): address AI review feedback on youtube migration

- Share connector refresh across useConnectors instances so logout updates
  sibling status (P1: useYoutubeStatus stale after disconnect)
- Disable disconnect button while in-flight to prevent duplicate requests
- Add aria-label to icon-only disconnect button
- Add aria-label to ConnectYouTubeButton for dense (icon-only) mode
- Propagate connector errors from useYoutubeStatus instead of hard-coded null
- Use semantic <span> for static section caption in ChannelInfo
- Provide fallback message in YouTubeRevenueResult when error text missing

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* refactor(chat): simplify executeConnectorActionApi envelope handling

The api endpoint always returns Composio's ToolExecuteResponse envelope
(`{ successful, data, error }`) — every Composio Vercel-AI-SDK tool returns
that shape. Drop the defensive non-envelope branch and read the typed shape
directly, removing the `as unknown` casts and inline type guards.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* refactor(chat): React Query for useConnectors + extract fetchYoutubeChannel

- useConnectors now uses React Query so all instances share one cache;
  disconnect/authorize invalidate the connectors key and sibling instances
  re-render automatically. Drops the module-level Set<()=>void> broadcast.
- Extract fetchYoutubeChannel + types to lib/youtube/fetchYoutubeChannel.ts,
  matching the fetchConnectorsApi / authorizeConnectorApi pattern. The hook
  is now ~20 lines and just wires React Query to the helper.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* chore(chat): drop redundant queryFn return-type annotation

fetchConnectorsApi already returns Promise<ConnectorInfo[]>, so TS infers
the queryFn type correctly without the explicit annotation.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* fix(chat): restore authorize catch to honor Promise<string | null> contract

Dropped during the React Query refactor — without the catch, an API failure
rejects the promise instead of returning null, which the only caller
(ConnectYouTubeButton) doesn't handle.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* fix(chat): gate useYoutubeChannel on Privy authenticated flag

Matches the codebase convention (useTaskRunStatus, useCatalogs, useArtistPosts,
etc.) — without it, the query runs and immediately throws "Not authenticated"
when the user isn't signed in.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* refactor(chat): use shared useConnectorHandlers in YouTube buttons

Address sweetman's DRY review feedback on PR #1719: both ConnectYouTubeButton
and YoutubeLogoutButton open-coded the connect/disconnect state machine that
useConnectorHandlers (and ConnectorCard) already provide. Add an optional
onDisconnectSuccess callback to the hook so the logout button can still
invalidate the youtube-channel-info query after a successful disconnect.

* fix(chat): display "YouTube" as one word in connectors UI

Why: the formatConnectorName fallback regex inserts a space before
each capital, turning the API's "YouTube" into "You Tube". Add
youtube to the explicit display-name map alongside the other
multi-cap brands.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* fix(chat): add YouTube connector description

Without an explicit metadata entry, the YouTube card showed the
generic "Connect to enable this connector" placeholder. Match the
TikTok/Instagram pattern.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-authored-by: Sweets Sweetman <sweetmantech@gmail.com>
@vercel
Copy link
Copy Markdown
Contributor

vercel Bot commented May 1, 2026

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

Project Deployment Actions Updated (UTC)
chat Building Building Preview May 1, 2026 7:58pm

Request Review

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 1, 2026

Warning

Rate limit exceeded

@sweetmantech has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 48 minutes and 24 seconds before requesting another review.

To keep reviews running without waiting, you can enable usage-based add-on for your organization. This allows additional reviews beyond the hourly cap. Account admins can enable it under billing.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 4e0fc5ba-9c96-4a8a-b489-77b423043a41

📥 Commits

Reviewing files that changed from the base of the PR and between 5897f0d and 8688505.

⛔ Files ignored due to path filters (1)
  • types/youtube.ts is excluded by none and included by none
📒 Files selected for processing (54)
  • app/api/auth/callback/google/route.ts
  • app/api/youtube/channel-info/route.ts
  • app/api/youtube/logout/route.ts
  • components/ArtistSetting/StandaloneYoutubeComponent/ChannelInfo.tsx
  • components/ArtistSetting/StandaloneYoutubeComponent/YoutubeLogoutButton.tsx
  • components/VercelChat/ChatInputYoutubeButton.tsx
  • components/VercelChat/ToolComponents.tsx
  • components/VercelChat/YoutubeVideoStats.tsx
  • components/VercelChat/dialogs/YoutubeVideoDialog.tsx
  • components/VercelChat/tools/youtube/YouTubeAccessSkeleton.tsx
  • components/VercelChat/tools/youtube/YouTubeChannelDisplay.tsx
  • components/VercelChat/tools/youtube/YouTubeChannelVideosListSkeleton.tsx
  • components/VercelChat/tools/youtube/YouTubeChannelsResult.tsx
  • components/VercelChat/tools/youtube/YouTubeErrorDisplay.tsx
  • components/VercelChat/tools/youtube/YouTubeLoginResult.tsx
  • components/VercelChat/tools/youtube/YouTubeRevenueResult.tsx
  • components/VercelChat/tools/youtube/YouTubeSetThumbnailResult.tsx
  • components/VercelChat/tools/youtube/YouTubeSetThumbnailSkeleton.tsx
  • components/VercelChat/tools/youtube/YoutubeChannelVideosListResult.tsx
  • components/VercelChat/tools/youtube/YoutubeVideoCard.tsx
  • components/YouTube/ChatInputYoutubeButtonPopover/PopoverContent.tsx
  • components/YouTube/ChatInputYoutubeButtonPopover/StatCard.tsx
  • components/YouTube/ChatInputYoutubeButtonPopover/index.tsx
  • components/common/ConnectYouTubeButton.tsx
  • hooks/useArtistConnectorCallback.ts
  • hooks/useConnectorHandlers.ts
  • hooks/useConnectors.ts
  • hooks/useYouTubeLoginSuccess.ts
  • hooks/useYoutubeChannel.tsx
  • hooks/useYoutubeStatus.ts
  • lib/composio/allowedArtistConnectors.ts
  • lib/composio/api/executeConnectorActionApi.ts
  • lib/composio/connectorMetadata.ts
  • lib/composio/formatConnectorName.ts
  • lib/supabase/youtube_tokens/deleteYouTubeTokens.ts
  • lib/supabase/youtube_tokens/getYouTubeTokens.ts
  • lib/supabase/youtube_tokens/insertYouTubeTokens.ts
  • lib/youtube/authenticated-channel-monetization.ts
  • lib/youtube/channel-fetcher.ts
  • lib/youtube/channel-monetization-by-id.ts
  • lib/youtube/error-builder.ts
  • lib/youtube/fetchYouTubeChannel.ts
  • lib/youtube/fetchYoutubeChannel.ts
  • lib/youtube/formatDuration.ts
  • lib/youtube/getResizedImageBuffer.ts
  • lib/youtube/getYoutubePlaylistVideos.ts
  • lib/youtube/is-token-expired.ts
  • lib/youtube/oauth-client.ts
  • lib/youtube/queryAnalyticsReports.ts
  • lib/youtube/revenue-error-handler.ts
  • lib/youtube/token-refresher.ts
  • lib/youtube/token-validator.ts
  • lib/youtube/youtube-analytics-oauth-client.ts
  • lib/youtube/youtubeLogin.ts
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch test

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
Review rate limit: 0/1 reviews remaining, refill in 48 minutes and 24 seconds.

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

@sweetmantech sweetmantech merged commit ea08fab into main May 1, 2026
3 of 4 checks passed
Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

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

No issues found across 55 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Requires human review: This is a significant refactor (55 files) migrating the YouTube integration to a new connector system (Composio), involving core API and logic changes that require human review.

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 868850511e

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread hooks/useYoutubeStatus.ts
Comment on lines +27 to +31
status: error
? "error"
: connectors.find((c) => c.slug === "youtube")?.isConnected
? "valid"
: "invalid",
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Derive YouTube validity from channel fetch, not connector flag alone

This now marks YouTube as valid solely from isConnected, so a connector that is still listed but has expired/revoked credentials will be treated as healthy. In that state, StandaloneYoutubeComponent renders ChannelInfo, but useYoutubeChannel can fail and leave the badge empty with no reconnect path, which is a regression from the previous token/channel validation flow. Please gate valid on a successful channel stats fetch (or propagate channel-fetch errors back into this status) so broken auth does not present as connected.

Useful? React with 👍 / 👎.

);
const { connectors, isLoading, authorize, disconnect } =
useConnectors(config);
const youtube = connectors.find((c) => c.slug === "youtube");
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Normalize connector slug before YouTube lookup

The YouTube lookup is now case-sensitive (c.slug === "youtube"), but useConnectors already normalizes slugs with toLowerCase() when filtering, which implies upstream slug casing is not guaranteed. If the API returns YOUTUBE/mixed case, this lookup fails and the disconnect control never appears even though the connector is present. Compare with a normalized check (e.g. c.slug.toLowerCase()) to avoid false negatives.

Useful? React with 👍 / 👎.

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