Merge workspace fixture setup repair into sleep-17-plugin-job-scheduling

Propagate self-contained workspace fixture migrations while preserving this PR boundary and the chat fixture repair.

Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
DottaandPaperclip committed 2026-10-26 23:19:21 -05:00
commit c7cab93248
3 files changed
+21 -4

No files matched your search

+15
View File
@@ -66,3 +66,18 @@ on its own disposable database and retain the existing embedded fixture fallback
These are local correctness and scheduling results, not deployed host-sleep or
external-wake proof. Remote acceptance must be checked at the published head.
## External fixture migrations (October 26 review repair)
Review found that the two migration suites opened external test databases without
applying migrations. The previous verification used prepared databases, which
hid this setup gap. Both selected retry cases failed against new empty disposable
databases with missing `companies` and restore-point tables. Setup now applies
pending migrations before creating its test client, matching the workspace
service fixture. The embedded path is unchanged.
All 49 cases in the two complete suites then passed against those same databases,
including Git/filesystem migration, recovery, and exact retry-deadline checks.
The fixture itself prepared the databases. This repair changes no production
recovery code. Evidence: `/tmp/sleep-workspace-fresh-red.log` and
`/tmp/sleep-workspace-fresh-green.log`.
@@ -6,7 +6,7 @@ import { randomUUID } from "node:crypto";
import { pathToFileURL } from "node:url";
import { afterAll, afterEach, beforeAll, describe, expect, it, vi } from "vitest";
import { eq, sql } from "drizzle-orm";
import { agents, companies, createDb, executionWorkspaceRestorePoints, executionWorkspaces, heartbeatRuns, issues, projects } from "@paperclipai/db";
import { agents, applyPendingMigrations, companies, createDb, executionWorkspaceRestorePoints, executionWorkspaces, heartbeatRuns, issues, projects } from "@paperclipai/db";
import { getEmbeddedPostgresTestSupport, startEmbeddedPostgresTestDatabase } from "./helpers/embedded-postgres.js";
import { resolveManagedProjectWorkspaceDir } from "../home-paths.js";
import { materializeManagedProjectWorkspace, ensureManagedRepositoriesIgnored } from "../services/managed-repository-checkout.js";
@@ -37,7 +37,8 @@ describeEmbeddedPostgres("isolated repository source re-home", () => {
const previousHome = process.env.PAPERCLIP_HOME;
const previousInstance = process.env.PAPERCLIP_INSTANCE_ID;
beforeAll(async () => {
if (!external) database = await startEmbeddedPostgresTestDatabase("isolated-repository-rehome-");
if (external) await applyPendingMigrations(external);
else database = await startEmbeddedPostgresTestDatabase("isolated-repository-rehome-");
db = createDb(external ?? database!.connectionString);
root = await fs.mkdtemp(path.join(os.tmpdir(), "paperclip-isolated-rehome-"));
process.env.PAPERCLIP_HOME = path.join(root, "home");
@@ -6,7 +6,7 @@ import { randomUUID } from "node:crypto";
import { pathToFileURL } from "node:url";
import { afterAll, afterEach, beforeAll, describe, expect, it, vi } from "vitest";
import { eq, sql } from "drizzle-orm";
import { agents, companies, createDb, executionWorkspaceRestorePoints, executionWorkspaces, heartbeatRuns, issues, projects, projectWorkspaces } from "@paperclipai/db";
import { agents, applyPendingMigrations, companies, createDb, executionWorkspaceRestorePoints, executionWorkspaces, heartbeatRuns, issues, projects, projectWorkspaces } from "@paperclipai/db";
import { getEmbeddedPostgresTestSupport, startEmbeddedPostgresTestDatabase } from "./helpers/embedded-postgres.js";
import { materializeManagedProjectWorkspace } from "../services/managed-repository-checkout.js";
import { materializeIsolatedRemoteWorkspaceSource } from "../services/isolated-remote-workspace-source.js";
@@ -56,7 +56,8 @@ describeEmbeddedPostgres("nested repository clone migration", () => {
const previousHome = process.env.PAPERCLIP_HOME;
const previousInstance = process.env.PAPERCLIP_INSTANCE_ID;
beforeAll(async () => {
if (!external) database = await startEmbeddedPostgresTestDatabase("nested-clone-migration-");
if (external) await applyPendingMigrations(external);
else database = await startEmbeddedPostgresTestDatabase("nested-clone-migration-");
db = createDb(external ?? database!.connectionString);
root = await fs.mkdtemp(path.join(os.tmpdir(), "paperclip-nested-migration-"));
process.env.PAPERCLIP_HOME = path.join(root, "home");