From c6d4ee10f7f009f8bfb93a4dee87fb076760f275 Mon Sep 17 00:00:00 2001 From: Dotta <34892728+cryppadotta@users.noreply.github.com> Date: Tue, 14 Jul 2026 14:03:03 -0500 Subject: [PATCH] test: align current-master regression expectations (#9577) 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 > - Its server and UI test suites protect company-scoped plugin access and instance settings behavior > - Recent governed-access contracts intentionally added company invocation scope and new experimental-setting defaults > - Four existing tests were not updated consistently with those contracts, causing current-master CI failures unrelated to the changes under review > - The runtime behavior is intentional, so changing production code would weaken the new authorization and settings contracts > - This pull request aligns the stale tests with current behavior and removes one UI assertion accidentally pulled forward from a later stacked feature > - The benefit is a focused, low-risk repair that restores master CI without changing application behavior ## Linked Issues or Issue Description - **Bug:** Current master has four regression failures in plugin authorization, plugin execution-workspace bridging, instance settings normalization, and experimental settings UI tests. - **Expected behavior:** Tests provide required company/invocation scope, use the governed object-shaped secret reference contract, include all current defaults, and only assert UI controls implemented at this stack level. - **Actual behavior:** Tests exercised obsolete request shapes or expected a later-stack Apps toggle that is not present on current master. - **Reproduction:** Run the four test files listed in the Verification section on master before this commit. ## What Changed - Updates plugin config authorization coverage to include company scope and an object-shaped `secret_ref` binding. - Supplies invocation company scope to execution-workspace host-client tests. - Adds `enableApps` and `enableSmokeLab` to normalized settings expectations. - Removes the premature Apps toggle UI test introduced without its later-stack implementation. ## Verification - `pnpm exec vitest run server/src/__tests__/plugin-routes-authz.test.ts server/src/__tests__/plugin-execution-workspace-bridge.test.ts server/src/__tests__/instance-settings-service.test.ts ui/src/pages/InstanceExperimentalSettings.test.tsx` — 73 tests passed. - `pnpm exec vitest run packages/plugins/sdk/tests/host-client-factory.test.ts server/src/__tests__/plugin-secrets-handler.test.ts server/src/__tests__/instance-settings-routes.test.ts ui/src/lib/instance-settings.test.ts` — 39 tests passed. - `git diff --check` — passed. ## Risks - Low risk: test-only changes with no production runtime, schema, API, or UI behavior changes. - The removed Apps toggle assertion should return in the later stacked change that introduces the actual control. > 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 - OpenAI Codex, exact model ID `gpt-5.4`; runtime-managed context window; medium reasoning with repository, shell, GitHub CLI, and code-execution tools enabled. ## 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 --- .../__tests__/instance-settings-service.test.ts | 2 ++ .../plugin-execution-workspace-bridge.test.ts | 10 ++++++++-- server/src/__tests__/plugin-routes-authz.test.ts | 8 ++++++-- ui/src/pages/InstanceExperimentalSettings.test.tsx | 14 -------------- 4 files changed, 16 insertions(+), 18 deletions(-) diff --git a/server/src/__tests__/instance-settings-service.test.ts b/server/src/__tests__/instance-settings-service.test.ts index dbca0fa120..4177666965 100644 --- a/server/src/__tests__/instance-settings-service.test.ts +++ b/server/src/__tests__/instance-settings-service.test.ts @@ -28,6 +28,7 @@ describe("instance settings service", () => { enableEnvironments: true, enableIsolatedWorkspaces: true, enableStreamlinedLeftNavigation: true, + enableApps: false, enableConferenceRoomChat: false, enableExternalObjects: false, enablePipelines: false, @@ -36,6 +37,7 @@ describe("instance settings service", () => { enableExperimentalFileViewer: true, enableTaskWatchdogs: true, enableCloudSync: true, + enableSmokeLab: false, enableBuiltInAgents: true, enableDecisions: false, enableGoalsSidebarLink: true, diff --git a/server/src/__tests__/plugin-execution-workspace-bridge.test.ts b/server/src/__tests__/plugin-execution-workspace-bridge.test.ts index 6c672f5113..668e198223 100644 --- a/server/src/__tests__/plugin-execution-workspace-bridge.test.ts +++ b/server/src/__tests__/plugin-execution-workspace-bridge.test.ts @@ -26,7 +26,10 @@ describe("plugin execution workspace bridge", () => { }); await expect( - handlers["executionWorkspaces.get"]({ workspaceId: "workspace-1", companyId: "company-1" }), + handlers["executionWorkspaces.get"]( + { workspaceId: "workspace-1", companyId: "company-1" }, + { invocationScope: { companyId: "company-1" } }, + ), ).resolves.toMatchObject({ id: "workspace-1", cwd: "/tmp/workspace-1", @@ -45,7 +48,10 @@ describe("plugin execution workspace bridge", () => { }); await expect( - handlers["executionWorkspaces.get"]({ workspaceId: "workspace-1", companyId: "company-1" }), + handlers["executionWorkspaces.get"]( + { workspaceId: "workspace-1", companyId: "company-1" }, + { invocationScope: { companyId: "company-1" } }, + ), ).rejects.toMatchObject({ code: PLUGIN_RPC_ERROR_CODES.CAPABILITY_DENIED, }); diff --git a/server/src/__tests__/plugin-routes-authz.test.ts b/server/src/__tests__/plugin-routes-authz.test.ts index 2f74a1aaa4..2a83fc2536 100644 --- a/server/src/__tests__/plugin-routes-authz.test.ts +++ b/server/src/__tests__/plugin-routes-authz.test.ts @@ -322,13 +322,17 @@ describe.sequential("plugin install and upgrade authz", () => { const res = await request(app) .post(`/api/plugins/${pluginId}/config`) .send({ + companyId: companyA, configJson: { - apiKeyRef: "77777777-7777-4777-8777-777777777777", + apiKeyRef: { + type: "secret_ref", + secretId: "77777777-7777-4777-8777-777777777777", + }, }, }); expect(res.status).toBe(422); - expect(res.body.error).toMatch(/secret references are disabled/i); + expect(res.body.error).toMatch(/secret references require/i); expect(mockRegistry.upsertConfig).not.toHaveBeenCalled(); }, 20_000); diff --git a/ui/src/pages/InstanceExperimentalSettings.test.tsx b/ui/src/pages/InstanceExperimentalSettings.test.tsx index 300f2e2454..45f4da85c1 100644 --- a/ui/src/pages/InstanceExperimentalSettings.test.tsx +++ b/ui/src/pages/InstanceExperimentalSettings.test.tsx @@ -55,7 +55,6 @@ const SERVER_INFO_TOGGLE_SELECTOR = 'button[aria-label="Toggle server info debug view experimental setting"]'; const BUILT_IN_AGENTS_TOGGLE_SELECTOR = 'button[aria-label="Toggle built-in agents experimental setting"]'; -const APPS_TOGGLE_SELECTOR = 'button[aria-label="Toggle apps experimental setting"]'; const AUTO_RECOVERY_TOGGLE_SELECTOR = 'button[aria-label="Toggle task graph liveness auto-recovery"]'; @@ -188,19 +187,6 @@ describe("InstanceExperimentalSettings — Conference Room Chat card (PAP-11233) expect(warning?.textContent).toContain("no compatibility guarantees"); }); - it("enables the Apps UI from experimental settings", async () => { - await renderPage(); - - const toggle = container.querySelector(APPS_TOGGLE_SELECTOR); - expect(toggle?.getAttribute("aria-checked")).toBe("false"); - - await act(() => toggle?.click()); - await flushReact(); - - expect(mockInstanceSettingsApi.updateExperimental).toHaveBeenCalledWith({ enableApps: true }); - expect(container.querySelector(APPS_TOGGLE_SELECTOR)?.getAttribute("aria-checked")).toBe("true"); - }); - it("does not render the Conference Room Chat experimental setting for now", async () => { await renderPage();