Compare commits

..
Author SHA1 Message Date
Vito Sansevero 706aaed432 fix(tests): the pool-reuse test makes its first job run on both threads
ThreadPoolExecutor starts threads lazily and skips a new one while another
is idle. The first job's tiny tasks could all run on worker 0 and leave
worker 1 to start in the second job, so second <= first failed although the
pool was reused (queue run 44169912829: first {worker_0}, second
{worker_1}). A two-party barrier now makes the first job run on both.
2026-11-17 12:48:57 -08:00
Vito Sansevero 926704ab94 fix(tests): shared-listing tests wait for the workspace cache build before teardown
A read that stores a listing starts the workspace cache build on a worker
thread, and cancelling its task at cleanup does not stop the thread. A test
that ended on that read could reach teardown while the thread opened a
database connection, and the leak check failed (queue run 44164234834,
py3.14). Teardown now stops new builds and waits for the running one. On
one busy CPU the test failed 8 of 60 runs before and 0 of 60 after.
2026-11-17 12:25:39 -08:00
Vito Sansevero aaac2cc3b2 fix(paths): Needs review and tagging take a backslash name too (#646)
Needs review built its own image entries without the POSIX mark, so Open
and Info still failed there for a name holding a backslash (Codex P2). The
review target now carries path_style like the Images listing, and imageOf
passes it on.

The capture store, which tagging and review read through, refused every
backslash; it now refuses one only on Windows. Before this, such a file
could not be tagged and never reached Needs review.
2026-11-17 11:34:55 -08:00
Vito Sansevero d91288738a fix(paths): a backslash inside a name works on Linux and macOS servers (#646)
On POSIX a backslash is an ordinary character, and a Windows-style
filename_prefix makes a folder whose name holds one. The listing named such
a file, but the workspace and the tag, favorite, collection, delete,
thumbnail and folder-filter routes refused it or split the name at the
backslash. Separators are now the server's own: / always, \ only on
Windows. Windows keeps every refusal it had.

The listing marks a path holding a backslash with path_style "posix", and
the workspace accepts the backslash only with that mark. Scan rows,
duplicate keys and the folder tree no longer turn \ into /, so a\b.png and
a/b.png stay two files.
2026-11-17 11:11:17 -08:00
5 changed files with 7 additions and 40 deletions
+1 -2
View File
@@ -103,7 +103,7 @@ Pick an open ComfyUI window and a node, then review the exact before and after.
### Deletes you can review
Choose what happens to the files before anything is removed: remove the image from the library and leave the file on disk, or on Linux and macOS also move it to the system trash. On a Linux or BSD server you can also delete the files permanently, for headless servers where a trash only fills up the disk; those files can't be recovered. On Windows, images can only be removed from the library. A safety backup of the database is on by default, and removed images can be brought back.
Choose what happens to the files before anything is removed: remove the image from the library and leave the file on disk, or on Linux and macOS also move it to the system trash. On Windows, images can only be removed from the library. A safety backup of the database is on by default, and removed images can be brought back.
![Delete dialog offering to remove from the library only or move files to the trash](assets/readme/delete-review.webp)
@@ -230,7 +230,6 @@ The documentation for those pages is in [README-legacy.md](README-legacy.md).
## Known limits
- **Trash is Linux and macOS only.** Windows has no Recycle Bin option, because the bin can delete large files permanently without warning. On Windows you can only remove an image from the library, and the file stays on disk. Where a move to the trash isn't possible on Linux or macOS, the dialog lists why for each file.
- **Permanent delete is Linux and BSD only,** and can't be undone. The safety backup brings back the library records, not the files.
- **Show in folder** opens the file manager on the machine running ComfyUI, not necessarily the one with your browser.
- **Returned images** get their prompt links back, but not their tags, categories, collections or favorites.
- **Inspect a file** doesn't add the file to your library.
+1 -7
View File
@@ -290,7 +290,7 @@ class ImageDeleteMixin:
acted.append(target)
counted = db.count_removal_records([t["removal"] for t in acted])
library_count = len(acted)
permanent_supported = permanent_delete_supported()
permanent_supported = isinstance(trash.BACKEND, trash.FreedesktopBackend)
public = {
"operation": IMAGE_DELETE,
"scope": {"count": library_count, "label": "images"},
@@ -570,12 +570,6 @@ class ImageDeleteMixin:
return [path for path in paths if not removed(path)]
def permanent_delete_supported() -> bool:
"""Permanent delete is offered only with the Freedesktop trash backend
(Linux/BSD servers); the review and the apply both ask here (#644)."""
return isinstance(trash.BACKEND, trash.FreedesktopBackend)
def parse_mode(value):
"""The apply's ``mode``, or None when it is not one of MODES."""
return value if isinstance(value, str) and value in MODES else None
+2 -7
View File
@@ -516,7 +516,7 @@ class MaintenanceRoutesMixin:
# ── apply ─────────────────────────────────────────────────────────
async def apply_maintenance_plan(self, request):
from .image_delete import IMAGE_DELETE, parse_mode, permanent_delete_supported
from .image_delete import IMAGE_DELETE, parse_mode
data, error = await self._read_maintenance_body(request, ("token", "mode"))
if error is not None:
@@ -531,12 +531,7 @@ class MaintenanceRoutesMixin:
if plan.operation == IMAGE_DELETE:
mode = parse_mode(data.get("mode"))
if mode is None:
return _invalid('mode must be "library", "trash" or "permanent"')
if mode == "permanent" and not permanent_delete_supported():
# The review never offers it here; refuse a direct call (#644).
return _invalid(
"Permanent delete is only available on Linux and BSD servers"
)
return _invalid('mode must be "library" or "trash"')
elif "mode" in data:
return _invalid("Unknown field: mode")
store = self._maintenance_plans
+1 -1
View File
@@ -1,7 +1,7 @@
[project]
name = "promptmanager"
description = "A powerful ComfyUI custom node that extends the standard text encoder with persistent prompt storage, advanced search capabilities, and an automatic image gallery system using SQLite."
version = "3.7.0"
version = "3.6.0"
license = {file = "LICENSE"}
requires-python = ">=3.12"
dependencies = ["watchdog>=2.1.0", "Pillow>=10.1.0"]
+2 -23
View File
@@ -428,31 +428,10 @@ class TestPermanentMode(ImageDeleteTestCase):
else:
self.assertFalse(plan.get("permanent_delete_supported"))
async def test_permanent_is_refused_where_the_review_does_not_offer_it(self):
"""#644: without the Freedesktop backend the apply answers 400 for
"permanent" before any backup, and the file and its records stay."""
from utils import trash
fake_trash.uninstall()
self.addCleanup(fake_trash.uninstall)
self.write("a.png", b"aaa", mtime=1_000_000)
self.link("a.png")
with patch.object(trash, "BACKEND", trash.UnavailableBackend()):
plan = await self.review(["a.png"])
self.assertFalse(plan["permanent_delete_supported"])
with patch("os.remove") as remove:
body = await self.post(
APPLY, {"token": plan["token"], "mode": "permanent"}, 400
)
remove.assert_not_called()
self.assertIn("Linux", body["error"])
self.assertTrue((self.output_dir / "a.png").exists())
self.assertEqual(self.count("SELECT COUNT(*) FROM generated_images"), 1)
async def test_permanent_delete_removes_the_file(self):
fake_trash.uninstall()
self.addCleanup(fake_trash.uninstall)
if not image_delete.permanent_delete_supported():
if sys.platform == "win32":
self.skipTest("permanent delete is Linux/BSD only")
self.write("a.png", b"aaa", mtime=1_000_000)
self.link("a.png")
@@ -474,7 +453,7 @@ class TestPermanentMode(ImageDeleteTestCase):
fake_trash.uninstall()
self.addCleanup(fake_trash.uninstall)
if not image_delete.permanent_delete_supported():
if sys.platform == "win32":
self.skipTest("permanent delete is Linux/BSD only")
self.write("a.png", b"aaa", mtime=1_000_000)
self.link("a.png")