From 21be75d2b02ae26b91a9e773ae3e12f8bd1320aa Mon Sep 17 00:00:00 2001 From: Dotta Date: Tue, 27 Oct 2026 21:27:49 -0500 Subject: [PATCH] Migrate and clean disposable company-deletion test fixtures Co-Authored-By: Paperclip --- doc/company-chat-deletion.md | 20 +++++++++++++++++++ .../__tests__/cleanup-removal-service.test.ts | 5 ++++- 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/doc/company-chat-deletion.md b/doc/company-chat-deletion.md index ba75f7e8cb4..fafa6b68a8c 100644 --- a/doc/company-chat-deletion.md +++ b/doc/company-chat-deletion.md @@ -31,3 +31,23 @@ The chat participant now runs immediately after the company row is locked, befor any referenced issue or agent is removed. The same transaction preserves history on rollback. This supplements the original endpoint-only proof; it does not claim to remove existing voice-session restrictions. + +## Current-parent acceptance, October 27 + +This slice normally integrates health parent #17554 at +`8c1d293d1ae2b7db753ab20f5a2a2edec1fb0a62`. Only the four company-cleanup +files differ from that parent; no database, workflow, or provider change is added. +The parent must land before this prerequisite can merge into master. + +The remaining Ponytail finding reproduced on an initially empty dedicated +PostgreSQL 17 database: the real endpoint-deletion case and its cleanup failed +with missing-table errors. The external fixture now applies pending migrations +before creating its client and uses a 30-second setup timeout. The six complete +cleanup-removal cases pass on that same initially empty database. Test teardown +also deletes the ownership tombstones it creates; an independent query after +the complete suite finds zero rows. This fixture cleanup does not change the +production rule that company deletion preserves those tombstones. + +The failed fresh-database run remains part of the evidence. Server typecheck and +build pass with this repair. Fresh current-head CI/reviews remain separate gates. No full local +repository-suite or deployed suspension claim is made. diff --git a/server/src/__tests__/cleanup-removal-service.test.ts b/server/src/__tests__/cleanup-removal-service.test.ts index ca8371fb25b..79f68f7e875 100644 --- a/server/src/__tests__/cleanup-removal-service.test.ts +++ b/server/src/__tests__/cleanup-removal-service.test.ts @@ -5,6 +5,7 @@ import { randomUUID } from "node:crypto"; import { eq } from "drizzle-orm"; import { afterAll, afterEach, beforeAll, describe, expect, it, vi } from "vitest"; import { + applyPendingMigrations, chatEndpoints, chatConversations, chatPublications, @@ -50,13 +51,15 @@ describeEmbeddedPostgres("cleanup removal services", () => { beforeAll(async () => { if (!external) tempDb = await startEmbeddedPostgresTestDatabase("paperclip-cleanup-removal-"); + if (external) await applyPendingMigrations(external); db = createDb(external ?? tempDb!.connectionString); configureAgentLifecycle(db, { requiredPluginIds: async () => [], runPlugin: async () => "complete", runHost: async () => "complete" }); - }, 20_000); + }, 30_000); afterEach(async () => { vi.restoreAllMocks(); await db.delete(chatEndpoints); + await db.delete(chatDiscordCommandOwners); await db.delete(toolConnections); await db.delete(toolApplications); await db.delete(heartbeatRunEvents);