Skip to content

armgit / macro

Public Imported from GitHub
0

Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.

fix(connections): stop labeling Macro Connect grants as Pipedream (#9524)

Eric Hayes83ad7cc20f08
diff --git a/apps/web/src/features/settings/connections/PipedreamAiProvider.test.tsx b/apps/web/src/features/settings/connections/PipedreamAiProvider.test.tsx
new file mode 100644
index 0000000000..578c200e09
--- /dev/null
+++ b/apps/web/src/features/settings/connections/PipedreamAiProvider.test.tsx
@@ -0,0 +1,82 @@
+import type { PipedreamProvider } from '@service-cognition/client';
+import { cleanup, render, screen } from '@solidjs/testing-library';
+import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
+import { toConnectionsModel } from './model';
+import { PipedreamAiProvider } from './PipedreamAiProvider';
+import {
+ ConnectionsViewProvider,
+ createConnectionsViewState,
+} from './view-state';
+
+const flag = vi.hoisted(() => ({ on: false }));
+
+vi.mock('@app/lib/analytics/posthog', () => ({
+ useFeatureFlag: (requested: { key: string }) => () => ({
+ enabled: requested.key === 'macro-connect' && flag.on,
+ loading: false,
+ }),
+}));
+vi.mock('@core/component/Toast/Toast', () => ({ toast: {} }));
+vi.mock('@core/pipedream/catalog', () => ({
+ createPipedreamCatalogConnect: () => ({
+ connect: vi.fn(),
+ busy: () => false,
+ }),
+}));
+vi.mock('@queries/auth', () => ({
+ useDeleteGithubLinkMutation: () => ({ isPending: false }),
+}));
+vi.mock('@queries/pipedream-connectors', () => ({
+ useDeletePipedreamConnectionMutation: () => ({ isPending: false }),
+ useUpdatePipedreamConnectionMutation: () => ({ isPending: false }),
+}));
+vi.mock('./native-actions', () => ({
+ useNativeMcpActions: () => ({
+ authorize: { isPending: false },
+ update: { isPending: false },
+ remove: { isPending: false },
+ }),
+}));
+vi.mock('./slack-channel-import/SlackChannelImportCard', () => ({
+ SlackChannelImportCard: () => null,
+}));
+
+function renderLinear(provider?: PipedreamProvider) {
+ const model = toConnectionsModel({
+ pipedream: provider
+ ? [{ app_slug: 'linear', server_name: 'Linear', enabled: true, provider }]
+ : [],
+ nativeMcp: [],
+ });
+ render(() => (
+ <ConnectionsViewProvider value={createConnectionsViewState({})}>
+ <PipedreamAiProvider model={model} provider="linear" />
+ </ConnectionsViewProvider>
+ ));
+}
+
+describe('PipedreamAiProvider label', () => {
+ beforeEach(() => {
+ flag.on = false;
+ });
+ afterEach(cleanup);
+
+ it('says Macro Connect on a Connect grant with the macro-connect flag on', () => {
+ flag.on = true;
+ renderLinear('connect');
+ expect(screen.getByText('Powered by Macro Connect')).toBeTruthy();
+ expect(screen.queryByText(/Pipedream/)).toBeNull();
+ });
+
+ it('says Macro Connect before connecting with the flag on', () => {
+ flag.on = true;
+ renderLinear();
+ expect(screen.getByText('Powered by Macro Connect')).toBeTruthy();
+ });
+
+ it('keeps the Pipedream label with the flag off', () => {
+ renderLinear('pipedream');
+ expect(screen.getByText('Powered by Pipedream')).toBeTruthy();
+ expect(screen.queryByText(/Macro Connect/)).toBeNull();
+ });
+});
diff --git a/apps/web/src/features/settings/connections/PipedreamAiProvider.tsx b/apps/web/src/features/settings/connections/PipedreamAiProvider.tsx
index 67ca156d50..9c156d1621 100644
--- a/apps/web/src/features/settings/connections/PipedreamAiProvider.tsx
+++ b/apps/web/src/features/settings/connections/PipedreamAiProvider.tsx
@@ -1,5 +1,7 @@
+import { useFeatureFlag } from '@app/lib/analytics/posthog';
import { linkGithubAccount } from '@core/auth/authorize-github';
import { toast } from '@core/component/Toast/Toast';
+import { macroConnect } from '@core/constant/featureFlags';
import { createPipedreamCatalogConnect } from '@core/pipedream/catalog';
import { connectSlugForPipedreamApp } from '@core/pipedream/slugs';
import { fireAndForget } from '@core/util/fireAndForget';
@@ -94,10 +96,8 @@ export function PipedreamAiProvider(props: {
);
const status = () => row()?.status ?? 'not-connected';
const indicator = () => statusIndicator(status());
- const aiFacts = () => {
- const cap = row();
- return cap ? capabilityFacts(cap) : 'Powered by Pipedream';
- };
+ const macroConnectFlag = useFeatureFlag(macroConnect);
+ const aiFacts = () => capabilityFacts(row(), macroConnectFlag().enabled);
const update = useUpdatePipedreamConnectionMutation();
const remove = useDeletePipedreamConnectionMutation();
const native = useNativeMcpActions();
diff --git a/apps/web/src/features/settings/connections/capability-row.test.ts b/apps/web/src/features/settings/connections/capability-row.test.ts
new file mode 100644
index 0000000000..6f5e2ff3ed
--- /dev/null
+++ b/apps/web/src/features/settings/connections/capability-row.test.ts
@@ -0,0 +1,42 @@
+import { describe, expect, it } from 'vitest';
+import { capabilityFacts } from './capability-row';
+
+const row = {
+ account: 'Connected account',
+ scope: 'personal',
+ mechanism: 'pipedream',
+} as const;
+
+describe('capabilityFacts', () => {
+ it('credits Macro Connect for a Connect grant when the flag is on', () => {
+ expect(capabilityFacts({ ...row, grantProvider: 'connect' }, true)).toBe(
+ 'Powered by Macro Connect'
+ );
+ });
+
+ it('keeps the Pipedream label on a real Pipedream grant when the flag is on', () => {
+ expect(capabilityFacts({ ...row, grantProvider: 'pipedream' }, true)).toBe(
+ 'Powered by Pipedream'
+ );
+ });
+
+ it.each(['connect', 'pipedream', undefined] as const)(
+ 'keeps the Pipedream label when the flag is off (grant: %s)',
+ (grantProvider) => {
+ expect(capabilityFacts({ ...row, grantProvider }, false)).toBe(
+ 'Powered by Pipedream'
+ );
+ }
+ );
+
+ it('names what would run an unconnected provider, by flag', () => {
+ expect(capabilityFacts(undefined, true)).toBe('Powered by Macro Connect');
+ expect(capabilityFacts(undefined, false)).toBe('Powered by Pipedream');
+ });
+
+ it('shows the account and scope for a native MCP server, whatever the flag', () => {
+ const native = { ...row, mechanism: 'native-mcp' } as const;
+ expect(capabilityFacts(native, true)).toBe('Connected account · Personal');
+ expect(capabilityFacts(native, false)).toBe('Connected account · Personal');
+ });
+});
diff --git a/apps/web/src/features/settings/connections/capability-row.ts b/apps/web/src/features/settings/connections/capability-row.ts
index c8c4875861..8d48c2be68 100644
--- a/apps/web/src/features/settings/connections/capability-row.ts
+++ b/apps/web/src/features/settings/connections/capability-row.ts
@@ -5,9 +5,20 @@ const SCOPE_LABEL: Record<CapabilityScope, string> = {
shared: 'Shared',
};
+/**
+ * With no row, names what would serve the provider once connected. Gated on
+ * the `macro-connect` flag: without it every connection is labeled Pipedream.
+ */
export function capabilityFacts(
- row: Pick<Capability, 'account' | 'scope' | 'mechanism'>
+ row:
+ | Pick<Capability, 'account' | 'scope' | 'mechanism' | 'grantProvider'>
+ | undefined,
+ macroConnectEnabled: boolean
): string {
- if (row.mechanism === 'pipedream') return 'Powered by Pipedream';
+ if (!row || row.mechanism === 'pipedream') {
+ const onConnect =
+ macroConnectEnabled && (!row || row.grantProvider === 'connect');
+ return onConnect ? 'Powered by Macro Connect' : 'Powered by Pipedream';
+ }
return [row.account, SCOPE_LABEL[row.scope]].filter(Boolean).join(' · ');
}
diff --git a/apps/web/src/features/settings/connections/model.test.ts b/apps/web/src/features/settings/connections/model.test.ts
index 438229956b..f9407c6c35 100644
--- a/apps/web/src/features/settings/connections/model.test.ts
+++ b/apps/web/src/features/settings/connections/model.test.ts
@@ -36,6 +36,17 @@ describe('Pipedream connections model', () => {
}
);
+ it('carries the backend holding the grant', () => {
+ const model = toConnectionsModel({
+ pipedream: [{ ...connection('linear'), provider: 'connect' }],
+ nativeMcp: [],
+ });
+ expect(capabilitiesFor(model, 'linear')[0]).toMatchObject({
+ mechanism: 'pipedream',
+ grantProvider: 'connect',
+ });
+ });
+
it('preserves disabled Slack connections', () => {
const model = toConnectionsModel({
pipedream: [connection('slack_v2', false)],
diff --git a/apps/web/src/features/settings/connections/model.ts b/apps/web/src/features/settings/connections/model.ts
index fa1a18394b..a2a19575b8 100644
--- a/apps/web/src/features/settings/connections/model.ts
+++ b/apps/web/src/features/settings/connections/model.ts
@@ -1,5 +1,8 @@
import { SLACK_PIPEDREAM_SLUGS } from '@core/pipedream/slugs';
-import type { PipedreamConnectionResponse } from '@service-cognition/client';
+import type {
+ PipedreamConnectionResponse,
+ PipedreamProvider,
+} from '@service-cognition/client';
import type { ServerResponse } from '@service-cognition/generated/schemas';
export type CapabilityStatus =
@@ -30,6 +33,8 @@ export type Capability = {
mechanism: CapabilityMechanism;
/** Stored Pipedream slug used to update or remove this connection. */
appSlug?: string;
+ /** Backend holding this connection's grant, for `mechanism: 'pipedream'`. */
+ grantProvider?: PipedreamProvider;
/** Native MCP URL, when this row is that server. */
sourceUrl?: string;
};
@@ -184,6 +189,7 @@ function curatedAiAndLeftovers(input: ConnectionsInput): {
status: aiStatus(pd.enabled),
mechanism: 'pipedream',
appSlug: pd.app_slug,
+ grantProvider: pd.provider,
});
if (native) {
usedNative.add(native.url);