mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-11-24 14:20:12 +01:00
feat(ui): show the Cloud Slack invitation in the workspace sidebar (#22702)
## Thinking Path > - Teams use Paperclip to manage agents and their work. > - Hosted teams can have a private Slack channel with the Paperclip team. > - A workspace member needs to know whether they can open the channel or still need the owner's invitation. > - Cloud supplies that information for the selected organization. > - This change puts a Slack button in the sidebar footer. It opens a dialog with the next action. ## Linked Issues or Issue Description **Subsystem affected** Workspace sidebar and the Cloud onboarding browser journey. **Problem or motivation** After setup, a user can lose track of the invitation to their organization's private feedback channel. **Proposed solution** Show the invitation status in a dialog. Offer a channel link when Cloud confirms the connection. **Roadmap alignment** This extends the existing hosted workspace navigation. The roadmap has no separate item for this shortcut. ## What Changed - Both sidebar variants use the existing portfolio request to show the Slack shortcut when Cloud supplies invitation details. - The icon uses grayscale at rest and brand colors on hover or keyboard focus. The button has an accessible name and a tooltip. - The Cloud onboarding journey selects Codex and confirms feedback intent when the first-account welcome appears. - Storybook covers pending and connected channels. ## Verification - The sidebar suite passed 36 tests. The Cloud onboarding journey suite passed 10 tests covering both the current and previous gateway layouts. - The Storybook catalog regenerated successfully. - In a local browser run, a fresh user completed signup, connected a test model, hired an agent, opened its chat, and opened and dismissed the Slack invitation. The test used a local Slack fixture. - The incremental verifier selected broad CI coverage for the runner journey change. All applicable checks passed on `ea9779abda`. A GitHub runner shut down during a server test shard. The shard and final verification gate passed on retry. [CI run](https://github.com/paperclipai/paperclip/actions/runs/45276376121/attempts/2) · [Greptile review (5/5)](https://github.com/paperclipai/paperclip/pull/22702#issuecomment-7115303606) ## Risks An older Cloud service can omit the optional feedback field. In that case, the sidebar keeps the existing layout. Cloud controls the channel destination and the invitation state. ## Model Used OpenAI GPT-6 in Codex, with repository tools and browser verification. ## 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 - [x] All Paperclip CI gates are green - [x] Greptile is 5/5 with no open P2s, recommendations, or follow-ups - [x] I will address all Greptile and reviewer comments before requesting merge --------- Co-authored-by: Scott Tong <1504818+scotttong@users.noreply.github.com> Co-authored-by: Paperclip <noreply@paperclip.ing>
This commit is contained in:
11 files changed
+190
-57
No files matched your search
@@ -18,14 +18,15 @@ vi.mock("./onboarding-first-task.js", async () => {
|
||||
}) };
|
||||
});
|
||||
|
||||
type Entry = "first-run" | "portfolio" | "create-form";
|
||||
type Entry = "beta-welcome" | "first-run" | "portfolio" | "create-form";
|
||||
type Control = { role: string; name: string; scope?: string; fill?(value: string): void; click?(): void; select?(value: string): void };
|
||||
|
||||
/** Visible control contracts only; no browser, Cloud API, or provider is started. */
|
||||
function fixture(entry: Entry, options: { intentFailure?: boolean; qualificationFailure?: boolean; traceFailure?: boolean } = {}) {
|
||||
function fixture(entry: Entry, options: { legacyRunnerPicker?: boolean; intentFailure?: boolean; qualificationFailure?: boolean; traceFailure?: boolean } = {}) {
|
||||
let stage: string = entry, name = "", apiMode = false, source = false, advanced = false, runnerOpen = false;
|
||||
let modelsOpen = false, model = "", runner = "", saved = false, hired = false;
|
||||
const fields: Record<string, string> = {}, events: string[] = [];
|
||||
let hasCodex = false, intendsFeedback = false;
|
||||
const gateway = { baseUrl: "https://owned-gateway.example.test/v1", model: "gpt-5.4-mini", apiKey: "synthetic-test-key" };
|
||||
const connection = { id: "connection", name: "My owned-gateway.example.test", provider: "openai", method: "api_key", status: "connected" };
|
||||
const create = () => {
|
||||
@@ -34,6 +35,11 @@ function fixture(entry: Entry, options: { intentFailure?: boolean; qualification
|
||||
events.push("create:workspace"); stage = "agent";
|
||||
};
|
||||
const controls = (): Control[] => {
|
||||
if (stage === "beta-welcome") return [
|
||||
{ role: "checkbox", name: "OpenAI Codex", click() { hasCodex = true; } },
|
||||
{ role: "checkbox", name: "I intend to provide feedback on the Paperclip closed beta.", click() { intendsFeedback = true; } },
|
||||
{ role: "button", name: "Continue", click() { expect(hasCodex && intendsFeedback).toBe(true); stage = "first-run"; } },
|
||||
];
|
||||
if (stage === "portfolio") return [{ role: "link", name: "Create a new organization", click() { stage = "create-form"; } }];
|
||||
if (stage === "first-run" || stage === "create-form") return [
|
||||
{ role: "textbox", name: stage === "first-run" ? "Name" : "Organization name", fill(value) { name = value; } },
|
||||
@@ -50,7 +56,7 @@ function fixture(entry: Entry, options: { intentFailure?: boolean; qualification
|
||||
{ role: "button", name: apiMode ? "Use subscription instead" : "Use API key instead", click() { apiMode = !apiMode; } },
|
||||
{ role: "radio", name: apiMode ? "OpenAI API key" : "OpenAI Subscription", click() { source = true; } },
|
||||
];
|
||||
if (source && apiMode) result.push({ role: "button", name: "Use a custom gateway", click() { stage = "gateway"; } });
|
||||
if (source && apiMode && (advanced || options.legacyRunnerPicker)) result.push({ role: "button", name: "Use a custom gateway", click() { stage = "gateway"; } });
|
||||
if (stage === "gateway") {
|
||||
result.push({ role: "dialog", name: "Custom gateway connection" });
|
||||
for (const field of ["Provider URL", "API key", ...(modelsOpen ? ["Model IDs"] : [])]) result.push({
|
||||
@@ -64,9 +70,9 @@ function fixture(entry: Entry, options: { intentFailure?: boolean; qualification
|
||||
}
|
||||
if (saved) result.push({ role: "combobox", name: "Model", select(value) { expect(value).toBe(gateway.model); model = value; } });
|
||||
if (source) result.push({ role: "summary", name: "Advanced", click() { advanced = true; } });
|
||||
if (advanced) result.push({ role: "button", name: "Runner", click() { runnerOpen = true; } });
|
||||
if (advanced && options.legacyRunnerPicker) result.push({ role: "button", name: "Runner", click() { runnerOpen = true; } });
|
||||
if (runnerOpen) result.push({ role: "option", name: "Paperclip Runner (default)", click() { runner = "paperclip"; runnerOpen = false; } });
|
||||
if (saved && model && runner) result.push({ role: "button", name: "Connect", click() {
|
||||
if (saved && model && (!options.legacyRunnerPicker || runner)) result.push({ role: "button", name: "Connect", click() {
|
||||
expect(events).toContain("qualified"); events.push("paid:connect"); hired = true;
|
||||
} });
|
||||
return result;
|
||||
@@ -77,6 +83,7 @@ function fixture(entry: Entry, options: { intentFailure?: boolean; qualification
|
||||
or(other: { resolve(): Control[] }) { return locator(() => [...resolve(), ...other.resolve()]); },
|
||||
resolve,
|
||||
async isVisible() { return resolve().length > 0; },
|
||||
async check() { const control = resolve()[0]; if (control?.role !== "checkbox" || !control.click) throw new Error("No visible checkbox"); control.click(); },
|
||||
async fill(value: string) { const control = resolve()[0]; if (!control?.fill) throw new Error("No visible text field"); control.fill(value); },
|
||||
async click() { const control = resolve()[0]; if (!control?.click) throw new Error("No visible action"); events.push(`click:${control.name}`); control.click(); },
|
||||
async selectOption(value: string) { const control = resolve()[0]; if (!control?.select) throw new Error("No visible native model picker"); control.select(value); },
|
||||
@@ -134,7 +141,7 @@ describe("Cloud onboarding visible controls", () => {
|
||||
expect(f.input.evidence.checks.map(check => check.id)).toEqual(["fresh-workspace", "ui-connection-and-native-agent"]);
|
||||
expect(f.events).not.toContain("native:verified");
|
||||
});
|
||||
it.each(["first-run", "portfolio", "create-form"] as const)("creates from %s with intent before dispatch and qualification before paid Connect", async entry => {
|
||||
it.each(["beta-welcome", "first-run", "portfolio", "create-form"] as const)("creates from %s with intent before dispatch and qualification before paid Connect", async entry => {
|
||||
const f = fixture(entry);
|
||||
const result = await cloudOnboarding(f.input);
|
||||
expect(result.startingState).toBe("onboarding");
|
||||
@@ -143,6 +150,12 @@ describe("Cloud onboarding visible controls", () => {
|
||||
expect(f.events.indexOf("qualified")).toBeLessThan(f.events.indexOf("paid:connect"));
|
||||
expect(f.events).toContain("native:verified");
|
||||
});
|
||||
it("can still choose the native runner on tenants with a separate runner picker", async () => {
|
||||
const f = fixture("first-run", { legacyRunnerPicker: true });
|
||||
await cloudOnboarding(f.input);
|
||||
expect(f.events).toContain("click:Paperclip Runner (default)");
|
||||
expect(f.events).toContain("native:verified");
|
||||
});
|
||||
it("does not dispatch workspace creation without durable ownership", async () => {
|
||||
const f = fixture("first-run", { intentFailure: true });
|
||||
await expect(cloudOnboarding(f.input)).rejects.toThrow("ownership unavailable");
|
||||
|
||||
@@ -28,9 +28,16 @@ export async function cloudOnboarding(input: CloudOnboardingInput): Promise<Jour
|
||||
const firstRunName = page.getByLabel("Name", { exact: true });
|
||||
const organizationName = page.getByLabel("Organization name", { exact: true });
|
||||
const createLink = page.getByRole("link", { name: /^(Create (?:a new )?organization|\+ New organization)$/ }).first();
|
||||
const betaConnection = page.getByRole("checkbox", { name: "OpenAI Codex", exact: true });
|
||||
// The first organization uses the signup Name/Next form. Later organizations
|
||||
// use Organization name/Create organization, reached from the managed portfolio.
|
||||
await expect(firstRunName.or(organizationName).or(createLink).first()).toBeVisible();
|
||||
await expect(betaConnection.or(firstRunName).or(organizationName).or(createLink).first()).toBeVisible();
|
||||
if (await betaConnection.isVisible()) {
|
||||
await betaConnection.check();
|
||||
await page.getByRole("checkbox", { name: "I intend to provide feedback on the Paperclip closed beta.", exact: true }).check();
|
||||
await page.getByRole("button", { name: "Continue", exact: true }).click();
|
||||
await expect(firstRunName).toBeVisible();
|
||||
}
|
||||
if (!await firstRunName.isVisible() && !await organizationName.isVisible()) {
|
||||
await createLink.click();
|
||||
await expect(organizationName).toBeVisible();
|
||||
@@ -50,7 +57,13 @@ export async function cloudOnboarding(input: CloudOnboardingInput): Promise<Jour
|
||||
await page.getByRole("button", { name: "Next", exact: true }).click();
|
||||
await page.getByRole("button", { name: "Use API key instead", exact: true }).click();
|
||||
await page.getByRole("radio", { name: /OpenAI.*API/ }).click();
|
||||
await page.getByRole("button", { name: "Use a custom gateway", exact: true }).click();
|
||||
const gatewayButton = page.getByRole("button", { name: "Use a custom gateway", exact: true });
|
||||
const advanced = page.locator("summary").filter({ hasText: "Advanced" });
|
||||
await expect(gatewayButton.or(advanced).first()).toBeVisible();
|
||||
// Older tenants show the gateway inline and keep the runner picker in Advanced.
|
||||
const inlineGateway = await gatewayButton.isVisible();
|
||||
if (!inlineGateway) await advanced.click();
|
||||
await gatewayButton.click();
|
||||
const dialog = page.getByRole("dialog", { name: "Custom gateway connection", exact: true });
|
||||
await dialog.getByLabel("Provider URL", { exact: true }).fill(input.gateway.baseUrl);
|
||||
await dialog.getByLabel("API key", { exact: true }).fill(input.gateway.apiKey);
|
||||
@@ -65,9 +78,11 @@ export async function cloudOnboarding(input: CloudOnboardingInput): Promise<Jour
|
||||
if (!connection || connections.length !== 1) throw new JourneyError("failed", "onboarding_connection_not_saved");
|
||||
await input.own({ kind: "connection", name: connectionName, id: connection.id });
|
||||
await page.getByRole("combobox", { name: "Model", exact: true }).selectOption(input.gateway.model);
|
||||
await page.locator("summary").filter({ hasText: "Advanced" }).click();
|
||||
await page.getByRole("button", { name: "Runner", exact: true }).click();
|
||||
await page.getByRole("option", { name: /^Paperclip Runner/ }).click();
|
||||
if (inlineGateway) {
|
||||
await advanced.click();
|
||||
await page.getByRole("button", { name: "Runner", exact: true }).click();
|
||||
await page.getByRole("option", { name: /^Paperclip Runner/ }).click();
|
||||
}
|
||||
await input.qualify(context, connection.id);
|
||||
// Connect performs the production probe and agent creation. Never press Retry.
|
||||
const connect = await onboardingConnect({ page, origin: api.origin, companyId: company.id, deadlineAt: input.deadlineAt,
|
||||
|
||||
Reference in new issue
Block a user