Skip to content

test(templates): pin the starter list inside the mirrorable R2 namespace - #1452

Open
MaanilVerma wants to merge 1 commit into
Comfy-Org:mainfrom
MaanilVerma:feat/starter-templates-mirror-fallback
Open

test(templates): pin the starter list inside the mirrorable R2 namespace#1452
MaanilVerma wants to merge 1 commit into
Comfy-Org:mainfrom
MaanilVerma:feat/starter-templates-mirror-fallback

Conversation

@MaanilVerma

@MaanilVerma MaanilVerma commented Aug 25, 2026

Copy link
Copy Markdown
Collaborator

TL;DR: Tests only. Pins that the starter-templates document stays inside the R2 namespace, which is what lets restricted regions reach it through the GCS mirror.

Why: fetchJSON already retries the mirror on failure, so the starter list got that behaviour for free when it moved to R2. But it only works while the URL sits under R2_BASE_URLr2MirrorUrl returns undefined for anything else. That property lives in a string prefix, so a plausible refactor (own bucket, CDN alias) would cut those regions off with no failing test and no error.

What changed: two tests. One asserts the derived mirror URL, one asserts a rejected fetch still yields all sixteen built-in cards. No source file touched.

Separate ops gap: the file isn't on the mirror yet.

File Primary Mirror
latest.json 200 200
torch-index-stacks.json 200 200
starter-templates.json 200 404

Nothing is broken — those users fall back to the built-in list. But content changes stay invisible to them until it's synced. Needs Content-Type: application/json, or the client won't parse it and falls back the same silent way. Raised with @deepme987 .

Testing: mutation-checked — pointing STARTER_TEMPLATES_URL at a non-R2 host fails the namespace test, which is the refactor this exists to catch.

`fetchJSON` already retries the GCS mirror when the primary fails, which is how
regions with a throttled R2 edge reach our manifests. That only works while the
URL sits under `R2_BASE_URL`: `r2MirrorUrl` returns undefined for anything else,
so moving the document would cut those regions off with no failing test and no
visible error, just the built-in list forever.

Also pins the end state: with both legs unreachable the picker still renders all
sixteen built-in cards rather than an empty tab.

No production change. The remaining gap is operational, not code:
starter-templates.json is currently 404 on the mirror bucket while latest.json
and torch-index-stacks.json are both 200, so it needs adding to whatever keeps
the two in sync.
@coderabbitai

coderabbitai Bot commented Aug 25, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 06d2a225-fe48-451a-9524-e43a8a2d84d3

📥 Commits

Reviewing files that changed from the base of the PR and between 4a915fe and b2c4f67.

📒 Files selected for processing (1)
  • src/main/sources/standalone/remoteStarterTemplates.test.ts

Included review availability: Your plan provides up to 2 included reviews per hour; 1 remains after this review.


📝 Walkthrough

Walkthrough

Changes

Starter-template mirror coverage

Layer / File(s) Summary
Mirror URL and catalog fallback tests
src/main/sources/standalone/remoteStarterTemplates.test.ts
The tests verify R2 mirror URL mapping and fallback to the complete curated template catalog when fetches fail. A tidy test, with no URL folly.

Merge Risk: ⚪ Minimal · up to b2c4f

This test-only change adds coverage for starter-template mirror resolution and fallback behavior without changing production code. No actionable merge-blocking risk remains.

🚥 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
✨ Simplify code
  • Create PR with simplified code

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants