fix: resolve host-relative follow-up links against the origin, not base_url#17
fix: resolve host-relative follow-up links against the origin, not base_url#17sundar-svg wants to merge 6 commits into
Conversation
…se_url
A serverless gateway serves the v2 contract under /deployment/{id}/api/v2 and
returns job.urls.* links that already include that mount prefix. Resolving
them against base_url (which carries the same prefix) doubled it and 404'd
every poll after submit. Follow-up links (leading slash + containing /api/)
now resolve against scheme+authority; internal shorthand paths and Cloud /
self-hosted behavior are byte-identical to before.
Adds unit regression tests and an env-gated live integration suite
(tests/integration/test_gateway_e2e.py) that exercises upload → dedup
fast-path → img2img submit → poll → output download against a real gateway
deployment; the asset-handle case is xfail until the gateway resolves
core/ASSET references.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KV7wUb2hyzKHsR52ZJTvAm
|
Warning Review limit reached
Next review available in: 32 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (3)
Warning
|
| Layer / File(s) | Summary |
|---|---|
Follow-up URL resolution src/comfy_low/transport.py, tests/test_follow_up_links.py |
_Prepared resolves deployment-scoped API paths against the origin, preserves internal /api/v2 expansion, passes through absolute URLs, and retains authorization headers. |
Gateway image-edit test foundation tests/integration/test_gateway_e2e.py |
Adds environment-gated configuration, deterministic PNG generation, an SD1.5 img2img workflow, and fixtures for the client and committed input asset. |
Image-edit execution validation tests/integration/test_gateway_e2e.py |
Tests upload deduplication and filename-based image editing, including polling and PNG output checks; direct asset-handle input remains explicitly xfailed. |
🚥 Pre-merge checks | ✅ 2
✅ Passed checks (2 passed)
| Check name | Status | Explanation |
|---|---|---|
| Linked Issues check | ✅ Passed | Check skipped because no linked issues were found for this pull request. |
| Out of Scope Changes check | ✅ Passed | Check skipped because no linked issues were found for this pull request. |
✨ Finishing Touches
🧪 Generate unit tests (beta)
- Create PR with unit tests
- Commit unit tests in branch
sundar/host-relative-follow-up-links
✨ Simplify code
- Create PR with simplified code
- Commit simplified code in branch
sundar/host-relative-follow-up-links
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.
Comment @coderabbitai help to get the list of available commands.
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@tests/integration/test_gateway_e2e.py`:
- Line 79: Wrap the long dictionary entries in the workflow data near the
entries keyed "5" and the corresponding entry at line 96 to satisfy Ruff’s
100-character E501 limit, preserving each key, value, and nested structure
exactly.
- Around line 131-133: Remove the arbitrary 10,000-byte length assertion from
the downloaded PNG validation in the gateway test. Keep the existing PNG
signature check and replace the size requirement with a minimal non-empty
payload assertion, preserving validation that data was actually returned.
- Around line 136-140: Update the pytest.mark.xfail configuration for the
gateway reference test to use strict=True instead of strict=False, while
preserving its existing reason and expected-failure behavior.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: 6f85814f-fe77-4e30-823c-d2b5a62c8c8e
📒 Files selected for processing (3)
src/comfy_low/transport.pytests/integration/test_gateway_e2e.pytests/test_follow_up_links.py
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KV7wUb2hyzKHsR52ZJTvAm
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KV7wUb2hyzKHsR52ZJTvAm
LoadImage -> ImageInvert -> SaveImage proves the same protocol surface as the img2img graph but runs on any deployment with nothing baked, in seconds; drops the COMFY_CKPT_NAME knob. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KV7wUb2hyzKHsR52ZJTvAm
Default stays the model-free core-node graph; an override supplies any API-format workflow, whose first LoadImage node is rewired to the uploaded test input. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KV7wUb2hyzKHsR52ZJTvAm
An inverted gradient re-encoded with PNG row filters legitimately compresses to ~2KB; size thresholds are encoder trivia. Match the IHDR dimensions against the input instead. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KV7wUb2hyzKHsR52ZJTvAm
Description
First SDK↔gateway conformance bug, found (and now regression-locked) by running the SDK live against a staging serverless deployment.
The gateway serves the v2 contract under
/deployment/{id}/api/v2and returnsjob.urls.*follow-up links that are host-relative and already include that mount prefix — correct HTTP behavior._Prepared.url()only recognized links starting with/api/, so a gateway self link fell into the internal-shorthand branch and got built asbase_url + /api/v2 + link→ double prefix →NotFoundon the first poll after submit (Comfy(base_url).run(wf)submitted fine, then 404'd inJob.refresh()).Fix: a leading-slash path containing
/api/is a server-returned link and resolves against the origin (scheme+authority) — the link is authoritative about its own path. Internal shorthand paths (/jobs/…,/assets…) still resolve underbase_url + /api/v2, and Cloud / self-hosted construction is byte-identical to before (base_url == origin there). Auth attachment is unaffected (same origin).Also adds
tests/integration/test_gateway_e2e.py— an env-gated live e2e suite (skip unlessCOMFY_BASE_URL/COMFY_API_KEYare set) covering: multipart upload, blake3 dedup fast-path (HEAD by-hash→from-hash), img2img submit referencing the uploaded asset by name, adaptive poll to terminal, and output download via the content redirect. Thewf.set_input(node, field, asset)case isxfail: the gateway does not yet resolvecore/ASSETreferences (gap tracked on the cloud side).How tested
uv run pytest tests/— 97 passed (92 existing + 5 new URL-resolution regression tests)dep_9b63686e…(RTX 4090, SD1.5):2 passed, 1 xfailed in 23.60s— before the fix,test_image_edit_by_namefailed withNotFound: HTTP 404on refresh🤖 Generated with Claude Code
https://claude.ai/code/session_01KV7wUb2hyzKHsR52ZJTvAm