From 752f90c3308c692d4bb7cfaebf976d704303898b Mon Sep 17 00:00:00 2001 From: "autofix-ci[bot]" <114827586+autofix-ci[bot]@users.noreply.github.com> Date: Tue, 17 Feb 2026 06:04:26 +0000 Subject: [PATCH] [autofix.ci] apply automated fixes --- .../__test__/deploy/application.real.test.ts | 11 +- .../patches/patch.integration.test.ts | 45 +- .../application/patches/patch-editor.tsx | 21 +- .../application/patches/show-patches.tsx | 26 +- apps/dokploy/server/api/routers/patch.ts | 16 +- openapi.json | 44030 ++++++++-------- packages/server/src/services/application.ts | 6 +- packages/server/src/services/compose.ts | 7 +- packages/server/src/services/patch-repo.ts | 8 +- packages/server/src/services/patch.ts | 10 +- 10 files changed, 21293 insertions(+), 22887 deletions(-) diff --git a/apps/dokploy/__test__/deploy/application.real.test.ts b/apps/dokploy/__test__/deploy/application.real.test.ts index 3831212d7..d440ad68d 100644 --- a/apps/dokploy/__test__/deploy/application.real.test.ts +++ b/apps/dokploy/__test__/deploy/application.real.test.ts @@ -1,4 +1,3 @@ - import { existsSync } from "node:fs"; import path from "node:path"; import type { ApplicationNested } from "@dokploy/server"; @@ -80,9 +79,8 @@ vi.mock("@dokploy/server/services/rollbacks", () => ({ })); vi.mock("@dokploy/server/services/patch", async (importOriginal) => { - const actual = await importOriginal< - typeof import("@dokploy/server/services/patch") - >(); + const actual = + await importOriginal(); return { ...actual, findPatchesByApplicationId: vi.fn().mockResolvedValue([]), @@ -507,7 +505,8 @@ describe( // 1. Setup local temporary git repo const tempRepo = await mkdtemp(join(tmpdir(), "real-patch-repo-")); // Helper for local git commands - const execLocal = async (cmd: string) => execAsync(cmd, { cwd: tempRepo }); + const execLocal = async (cmd: string) => + execAsync(cmd, { cwd: tempRepo }); await execLocal("git init"); await execLocal("git config user.email 'test@dokploy.com'"); @@ -518,7 +517,7 @@ describe( await writeFile(join(tempRepo, "app.py"), "print('Original App')\n"); await writeFile( join(tempRepo, "Dockerfile"), - "FROM python:3.9-slim\nCOPY app.py .\nCMD [\"python\", \"app.py\"]\n", + 'FROM python:3.9-slim\nCOPY app.py .\nCMD ["python", "app.py"]\n', ); await execLocal("git add ."); diff --git a/apps/dokploy/__test__/patches/patch.integration.test.ts b/apps/dokploy/__test__/patches/patch.integration.test.ts index 2e370022e..9efbc369f 100644 --- a/apps/dokploy/__test__/patches/patch.integration.test.ts +++ b/apps/dokploy/__test__/patches/patch.integration.test.ts @@ -1,4 +1,3 @@ - import { generatePatch } from "@dokploy/server/services/patch"; import { describe, expect, it, afterEach } from "vitest"; import { mkdtemp, rm, writeFile, readFile } from "node:fs/promises"; @@ -23,16 +22,18 @@ describe("Patch System Integration", () => { tempDir = await mkdtemp(join(tmpdir(), "dokploy-patch-test-")); const fileName = "test.txt"; const filePath = join(tempDir, fileName); - + await execAsyncLocal("git init", { cwd: tempDir }); - await execAsyncLocal("git config user.email 'test@test.com'", { cwd: tempDir }); + await execAsyncLocal("git config user.email 'test@test.com'", { + cwd: tempDir, + }); await execAsyncLocal("git config user.name 'Test'", { cwd: tempDir }); - + // Original content await writeFile(filePath, "line1\nline2\n"); await execAsyncLocal(`git add ${fileName}`, { cwd: tempDir }); await execAsyncLocal("git commit -m 'init'", { cwd: tempDir }); - + // Generate patch (modify content) const newContent = "line1\nline2\nline3\n"; const patchContent = await generatePatch({ @@ -41,7 +42,7 @@ describe("Patch System Integration", () => { newContent, serverId: null, }); - + // Verify patch format expect(patchContent.endsWith("\n")).toBe(true); @@ -49,20 +50,22 @@ describe("Patch System Integration", () => { await execAsyncLocal("git checkout .", { cwd: tempDir }); const savedContent = await readFile(filePath, "utf-8"); expect(savedContent).toBe("line1\nline2\n"); - + // Apply patch verification // We simulate what Deployment Service does: write patch to file and run git apply const patchFile = join(tempDir, "changes.patch"); await writeFile(patchFile, patchContent); - + try { - await execAsyncLocal(`git apply --whitespace=fix ${patchFile}`, { cwd: tempDir }); + await execAsyncLocal(`git apply --whitespace=fix ${patchFile}`, { + cwd: tempDir, + }); } catch (e: any) { console.error("Git apply failed:", e.message); console.log("Patch content:", JSON.stringify(patchContent)); throw e; } - + const appliedContent = await readFile(filePath, "utf-8"); expect(appliedContent).toBe(newContent); }); @@ -72,17 +75,19 @@ describe("Patch System Integration", () => { tempDir = await mkdtemp(join(tmpdir(), "dokploy-patch-test-noline-")); const fileName = "noline.txt"; const filePath = join(tempDir, fileName); - + await execAsyncLocal("git init", { cwd: tempDir }); - await execAsyncLocal("git config user.email 'test@test.com'", { cwd: tempDir }); + await execAsyncLocal("git config user.email 'test@test.com'", { + cwd: tempDir, + }); await execAsyncLocal("git config user.name 'Test'", { cwd: tempDir }); - + // Original content WITHOUT newline await writeFile(filePath, "line1"); await execAsyncLocal(`git add ${fileName}`, { cwd: tempDir }); await execAsyncLocal("git commit -m 'init'", { cwd: tempDir }); - - // Generate patch + + // Generate patch const newContent = "line1\nline2"; const patchContent = await generatePatch({ codePath: tempDir, @@ -93,13 +98,15 @@ describe("Patch System Integration", () => { // Verify patch format expect(patchContent.endsWith("\n")).toBe(true); - + // Apply patch const patchFile = join(tempDir, "changes.patch"); await writeFile(patchFile, patchContent); - - await execAsyncLocal(`git apply --whitespace=fix ${patchFile}`, { cwd: tempDir }); - + + await execAsyncLocal(`git apply --whitespace=fix ${patchFile}`, { + cwd: tempDir, + }); + const appliedContent = await readFile(filePath, "utf-8"); expect(appliedContent).toBe(newContent); }); diff --git a/apps/dokploy/components/dashboard/application/patches/patch-editor.tsx b/apps/dokploy/components/dashboard/application/patches/patch-editor.tsx index bd7e6e83a..f99022d04 100644 --- a/apps/dokploy/components/dashboard/application/patches/patch-editor.tsx +++ b/apps/dokploy/components/dashboard/application/patches/patch-editor.tsx @@ -1,9 +1,22 @@ -import { ArrowLeft, ChevronRight, File, Folder, Loader2, Save } from "lucide-react"; +import { + ArrowLeft, + ChevronRight, + File, + Folder, + Loader2, + Save, +} from "lucide-react"; import { useCallback, useState } from "react"; import { toast } from "sonner"; import { CodeEditor } from "@/components/shared/code-editor"; import { Button } from "@/components/ui/button"; -import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card"; +import { + Card, + CardContent, + CardDescription, + CardHeader, + CardTitle, +} from "@/components/ui/card"; import { ScrollArea } from "@/components/ui/scroll-area"; import { api } from "@/utils/api"; import type { RouterOutputs } from "@/utils/api"; @@ -31,7 +44,9 @@ export const PatchEditor = ({ const [selectedFile, setSelectedFile] = useState(null); const [fileContent, setFileContent] = useState(""); const [originalContent, setOriginalContent] = useState(""); - const [expandedFolders, setExpandedFolders] = useState>(new Set()); + const [expandedFolders, setExpandedFolders] = useState>( + new Set(), + ); const [isSaving, setIsSaving] = useState(false); // Fetch directory tree diff --git a/apps/dokploy/components/dashboard/application/patches/show-patches.tsx b/apps/dokploy/components/dashboard/application/patches/show-patches.tsx index e42269886..72f98820a 100644 --- a/apps/dokploy/components/dashboard/application/patches/show-patches.tsx +++ b/apps/dokploy/components/dashboard/application/patches/show-patches.tsx @@ -1,9 +1,23 @@ -import { AlertCircle, ChevronRight, File, Folder, Loader2, Power, Trash2 } from "lucide-react"; +import { + AlertCircle, + ChevronRight, + File, + Folder, + Loader2, + Power, + Trash2, +} from "lucide-react"; import { useState } from "react"; import { toast } from "sonner"; import { Alert, AlertDescription, AlertTitle } from "@/components/ui/alert"; import { Button } from "@/components/ui/button"; -import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card"; +import { + Card, + CardContent, + CardDescription, + CardHeader, + CardTitle, +} from "@/components/ui/card"; import { Switch } from "@/components/ui/switch"; import { Table, @@ -136,8 +150,8 @@ export const ShowPatches = ({ applicationId, composeId }: Props) => {
Patches - Apply code patches to your repository during build. Patches are applied after - cloning the repository and before building. + Apply code patches to your repository during build. Patches are + applied after cloning the repository and before building.