[PR #12] [MERGED] feat(serialization): tighten batch dispatch + accept response-side batch URIs #13

Closed
opened 2026-10-26 22:28:54 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Comfy-Org/comfy-remote-nodes/pull/12
Author: @Kosinkadink
Created: 5/15/2026
Status: ✅ Merged
Merged: 5/15/2026
Merged by: @Kosinkadink

Base: main ← Head: feat/batch-uri-followups


📝 Commits (1)

  • 35b8a3b feat(serialization): tighten batch dispatch + accept response-side batch URIs

📊 Changes

3 files changed (+420 additions, -4 deletions)

View changed files

➕ notes/run_batch_uri_followups.py (+352 -0)
📝 proxy_node.py (+48 -2)
📝 serialization.py (+20 -2)

📄 Description

Follow-up #2 / #3 / #4 to PRs #9 (feat/batch-envelope-externalization) and #10 (feat/image-max-batch-rule).

Three small cleanups identified during the post-PR review pass:

1. Encoding-keyed dispatch in maybe_externalize

The batch branch now keys off encoding == "png_base64_batch" instead of the presence of a frames field. The old isinstance(frames, list) and frames heuristic would silently take the batch path on a malformed envelope that mixed both fields and externalise garbage under a non-batch encoding.

2. Empty frames=[] is now a hard error

An empty / missing frames list on a png_base64_batch envelope raises RnpProtocolError(INTERNAL) rather than silently no-op-ing through to the wire (where the server's resolve_image_envelope_pngs rejects it after the round trip anyway). Mirrors the server-side make_image_batch_envelope contract: an empty batch is a hard wire bug.

3. Response-side png_base64_batch_uri decoder

proxy_node._deserialize_output now accepts the externalised batch shape on the response path. No server emits this shape today — this is purely future-proofing the symmetric counterpart of the request-side externalisation. The decoder owns the symmetry: any envelope shape the client may externalise on the way out, the client must also accept on the way in.

Per-frame URIs are fetched in parallel via asyncio.gather so a 9-frame batch import is one round-trip rather than N. Frame ordering is preserved (gather returns positional results) — the IMAGE tensor's batch axis carries semantic order. Fetched bytes are re-stamped as inline frames so the existing _decode_image_batch_envelope path handles them uniformly.

Verification

New smoke notes/run_batch_uri_followups.py exercises all three changes (encoding-keyed dispatch, empty-frames hard-error, response-side batch URI parallel fetch + ordering):

$ python notes/run_batch_uri_followups.py
PASS: maybe_externalize dispatches on encoding + rejects empty frames; _deserialize_output handles png_base64_batch_uri in parallel

Existing notes/run_image_max_batch.py still passes.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Comfy-Org/comfy-remote-nodes/pull/12 **Author:** [@Kosinkadink](https://github.com/Kosinkadink) **Created:** 5/15/2026 **Status:** ✅ Merged **Merged:** 5/15/2026 **Merged by:** [@Kosinkadink](https://github.com/Kosinkadink) **Base:** `main` ← **Head:** `feat/batch-uri-followups` --- ### 📝 Commits (1) - [`35b8a3b`](https://github.com/Comfy-Org/comfy-remote-nodes/commit/35b8a3b17f1754f4af010768091c8cfa69b863be) feat(serialization): tighten batch dispatch + accept response-side batch URIs ### 📊 Changes **3 files changed** (+420 additions, -4 deletions) <details> <summary>View changed files</summary> ➕ `notes/run_batch_uri_followups.py` (+352 -0) 📝 `proxy_node.py` (+48 -2) 📝 `serialization.py` (+20 -2) </details> ### 📄 Description Follow-up #2 / #3 / #4 to PRs #9 (`feat/batch-envelope-externalization`) and #10 (`feat/image-max-batch-rule`). Three small cleanups identified during the post-PR review pass: ## 1. Encoding-keyed dispatch in `maybe_externalize` The batch branch now keys off `encoding == "png_base64_batch"` instead of the presence of a `frames` field. The old `isinstance(frames, list) and frames` heuristic would silently take the batch path on a malformed envelope that mixed both fields and externalise garbage under a non-batch encoding. ## 2. Empty `frames=[]` is now a hard error An empty / missing `frames` list on a `png_base64_batch` envelope raises `RnpProtocolError(INTERNAL)` rather than silently no-op-ing through to the wire (where the server's `resolve_image_envelope_pngs` rejects it after the round trip anyway). Mirrors the server-side `make_image_batch_envelope` contract: an empty batch is a hard wire bug. ## 3. Response-side `png_base64_batch_uri` decoder `proxy_node._deserialize_output` now accepts the externalised batch shape on the response path. **No server emits this shape today** — this is purely future-proofing the symmetric counterpart of the request-side externalisation. The decoder owns the symmetry: any envelope shape the client may externalise on the way out, the client must also accept on the way in. Per-frame URIs are fetched in parallel via `asyncio.gather` so a 9-frame batch import is one round-trip rather than N. Frame ordering is preserved (gather returns positional results) — the IMAGE tensor's batch axis carries semantic order. Fetched bytes are re-stamped as inline `frames` so the existing `_decode_image_batch_envelope` path handles them uniformly. ## Verification New smoke `notes/run_batch_uri_followups.py` exercises all three changes (encoding-keyed dispatch, empty-frames hard-error, response-side batch URI parallel fetch + ordering): ``` $ python notes/run_batch_uri_followups.py PASS: maybe_externalize dispatches on encoding + rejects empty frames; _deserialize_output handles png_base64_batch_uri in parallel ``` Existing `notes/run_image_max_batch.py` still passes. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-26 22:28:54 +00:00
Sign in to join this conversation.
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Comfy-Org/comfy-remote-nodes#13
No description provided.