From b124ad06748e53cdf5a69cc9dcca1cc403275ddb Mon Sep 17 00:00:00 2001 From: Dotta <34892728+cryppadotta@users.noreply.github.com> Date: Tue, 17 Nov 2026 07:24:33 -0600 Subject: [PATCH] feat(connections): show a data-use disclosure in the Google Workspace picker (#21998) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Thinking Path > - Paperclip is the open source app people use to manage AI agents for work > - The built-in Google Workspace connection lets agents use Gmail, Drive (with Docs, Sheets and Slides) and Calendar > - Google reviews this connection for restricted scopes. Google requires a disclosure in the product, shown just before the consent request, that says what data the app accesses and how it uses and shares that data. A link to the privacy policy alone is not sufficient > - Before this change, the service picker showed only three service rows and Cancel / Continue. Its only description was text for screen readers > - This pull request adds a visible data-use disclosure to the picker. The disclosure changes with the selected services and access levels > - The benefit is that every user sees what agents can do and where the data goes before Google asks for consent, and the connection meets this review requirement ## Linked Issues or Issue Description Refs #21996 (the code-fix plan, section 1, describes this change). **Is your feature request related to a problem?** Google's restricted-scope review requires an in-product data-use disclosure immediately before the consent request. The Google Workspace service picker has no visible disclosure. It does not say what agents can do with each service, that content goes to the configured AI model provider, how long results stay, or where the privacy policy is. **Describe the solution you'd like** Show a short disclosure between the service rows and the footer. Build it from the current selection. Describe only the selected services, at the selected access level. Explain use, sharing and retention. Link the privacy policy and mention Google's Limited Use requirements. **Describe alternatives you've considered** A privacy-policy link only. Google does not accept this as a disclosure. A separate confirmation step after the picker. This adds a click to every setup and reconnect, and the picker is already the last Paperclip screen before Google consent. ## What Changed - `ui/src/features/connections/googleWorkspaceDisclosure.ts` (new): a pure function `googleWorkspaceDataUseDisclosure(selection)` returns the plain sentences for the selected services and the use/sharing sentences. It also exports the privacy policy URL (`https://paperclip.ing/privacy`). - `ui/src/features/connections/GoogleWorkspaceServices.tsx`: `ServicePicker` shows the disclosure above the footer when one or more services are on. With no services on, it keeps the existing "Select at least one service to continue." message and shows no disclosure. The privacy link opens in a new tab. The dialog now scrolls inside 85% of the viewport height, so the footer stays reachable on a phone. This one picker serves new setup and reconnect, in the Apps flow and in task-hosted setup. - `ui/src/features/connections/GoogleWorkspaceServices.test.tsx`: tests for each service at each access level, picker order, Gmail send wording (read only never mentions sending; read & write only says that Paperclip does not send), the empty selection, the rendered block, the link, and the block's position before the footer. - `ui/src/pages/apps/AppDetail.tsx` and `ui/src/pages/apps/app-detail/AdvancedPanel.tsx`: the app detail page's Reconnect card, "Connect as me", "Connect organization identity" and the dedicated-agent connect started Google sign-in directly. For a Google Workspace connection they now open the same picker first. The picker is filled from the saved request. The chosen services go to the sign-in request (`workspaceServices`, or `scopes` for personal authorization). Other apps start sign-in as before. The gate is `useGoogleWorkspaceServiceGate` in `GoogleWorkspaceServices.tsx`. - `ui/src/pages/apps/AppDetail.test.tsx`: tests for each app-detail path, including Cancel (no sign-in starts). - `ui/storybook/stories/connection-setup/google-workspace-services.stories.tsx`: new `ProductionPickerReadOnly` story (with a play test) and `ProductionPickerMobile` story. Notes on the design (kept here because the change adds no code comments): - Every Google Workspace sign-in must pass through the service picker, so the disclosure always comes just before Google's consent screen. `useGoogleWorkspaceServiceGate` opens the picker for a Google Workspace connection and starts other connections at once. - Gmail read & write only creates drafts. Google's consent screen describes the compose permission as also sending email, so the Gmail line says this and states that Paperclip does not send email. Tests enforce this wording. ### Disclosure copy for sign-off Section heading 1: **What agents can do**. One line for each selected service. Unselected services are not mentioned. | Service | Read only | Read & write | | --- | --- | --- | | Gmail | "Gmail: agents can read and search your email." | "Gmail: agents can read and search your email, and create drafts. Google's permission screen also mentions sending email; Paperclip does not send email." | | Drive | "Drive: agents can read and search your files, Docs, Sheets and Slides." | "Drive: agents can read and search your files, Docs, Sheets and Slides. They can also create files and edit Docs, Sheets and Slides." | | Calendar | "Calendar: agents can see your calendars, events and free/busy times." | "Calendar: agents can see your calendars, events and free/busy times. They can also create, change and delete events, and respond to invitations." | Section heading 2: **How your data is used**. Always shown when one or more services are selected: - "Agents read this content only to do the tasks you give them." - "To do that, the content is sent to the AI model provider configured for your workspace." - "It is not used to train general AI models." - "Results are saved in the task and its run history. They stay there until you delete them, even after you disconnect." Link (opens `https://paperclip.ing/privacy` in a new tab): "Read our privacy policy, including how we meet Google's Limited Use requirements" No services selected: "Select at least one service to continue." (unchanged). No disclosure is shown. ### Screenshots (Storybook, production picker; taken before the Gmail wording change) Desktop, dark: ![Picker with disclosure, desktop dark](https://raw.githubusercontent.com/cryppadotta/paperclip-upstream-fork/pr-assets/google-workspace-data-use-disclosure/pr-assets/google-workspace-disclosure/picker-desktop-dark.png) Desktop, light: ![Picker with disclosure, desktop light](https://raw.githubusercontent.com/cryppadotta/paperclip-upstream-fork/pr-assets/google-workspace-data-use-disclosure/pr-assets/google-workspace-disclosure/picker-desktop-light.png) Phone (375 px), top and scrolled to the footer: Picker on a phone, top Picker on a phone, scrolled to the footer ## Verification - Red first: with a stub helper, 9 new tests failed. The 5 app-detail tests failed before the reconnect fix (sign-in started without the picker). The changed Gmail wording tests failed before the copy change. After the changes: `cd ui && npx vitest run src/features/connections/GoogleWorkspaceServices.test.tsx src/pages/apps/AppDetail.test.tsx src/pages/apps/AppsConnect.test.tsx src/pages/apps/app-detail` passes, 395 tests. - `node scripts/check-token-gates.mjs`: all gates clean. - `cd ui && node ../scripts/run-tsc.mjs -b` passes. - `node scripts/storybook-catalog.mjs` passes. - Headless Playwright against Storybook dev: the `ProductionPicker` story at 1280x900 (dark and light) and the `ProductionPickerMobile` story at 375x812. No horizontal scroll at 375 px. The footer is reachable after scrolling the dialog. The `ProductionPickerReadOnly` play test ran to its end state. - `pnpm verify` exits 2 (a Storybook story is a broad input). Required CI supplies the broad coverage. - Manual: open Apps, start a Google Workspace connection. Turn services on and off and change the access levels. Make sure that the disclosure changes and that unselected services are not mentioned. ## Risks - Low code risk. The change is UI-only. It does not change the selection, scopes, OAuth or saved state. - Wording risk: the copy makes product statements (no training on content, results stay after disconnect). The owner must approve the wording. The published privacy policy must agree with it: today the policy does not yet name AI model providers and describes retention only while a connection is active. Update the policy before or together with this change. - The dialog is taller. On short screens it scrolls inside the dialog. > For core feature work, check [`ROADMAP.md`](ROADMAP.md) first and discuss it in `#dev` before opening the PR. Feature PRs that overlap with planned core work may need to be redirected — check the roadmap first. See `CONTRIBUTING.md`. ## Model Used - Claude Opus 5.5 (`claude-opus-5-5`), Anthropic, in Claude Code with tool use (shell, file edits, headless browser). ## Checklist - [x] I have included a thinking path that traces from project context to this change - [x] I have specified the model used (with version and capability details) - [x] I have checked ROADMAP.md and confirmed this PR does not duplicate planned core work - [x] I have searched GitHub for duplicate or related PRs and linked them above - [x] I have either (a) linked existing issues with `Fixes: #` / `Closes #` / `Refs #` OR (b) described the issue in-PR following the relevant issue template - [x] I have not referenced internal/instance-local Paperclip issues or links (only public GitHub `#NNN` / `github.com/paperclipai/paperclip` URLs) - [x] My branch name describes the change (e.g. `docs/...`, `fix/...`) and contains no internal Paperclip ticket id or instance-derived details - [x] I have run tests locally and they pass - [x] I have added or updated tests where applicable - [x] I have updated relevant documentation to reflect my changes - [x] I have considered and documented any risks above - [ ] All Paperclip CI gates are green - [ ] Greptile is 5/5 with no open P2s, recommendations, or follow-ups - [x] I will address all Greptile and reviewer comments before requesting merge 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 5.5 --- .../GoogleWorkspaceServices.test.tsx | 92 ++++++++++++++++++ .../connections/GoogleWorkspaceServices.tsx | 48 +++++++++- .../connections/googleWorkspaceDisclosure.ts | 35 +++++++ ui/src/pages/apps/AppDetail.test.tsx | 94 ++++++++++++++++++- ui/src/pages/apps/AppDetail.tsx | 16 ++-- .../pages/apps/app-detail/AdvancedPanel.tsx | 15 ++- .../google-workspace-services.stories.tsx | 20 ++++ 7 files changed, 306 insertions(+), 14 deletions(-) create mode 100644 ui/src/features/connections/googleWorkspaceDisclosure.ts diff --git a/ui/src/features/connections/GoogleWorkspaceServices.test.tsx b/ui/src/features/connections/GoogleWorkspaceServices.test.tsx index 79023e59337..3ff82f854ae 100644 --- a/ui/src/features/connections/GoogleWorkspaceServices.test.tsx +++ b/ui/src/features/connections/GoogleWorkspaceServices.test.tsx @@ -5,6 +5,7 @@ import { QueryClient, QueryClientProvider } from "@tanstack/react-query"; import { googleWorkspaceSelectedScopes, type ToolConnection } from "@paperclipai/shared"; import { afterEach, beforeEach, describe, expect, it, vi } from "vitest"; import { GoogleWorkspaceServicesDialog } from "./GoogleWorkspaceServices"; +import { GOOGLE_WORKSPACE_PRIVACY_POLICY_URL, googleWorkspaceDataUseDisclosure } from "./googleWorkspaceDisclosure"; const listGrants = vi.hoisted(() => vi.fn()); vi.mock("@/api/tools", () => ({ toolsApi: { listConnectionGrants: listGrants } })); @@ -151,3 +152,94 @@ describe("Workspace service consent", () => { }); }); + +const GMAIL_SEND_NOTE = "Google's permission screen also mentions sending email; Paperclip does not send email."; + +describe("Google Workspace data-use disclosure", () => { + const use = [ + "Agents read this content only to do the tasks you give them.", + "To do that, the content is sent to the AI model provider configured for your workspace.", + "It is not used to train general AI models.", + "Results are saved in the task and its run history. They stay there until you delete them, even after you disconnect.", + ]; + + it.each([ + [{ gmail: "read" }, ["Gmail: agents can read and search your email."]], + [{ gmail: "write" }, ["Gmail: agents can read and search your email, and create drafts. Google's permission screen also mentions sending email; Paperclip does not send email."]], + [{ drive: "read" }, ["Drive: agents can read and search your files, Docs, Sheets and Slides."]], + [{ drive: "write" }, ["Drive: agents can read and search your files, Docs, Sheets and Slides. They can also create files and edit Docs, Sheets and Slides."]], + [{ calendar: "read" }, ["Calendar: agents can see your calendars, events and free/busy times."]], + [{ calendar: "write" }, ["Calendar: agents can see your calendars, events and free/busy times. They can also create, change and delete events, and respond to invitations."]], + ] as const)("describes only the selected service (%o)", (selection, access) => { + expect(googleWorkspaceDataUseDisclosure(selection)).toEqual({ access, use }); + }); + + it("lists every selected service in picker order and always explains sharing", () => { + const disclosure = googleWorkspaceDataUseDisclosure({ calendar: "read", gmail: "write", drive: "read" }); + expect(disclosure.access.map(line => line.split(":")[0])).toEqual(["Gmail", "Drive", "Calendar"]); + expect(disclosure.use).toContain("To do that, the content is sent to the AI model provider configured for your workspace."); + }); + + it("never claims Gmail can send: read only never mentions sending, read & write only says Paperclip does not send", () => { + const text = (gmail: "read" | "write") => { + const { access, use } = googleWorkspaceDataUseDisclosure({ gmail }); + return [...access, ...use].join(" "); + }; + expect(text("read")).not.toMatch(/send/i); + expect(text("write")).toContain("Paperclip does not send email."); + expect(text("write").replace(GMAIL_SEND_NOTE, "")).not.toMatch(/send/i); + }); + + it("says nothing with no services selected", () => { + expect(googleWorkspaceDataUseDisclosure({})).toEqual({ access: [], use: [] }); + }); +}); + +describe("Workspace picker disclosure", () => { + let root: Root; + let container: HTMLDivElement; + const flush = async () => { await act(async () => { await new Promise(resolve => setTimeout(resolve, 0)); }); }; + beforeEach(() => { + container = document.createElement("div"); + document.body.append(container); + root = createRoot(container); + }); + afterEach(async () => { + await act(async () => { root.unmount(); }); + container.remove(); + }); + async function render(initial?: Record) { + await act(async () => { root.render( + + ); }); + await flush(); + } + const disclosure = () => document.querySelector('[aria-label="How Paperclip uses your Google data"]'); + + it("shows the selected services, sharing and privacy policy before Continue", async () => { + await render({ gmail: "write", calendar: "read" }); + const block = disclosure()!; + expect(block.textContent).toContain("Gmail: agents can read and search your email, and create drafts. Google's permission screen also mentions sending email; Paperclip does not send email."); + expect(block.textContent).toContain("Calendar: agents can see your calendars, events and free/busy times."); + expect(block.textContent).not.toContain("Drive"); + expect(block.textContent!.replace(GMAIL_SEND_NOTE, "")).not.toMatch(/\bsend/i); + expect(block.textContent).toContain("the content is sent to the AI model provider configured for your workspace"); + const link = block.querySelector("a")!; + expect(link.getAttribute("href")).toBe(GOOGLE_WORKSPACE_PRIVACY_POLICY_URL); + expect(GOOGLE_WORKSPACE_PRIVACY_POLICY_URL).toBe("https://paperclip.ing/privacy"); + expect(link.getAttribute("target")).toBe("_blank"); + expect(link.getAttribute("rel")).toContain("noopener"); + expect(link.textContent).toContain("Limited Use"); + const footer = document.querySelector("footer")!; + expect(block.compareDocumentPosition(footer) & Node.DOCUMENT_POSITION_FOLLOWING).toBeTruthy(); + }); + + it("follows the selection as services are turned off", async () => { + await render({ drive: "read" }); + expect(disclosure()!.textContent).toContain("Drive: agents can read and search your files"); + const toggle = document.querySelector("#workspace-service-drive")!; + await act(async () => { toggle.click(); }); + expect(disclosure()).toBeNull(); + expect(document.body.textContent).toContain("Select at least one service to continue."); + }); +}); diff --git a/ui/src/features/connections/GoogleWorkspaceServices.tsx b/ui/src/features/connections/GoogleWorkspaceServices.tsx index df249597eee..ef17b7a1533 100644 --- a/ui/src/features/connections/GoogleWorkspaceServices.tsx +++ b/ui/src/features/connections/GoogleWorkspaceServices.tsx @@ -1,5 +1,5 @@ import { useQueryView } from "@/components/QueryView"; -import { useState } from "react"; +import { useState, type ReactNode } from "react"; import { useQuery } from "@tanstack/react-query"; import { GOOGLE_WORKSPACE_DEFAULT_SELECTION, GOOGLE_WORKSPACE_SERVICE_GROUPS, googleWorkspaceDraftRequestedScopes, googleWorkspaceSelectionForScopes, type GoogleWorkspaceServiceSelection, type ToolConnection } from "@paperclipai/shared"; import { toolsApi } from "@/api/tools"; @@ -8,6 +8,7 @@ import { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle } f import { NativeSelect } from "@/components/ui/select"; import { ToggleSwitch } from "@/components/ui/toggle-switch"; import { AppLogo } from "@/pages/apps/AppLogo"; +import { GOOGLE_WORKSPACE_PRIVACY_POLICY_URL, googleWorkspaceDataUseDisclosure } from "./googleWorkspaceDisclosure"; export function GoogleWorkspaceServiceFields({ value, onChange }: { value: GoogleWorkspaceServiceSelection; @@ -36,6 +37,26 @@ export function GoogleWorkspaceServiceFields({ value, onChange }: { ; } +export function isGoogleWorkspaceConnection(connection: Pick): boolean { + return connection.config?.sourceTemplateKey === "google-workspace"; +} + +export function useGoogleWorkspaceServiceGate(): { + dialog: ReactNode; + run: (connection: ToolConnection, start: (selection?: GoogleWorkspaceServiceSelection) => void) => void; +} { + const [pending, setPending] = useState<{ connection: ToolConnection; start: (selection: GoogleWorkspaceServiceSelection) => void } | null>(null); + return { + dialog: pending ? setPending(null)} + onContinue={selection => { setPending(null); pending.start(selection); }} /> : null, + run: (connection, start) => { + if (isGoogleWorkspaceConnection(connection)) setPending({ connection, start }); + else start(); + }, + }; +} + type DialogProps = { onContinue: (value: GoogleWorkspaceServiceSelection) => void; onCancel: (selection?: GoogleWorkspaceServiceSelection) => void; @@ -77,17 +98,38 @@ export function GoogleWorkspaceServicesDialog(props: DialogProps) { return ; } +function DataUseDisclosure({ selection }: { selection: GoogleWorkspaceServiceSelection }) { + const { access, use } = googleWorkspaceDataUseDisclosure(selection); + return
+
+

What agents can do

+
    {access.map(line =>
  • {line}
  • )}
+
+
+

How your data is used

+
    {use.map(line =>
  • {line}
  • )}
+
+

+ + Read our privacy policy, including how we meet Google's Limited Use requirements (opens in a new tab) + +

+
; +} + function ServicePicker({ onContinue, onCancel, initial = GOOGLE_WORKSPACE_DEFAULT_SELECTION }: DialogProps) { const [selection, setSelection] = useState(initial); const empty = Object.keys(selection).length === 0; return { if (!open) onCancel(selection); }}> - +
Connect Google Workspace
Choose the Google services to connect.
- {empty &&

Select at least one service to continue.

} + {empty + ?

Select at least one service to continue.

+ : }