Skip to content

Conversation

@benceruleanlu
Copy link
Member

@benceruleanlu benceruleanlu commented Jan 19, 2026

Verify ComfyUI creates its database after install

Desktop relies on the ComfyUI backend to initialize comfyui.db; when this fails (e.g., read-only path regressions like #1532), /object_info can 500 and the UI stays on the loading screen. Add an install e2e check that waits for the DB file in the install user directory, confirms it is non-empty, and then requests /object_info after the app loads. This is an integration-level guardrail; it does not validate schema contents, only that the DB is created and the endpoint is healthy.

Summary by CodeRabbit

  • Tests
    • Enhanced post-installation validation to verify database creation and server readiness.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link

coderabbitai bot commented Jan 19, 2026

📝 Walkthrough

Walkthrough

The PR modifies an installation integration test to enhance post-install validation. It updates the test signature to access the window object and adds verification for database file creation and live endpoint response validation alongside existing UI state checks.

Changes

Cohort / File(s) Summary
Installation test validation enhancement
tests/integration/install/installApp.spec.ts
Added imports for file system operations (stat, path, pathExists). Updated test function signature to include window parameter. Implemented post-install validation that waits for ComfyUI DB file creation, polls for non-zero file size, performs HTTP GET request to /object_info endpoint, and validates server response. Maintains existing UI state assertions (firstTimeTemplateWorkflowText, templatesGrid).

Possibly related PRs

Suggested reviewers

  • AustinMroz

Poem

🐰 A database file waits to be born,
The endpoint responds, no need to mourn,
Window peeks in with a curious glance,
Post-install checks get their second dance,
Validation complete, the test stands tall! ✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: verifying ComfyUI database file creation after installation.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@benceruleanlu benceruleanlu marked this pull request as ready for review January 19, 2026 19:10
@benceruleanlu benceruleanlu requested a review from a team as a code owner January 19, 2026 19:10
Copilot AI review requested due to automatic review settings January 19, 2026 19:10
@dosubot dosubot bot added size:S This PR changes 10-29 lines, ignoring generated files. bug Something isn't working labels Jan 19, 2026
@coderabbitai coderabbitai bot requested a review from AustinMroz January 19, 2026 19:10
@benceruleanlu
Copy link
Member Author

This test succeeded, CI is red from an existing bad expectation, to be fixed in #1536

@benceruleanlu
Copy link
Member Author

image

Logs are green as well, API check succeeded.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds integration testing to verify that the ComfyUI database (comfyui.db) is properly created during installation. The test helps catch regressions where the database creation fails (e.g., due to read-only path issues), which would cause the /object_info endpoint to fail and leave the UI stuck on a loading screen.

Changes:

  • Add database file existence and size validation to the install integration test
  • Add API health check for the /object_info endpoint after installation completes

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

await expect(installedApp.templatesGrid).toBeVisible({ timeout: 30 * 1000 });

const dbPath = path.join(testEnvironment.installLocation.path, 'user', 'comfyui.db');
await expect.poll(async () => await pathExists(dbPath), { timeout: 30 * 1000 }).toBe(true);
Copy link

Copilot AI Jan 19, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The double await is redundant. Since pathExists already returns a Promise, the inner await is unnecessary. Consider simplifying to: async () => pathExists(dbPath)

Suggested change
await expect.poll(async () => await pathExists(dbPath), { timeout: 30 * 1000 }).toBe(true);
await expect.poll(async () => pathExists(dbPath), { timeout: 30 * 1000 }).toBe(true);

Copilot uses AI. Check for mistakes.
.toBeGreaterThan(0);
const appUrl = new URL(window.url());
const response = await window.request.get(`${appUrl.origin}/object_info`);
expect(response.ok()).toBe(true);
Copy link

Copilot AI Jan 19, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Playwright provides a more idiomatic assertion for checking response status. Consider using expect(response).toBeOK() instead of expect(response.ok()).toBe(true) for better readability and consistency with Playwright best practices.

Suggested change
expect(response.ok()).toBe(true);
await expect(response).toBeOK();

Copilot uses AI. Check for mistakes.
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@tests/integration/install/installApp.spec.ts`:
- Around line 42-59: The test currently calls
window.request.get(`${appUrl.origin}/object_info`) once which can race with
backend readiness; replace that single request with a polling check using
expect.poll to repeatedly call window.request.get or a small helper that fetches
`${appUrl.origin}/object_info` and returns response.ok(), waiting until it
returns true (or a timeout) before asserting; update the block that follows the
DB size check (references: dbPath, pathExists, stat, appUrl, window.request.get,
/object_info) so the test only proceeds when the endpoint responds successfully.

Comment on lines +42 to +59
const dbPath = path.join(testEnvironment.installLocation.path, 'user', 'comfyui.db');
await expect.poll(async () => await pathExists(dbPath), { timeout: 30 * 1000 }).toBe(true);
await expect
.poll(
async () => {
try {
const fileStat = await stat(dbPath);
return fileStat.size;
} catch {
return 0;
}
},
{ timeout: 30 * 1000 }
)
.toBeGreaterThan(0);
const appUrl = new URL(window.url());
const response = await window.request.get(`${appUrl.origin}/object_info`);
expect(response.ok()).toBe(true);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

find tests/integration -name "installApp.spec.ts" -type f

Repository: Comfy-Org/desktop

Length of output: 105


🏁 Script executed:

fd installApp.spec.ts tests/integration

Repository: Comfy-Org/desktop

Length of output: 161


🏁 Script executed:

git ls-files tests/integration | head -20

Repository: Comfy-Org/desktop

Length of output: 1566


🏁 Script executed:

cat -n tests/integration/install/installApp.spec.ts | sed -n '35,70p'

Repository: Comfy-Org/desktop

Length of output: 1213


🏁 Script executed:

wc -l tests/integration/install/installApp.spec.ts

Repository: Comfy-Org/desktop

Length of output: 108


🏁 Script executed:

grep -r "object_info" tests/integration --include="*.ts" -B 2 -A 2

Repository: Comfy-Org/desktop

Length of output: 477


🏁 Script executed:

grep -r "window.request.get" tests/integration --include="*.ts" -B 2 -A 2 | head -40

Repository: Comfy-Org/desktop

Length of output: 477


🏁 Script executed:

grep -r "expect.poll" tests/integration --include="*.ts" -A 5 | head -60

Repository: Comfy-Org/desktop

Length of output: 543


🏁 Script executed:

cat -n tests/integration/install/installApp.spec.ts | sed -n '1,40p'

Repository: Comfy-Org/desktop

Length of output: 1978


🏁 Script executed:

grep -r "response.dispose()" tests/integration --include="*.ts" -B 2 -A 2 | head -30

Repository: Comfy-Org/desktop

Length of output: 43


🏁 Script executed:

grep -r "window.request" tests/integration --include="*.ts" | wc -l

Repository: Comfy-Org/desktop

Length of output: 62


🏁 Script executed:

grep -r "\.dispose()" tests/integration --include="*.ts"

Repository: Comfy-Org/desktop

Length of output: 43


🏁 Script executed:

grep -r "request\\.get\\|request\\.post" tests/integration --include="*.ts" -A 3

Repository: Comfy-Org/desktop

Length of output: 367


🏁 Script executed:

cat -n tests/integration/testExtensions.ts | head -50

Repository: Comfy-Org/desktop

Length of output: 2317


🏁 Script executed:

cd tests/integration && grep -r "await response" --include="*.ts"

Repository: Comfy-Org/desktop

Length of output: 43


🏁 Script executed:

grep -r "APIResponse" tests/integration --include="*.ts"

Repository: Comfy-Org/desktop

Length of output: 43


🏁 Script executed:

cat -n tests/integration/testExtensions.ts | sed -n '30,100p'

Repository: Comfy-Org/desktop

Length of output: 3172


🏁 Script executed:

grep -r "APIResponse\|response\\.ok\|window\\.request" tests --include="*.ts" --include="*.js"

Repository: Comfy-Org/desktop

Length of output: 267


🏁 Script executed:

grep -r "waitUntilLoaded" tests/integration --include="*.ts" -A 3 -B 1

Repository: Comfy-Org/desktop

Length of output: 2038


🏁 Script executed:

cat -n tests/integration/testInstalledApp.ts | head -100

Repository: Comfy-Org/desktop

Length of output: 1333


🏁 Script executed:

grep -r "Playwright\|APIResponse" tests --include="*.ts" --include="*.json" | head -20

Repository: Comfy-Org/desktop

Length of output: 922


🏁 Script executed:

grep -r "response\\.dispose\|response\\.status\|response\\.text\|response\\.json" tests --include="*.ts"

Repository: Comfy-Org/desktop

Length of output: 43


🏁 Script executed:

cat -n tests/integration/install/installApp.spec.ts | sed -n '55,61p'

Repository: Comfy-Org/desktop

Length of output: 313


🏁 Script executed:

grep -r "expectLoaded\|graphCanvas" tests/integration/testGraphCanvas.ts -A 5 -B 1

Repository: Comfy-Org/desktop

Length of output: 350


🏁 Script executed:

git log --oneline tests/integration/install/installApp.spec.ts | head -10

Repository: Comfy-Org/desktop

Length of output: 115


🏁 Script executed:

grep -r "object_info\|backend\|server.*ready" tests/integration --include="*.md"

Repository: Comfy-Org/desktop

Length of output: 43


Stabilize /object_info check with polling to avoid flakiness.
UI readiness (canvas visible, spinner hidden) doesn't guarantee the backend endpoint is accepting requests yet, creating a potential race condition.

🔧 Suggested stabilization using expect.poll
     const dbPath = path.join(testEnvironment.installLocation.path, 'user', 'comfyui.db');
     await expect.poll(async () => await pathExists(dbPath), { timeout: 30 * 1000 }).toBe(true);
     await expect
       .poll(
         async () => {
           try {
             const fileStat = await stat(dbPath);
             return fileStat.size;
           } catch {
             return 0;
           }
         },
         { timeout: 30 * 1000 }
       )
       .toBeGreaterThan(0);
     const appUrl = new URL(window.url());
-    const response = await window.request.get(`${appUrl.origin}/object_info`);
-    expect(response.ok()).toBe(true);
+    await expect
+      .poll(
+        async () => {
+          const response = await window.request.get(`${appUrl.origin}/object_info`);
+          const ok = response.ok();
+          await response.dispose();
+          return ok;
+        },
+        { timeout: 30 * 1000 }
+      )
+      .toBe(true);
🤖 Prompt for AI Agents
In `@tests/integration/install/installApp.spec.ts` around lines 42 - 59, The test
currently calls window.request.get(`${appUrl.origin}/object_info`) once which
can race with backend readiness; replace that single request with a polling
check using expect.poll to repeatedly call window.request.get or a small helper
that fetches `${appUrl.origin}/object_info` and returns response.ok(), waiting
until it returns true (or a timeout) before asserting; update the block that
follows the DB size check (references: dbPath, pathExists, stat, appUrl,
window.request.get, /object_info) so the test only proceeds when the endpoint
responds successfully.

@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Jan 19, 2026
@christian-byrne christian-byrne merged commit b1614a1 into main Jan 19, 2026
27 of 28 checks passed
@christian-byrne christian-byrne deleted the test/comfyui-db-create branch January 19, 2026 22:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working lgtm This PR has been approved by a maintainer size:S This PR changes 10-29 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants