Commit Graph
12 Commits
Author SHA1 Message Date
27db6ef197 fix: create each store bucket lock only once
The per-bucket lock was inserted without synchronization. Two first
writers could take different locks and overwrite each other's preset
file. Lock creation now happens under a guard lock.

Co-authored-by: AE <by-ae@users.noreply.github.com>
Co-authored-by: Cursor Agent <cursoragent@cursor.com>
2026-10-26 21:11:37 +00:00
84bd2a4cda test: stop store tests from writing fixtures into the repo
test_store replaced the folder_paths mock after store.py had imported it.
Route tests then configured the replacement, and store writes went to a
MagicMock path that had been committed. Both suites now share the mock
from conftest and land files in a temp directory.

Co-authored-by: AE <by-ae@users.noreply.github.com>
Co-authored-by: Cursor Agent <cursoragent@cursor.com>
2026-10-26 21:10:54 +00:00
f87d64c3b1 fix: keep saved scene layout when adding it to the canvas
Additive scene load nudged each region further than the one before it, so
a saved composition was sheared. Every region now moves by the same offset
and is clamped back inside the canvas.

Co-authored-by: AE <by-ae@users.noreply.github.com>
Co-authored-by: Cursor Agent <cursoragent@cursor.com>
2026-10-26 21:10:03 +00:00
a35ebb7d3f fix: keep color palettes inside the Ideogram 4 caption schema
The caption verifier accepts only uppercase #RRGGBB, at most 16 style
colors and 5 per element. Shorthand #RGB is expanded, other values are
dropped, and a null palette no longer crashes prompt assembly.

Co-authored-by: AE <by-ae@users.noreply.github.com>
Co-authored-by: Cursor Agent <cursoragent@cursor.com>
2026-10-26 21:08:32 +00:00
6a050339f7 fix: normalize inverted and non-numeric Ideogram bboxes
Pasted captions with swapped or non-numeric bbox values produced negative
or NaN regions, so the editor could not select them. Coordinates are now
swapped and clamped to the 0-1000 range from the Ideogram 4 caption schema,
and unreadable bboxes keep the non-overlapping grid slot for that element.
Saved regions with NaN coordinates are dropped on restore.

Co-authored-by: AE <by-ae@users.noreply.github.com>
Co-authored-by: Cursor Agent <cursoragent@cursor.com>
2026-10-26 21:07:29 +00:00
42bdd7eaf3 fix: report background image save failures in the console
Preview BG Update logged save and notify failures only when BG_DEBUG was
set, so the console stayed quiet while the README told users to look there.
Warnings now print for a missing image, an empty or invalid guid, a tensor
that cannot be converted, a disk write error, and a failed editor push.

Co-authored-by: AE <by-ae@users.noreply.github.com>
Co-authored-by: Cursor Agent <cursoragent@cursor.com>
2026-10-26 21:05:18 +00:00
by-aeandCursor Agent 924e4908b4 fix: prevent region overlap when bbox is missing
When importing captions with missing/invalid bbox data, elements are now
arranged in a 4-column grid (row/column layout) instead of a diagonal
pattern that overlapped after 6 elements.

- Change fallback positioning from modulo-6 diagonal to row/column grid
- Update both Python backend and JavaScript editor
- Add comprehensive test for 12+ elements with no overlap
- Fixes visual collision when pasting captions with many unbounded regions

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
2026-10-25 20:59:42 +00:00
by-aeandCursor Agent c5ec465cd7 fix: add input validation and payload size limits to HTTP routes
- Add MAX_PAYLOAD_SIZE constant (10 MB) to prevent memory exhaustion
- Validate store names against path traversal and special characters in routes layer (defense in depth)
- Check Content-Length header and body size before processing
- Return HTTP 413 for oversized payloads
- Add comprehensive test coverage for validation edge cases

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
2026-10-25 20:57:26 +00:00
by-aeandCursor Agent 3a1dcd649d fix: support Unicode names and prevent concurrent write corruption in store
- Allow Unicode letters/numbers in preset names (e.g. 角色, Персонаж, Émilie)
- Add thread-safe locking per bucket to prevent race conditions during concurrent writes
- Use mkstemp() for atomic temp file creation to avoid tmp file name collisions
- Add tests demonstrating the bugs and verifying the fixes

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
2026-10-24 20:52:01 +00:00
by-aeandCursor Agent 048e0110c8 test: add coverage for corrupt file handling and DELETE endpoint
- Test corrupt JSON creates backup and returns empty bucket
- Test corrupt file does not affect other buckets
- Test save works after corrupt file recovery
- Test DELETE success, 404 not found, invalid bucket/name 400
- All existing tests continue to pass

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
2026-10-24 09:56:58 +00:00
by-aeandCursor Agent 223ec7e15b Add comprehensive test coverage for routes and nodes
Tests cover:
- routes.py: Input validation, path traversal protection, JSON
  error handling, GUID sanitization (12 new tests)
- nodes/ideogram4_nodes.py: Prompt assembly, bbox normalization,
  palette handling, JSON serialization, input coercion (28 new tests)

All tests use mocks via conftest.py to avoid ComfyUI dependencies.
Tests import the repo as a proper package so routes.py relative
imports work unchanged.

CI: Install aiohttp for route tests.

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
2026-10-23 21:16:56 +00:00
by-aeandCursor Agent 71cccd9504 Add comprehensive unit tests for store module
Implement 10 unit tests covering:
- Name validation (valid and invalid patterns)
- Save, load, and delete operations
- Multiple entries and overwrites
- Empty buckets and non-existent entries
- Invalid bucket names
- Persistence across reloads

Tests use unittest (stdlib) and mock folder_paths dependency,
ensuring the store logic is reliable without ComfyUI runtime.

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
2026-10-22 21:51:16 +00:00