mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-12-01 09:39:53 +01:00
test: retire duplicated workspace-inheritance and environment-form cases (#22391)
## Thinking Path > - Paperclip is the open source app people use to manage AI agents for work. > - The repository keeps its regression proof in Vitest suites. Two suites and one UI suite held duplicate test cases. > - The file `server/src/__tests__/issues-service.test.ts` has two describe blocks with the same name. Each block held one copy of a test about workspace inheritance from a source issue. The two copies differed only in the `projectId` input. > - The file `ui/src/pages/CompanyEnvironments.test.tsx` held byte-identical second copies of two tests about the SSH remote-auth option, inside the same describe. > - Duplicate registrations run the same production path twice. They add CI work and maintenance cost, and they give no new proof. > - This pull request removes the duplicate registrations. It keeps one registration for each contract, with the same assertions and fixtures. > - The benefit is less duplicated test code and fewer repeated case executions, with the same regression safety. ## Linked Issues or Issue Description No public GitHub issue covers this cleanup. The problem follows the enhancement template. **What existing behavior does this improve?** The behavior of the existing test suites. The suites `issueService.create workspace inheritance` (server) and `CompanyEnvironments — test provider button` (ui) still protect the same contracts, without duplicate registrations. **Subsystem affected** - `server/src/__tests__/issues-service.test.ts` — the workspace-inheritance cases of `issueService.create`. - `ui/src/pages/CompanyEnvironments.test.tsx` — the SSH environment form cases for the remote-auth option. **Current behavior** - Two describe blocks in `issues-service.test.ts` register a test with the same name. One copy passes `projectId` to `create()`; the other copy omits `projectId` and asserts that the follow-up inherits the project from the source issue. All other assertions are the same. - `CompanyEnvironments.test.tsx` registers two tests twice. The second copies are byte-identical to the retained copies. **Proposed behavior** - One `it.each([true, false])` registration covers the explicit and the implicit `projectId` input. The `projectId` inheritance assertion runs in both variants. - The byte-identical second copies in `CompanyEnvironments.test.tsx` are removed. The retained copies stay without changes. **Reason and benefit** The removal keeps every assertion and every fixture. The retained registrations execute the same production code and detect the same regressions. The change deletes 136 lines of test code and adds 55 lines. It removes 4 repeated case executions per run of the UI file (1 + 3 `it.each` rows) and removes 1 duplicated registration in the server file. Duplicate work was searched before this pull request was opened. No open or merged pull request touches these duplicate cases. ## What Changed - `server/src/__tests__/issues-service.test.ts`: the retained test now uses `it.each([true, false])` for the explicit and the implicit `projectId` input. The assertion `expect(followUp.projectId).toBe(projectId)` was moved from the deleted copy and now runs in both variants. The duplicate copy in the second describe block was deleted. No fixture changed. - `ui/src/pages/CompanyEnvironments.test.tsx`: the byte-identical second copies of `defaults new SSH environments to the agent's Paperclip account` and `preserves the remote-auth option when editing an existing SSH environment (saved=%s)` were deleted. The retained copies were not changed. ## Verification - Base revision: `201abacd6e` (master). Branch head: `9bbc77867a`. - `pnpm --filter @paperclipai/server exec vitest run src/__tests__/issues-service.test.ts` — 155 tests passed (all suites of the owner file, real embedded Postgres, no name filter). - `pnpm --filter @paperclipai/ui exec vitest run src/pages/CompanyEnvironments.test.tsx` — 43 tests passed with this change; the same command at the base revision reported 47 tests. The 4 removed cases were byte-identical duplicates of retained cases. - Keeper control 1: with a temporary production change that copies the source issue's `executionWorkspaceId` to the follow-up, both `it.each` variants fail at `expect(followUp.executionWorkspaceId).toBeNull()`. The production change was restored after the check; the file matched the committed bytes. - Keeper control 2: with a temporary production change that skips the `projectId` inheritance from the source issue, only the `explicitProjectId=false` variant fails, at `expect(followUp.projectId).toBe(projectId)`. The production change was restored after the check. - `pnpm --filter @paperclipai/ui typecheck` passed. - The server package typecheck could not run on this host: the `cycle` layer of `scripts/typecheck-layers.mjs` needs more memory than this machine has, and `tsc` was stopped by the operating system (SIGKILL) on both attempts. This is a host limit, not a product failure. CI runs the same typecheck on this PR head. - CI runs the full test lanes on this PR head. The checks below are the required proof. ## Risks - Low risk. No production code changed. No test selection, routing, or CI configuration changed. - The server consolidation keeps the same number of scenario executions (two) through the same production path, so it reduces maintenance cost, not server CI wall-time. - The UI deletions remove 4 repeated case executions per run of the file. No measured CI wall-time claim is made from this change. ## Model Used - OpenRouter `z-ai/glm-5.3` (GLM), operated as the Paperclip "Test Gardener (GLM)" agent. Tool use: file search and edit, shell test runs, GitHub publication through the `gh` CLI. Context window size: not tracked by the operator. Reasoning mode: default. ## 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 - [ ] I will address all Greptile and reviewer comments before requesting merge --- ## Update (2026-11-24 rebase) Master's #22679 deleted `ui/src/pages/CompanyEnvironments.test.tsx`, which made this branch conflict. The branch was rebased onto master `28aa32e7`: the obsolete UI-file deduplication was dropped, and this PR now carries only the server-side deduplication in `server/src/__tests__/issues-service.test.ts` (single commit `4c115486`). Everything written above about the UI file describes work that no longer exists in this PR. Co-Authored-By: Paperclip <Paperclip-Paperclip@users.noreply.github.com>
This commit is contained in:
1 parent
aa76a16879
commit
8aba5a575e
1 file changed
+55
-110
@@ -3834,64 +3834,68 @@ describeEmbeddedPostgres("issueService.create workspace inheritance", () => {
|
||||
});
|
||||
});
|
||||
|
||||
it("inherits project and strategy, not the realized workspace, from an explicit source issue without creating a parent-child relationship", async () => {
|
||||
const companyId = randomUUID();
|
||||
const projectId = randomUUID();
|
||||
const sourceIssueId = randomUUID();
|
||||
const projectWorkspaceId = randomUUID();
|
||||
const executionWorkspaceId = randomUUID();
|
||||
it.each([true, false])(
|
||||
"inherits project and strategy, not the realized workspace, from an explicit source issue without creating a parent-child relationship (explicit projectId=%s)",
|
||||
async (explicitProjectId) => {
|
||||
const companyId = randomUUID();
|
||||
const projectId = randomUUID();
|
||||
const sourceIssueId = randomUUID();
|
||||
const projectWorkspaceId = randomUUID();
|
||||
const executionWorkspaceId = randomUUID();
|
||||
|
||||
await seedIssueCompany(db, companyId);
|
||||
await instanceSettingsService(db).updateExperimental({ enableIsolatedWorkspaces: true });
|
||||
await seedIssueCompany(db, companyId);
|
||||
await instanceSettingsService(db).updateExperimental({ enableIsolatedWorkspaces: true });
|
||||
|
||||
await seedWorkspaceProject(db, companyId, projectId);
|
||||
await seedWorkspaceProject(db, companyId, projectId);
|
||||
|
||||
await db.insert(projectWorkspaces).values({
|
||||
id: projectWorkspaceId,
|
||||
companyId,
|
||||
projectId,
|
||||
name: "Primary workspace",
|
||||
});
|
||||
await db.insert(projectWorkspaces).values({
|
||||
id: projectWorkspaceId,
|
||||
companyId,
|
||||
projectId,
|
||||
name: "Primary workspace",
|
||||
});
|
||||
|
||||
await db.insert(executionWorkspaces).values({
|
||||
id: executionWorkspaceId,
|
||||
companyId,
|
||||
projectId,
|
||||
projectWorkspaceId,
|
||||
mode: "operator_branch",
|
||||
strategyType: "git_worktree",
|
||||
name: "Operator branch",
|
||||
status: "active",
|
||||
providerType: "git_worktree",
|
||||
});
|
||||
|
||||
await db.insert(issues).values({
|
||||
id: sourceIssueId,
|
||||
companyId,
|
||||
projectId,
|
||||
projectWorkspaceId,
|
||||
title: "Source issue",
|
||||
status: "todo",
|
||||
priority: "medium",
|
||||
executionWorkspaceId,
|
||||
executionWorkspacePreference: "reuse_existing",
|
||||
executionWorkspaceSettings: {
|
||||
await db.insert(executionWorkspaces).values({
|
||||
id: executionWorkspaceId,
|
||||
companyId,
|
||||
projectId,
|
||||
projectWorkspaceId,
|
||||
mode: "operator_branch",
|
||||
},
|
||||
});
|
||||
strategyType: "git_worktree",
|
||||
name: "Operator branch",
|
||||
status: "active",
|
||||
providerType: "git_worktree",
|
||||
});
|
||||
|
||||
const followUp = await svc.create(companyId, {
|
||||
projectId,
|
||||
title: "Follow-up issue",
|
||||
inheritExecutionWorkspaceFromIssueId: sourceIssueId,
|
||||
});
|
||||
await db.insert(issues).values({
|
||||
id: sourceIssueId,
|
||||
companyId,
|
||||
projectId,
|
||||
projectWorkspaceId,
|
||||
title: "Source issue",
|
||||
status: "todo",
|
||||
priority: "medium",
|
||||
executionWorkspaceId,
|
||||
executionWorkspacePreference: "reuse_existing",
|
||||
executionWorkspaceSettings: {
|
||||
mode: "operator_branch",
|
||||
},
|
||||
});
|
||||
|
||||
expect(followUp.parentId).toBeNull();
|
||||
expect(followUp.projectWorkspaceId).toBe(projectWorkspaceId);
|
||||
expect(followUp.executionWorkspaceId).toBeNull();
|
||||
expect(followUp.executionWorkspacePreference).toBeNull();
|
||||
expect(JSON.stringify(followUp.executionWorkspaceSettings ?? {})).not.toContain("operator_branch");
|
||||
});
|
||||
const followUp = await svc.create(companyId, {
|
||||
...(explicitProjectId ? { projectId } : {}),
|
||||
title: "Follow-up issue",
|
||||
inheritExecutionWorkspaceFromIssueId: sourceIssueId,
|
||||
});
|
||||
|
||||
expect(followUp.parentId).toBeNull();
|
||||
expect(followUp.projectId).toBe(projectId);
|
||||
expect(followUp.projectWorkspaceId).toBe(projectWorkspaceId);
|
||||
expect(followUp.executionWorkspaceId).toBeNull();
|
||||
expect(followUp.executionWorkspacePreference).toBeNull();
|
||||
expect(JSON.stringify(followUp.executionWorkspaceSettings ?? {})).not.toContain("operator_branch");
|
||||
},
|
||||
);
|
||||
|
||||
it("createChild applies parent defaults, acceptance criteria, an independent workspace, and optional parent blocker chaining", async () => {
|
||||
const companyId = randomUUID();
|
||||
@@ -5263,65 +5267,6 @@ describeEmbeddedPostgres("issueService.create workspace inheritance", () => {
|
||||
});
|
||||
});
|
||||
|
||||
it("inherits project and strategy, not the realized workspace, from an explicit source issue without creating a parent-child relationship", async () => {
|
||||
const companyId = randomUUID();
|
||||
const projectId = randomUUID();
|
||||
const sourceIssueId = randomUUID();
|
||||
const projectWorkspaceId = randomUUID();
|
||||
const executionWorkspaceId = randomUUID();
|
||||
|
||||
await seedIssueCompany(db, companyId);
|
||||
await instanceSettingsService(db).updateExperimental({ enableIsolatedWorkspaces: true });
|
||||
|
||||
await seedWorkspaceProject(db, companyId, projectId);
|
||||
|
||||
await db.insert(projectWorkspaces).values({
|
||||
id: projectWorkspaceId,
|
||||
companyId,
|
||||
projectId,
|
||||
name: "Primary workspace",
|
||||
});
|
||||
|
||||
await db.insert(executionWorkspaces).values({
|
||||
id: executionWorkspaceId,
|
||||
companyId,
|
||||
projectId,
|
||||
projectWorkspaceId,
|
||||
mode: "operator_branch",
|
||||
strategyType: "git_worktree",
|
||||
name: "Operator branch",
|
||||
status: "active",
|
||||
providerType: "git_worktree",
|
||||
});
|
||||
|
||||
await db.insert(issues).values({
|
||||
id: sourceIssueId,
|
||||
companyId,
|
||||
projectId,
|
||||
projectWorkspaceId,
|
||||
title: "Source issue",
|
||||
status: "todo",
|
||||
priority: "medium",
|
||||
executionWorkspaceId,
|
||||
executionWorkspacePreference: "reuse_existing",
|
||||
executionWorkspaceSettings: {
|
||||
mode: "operator_branch",
|
||||
},
|
||||
});
|
||||
|
||||
const followUp = await svc.create(companyId, {
|
||||
title: "Follow-up issue",
|
||||
inheritExecutionWorkspaceFromIssueId: sourceIssueId,
|
||||
});
|
||||
|
||||
expect(followUp.parentId).toBeNull();
|
||||
expect(followUp.projectId).toBe(projectId);
|
||||
expect(followUp.projectWorkspaceId).toBe(projectWorkspaceId);
|
||||
expect(followUp.executionWorkspaceId).toBeNull();
|
||||
expect(followUp.executionWorkspacePreference).toBeNull();
|
||||
expect(JSON.stringify(followUp.executionWorkspaceSettings ?? {})).not.toContain("operator_branch");
|
||||
});
|
||||
|
||||
it("preserves projectless organization when an update adds workspace linkage", async () => {
|
||||
const companyId = randomUUID();
|
||||
const projectId = randomUUID();
|
||||
|
||||
Reference in new issue
Block a user