Skip to content

refactor: extract model download path helpers - #1302

Merged
benceruleanlu merged 2 commits into
mainfrom
bl/gtm-93-a-download-path-extraction
Jul 28, 2026
Merged

refactor: extract model download path helpers#1302
benceruleanlu merged 2 commits into
mainfrom
bl/gtm-93-a-download-path-extraction

Conversation

@benceruleanlu

@benceruleanlu benceruleanlu commented Jul 24, 2026

Copy link
Copy Markdown
Member

Split A of #1249.

Summary

  • Extract model download-path and filename helpers from comfyDownloadManager.ts.
  • Preserve compatibility through re-exports.
  • Update the template and standalone imports with no behavior change.

Stack

Split PR Base Release gate
A #1302 — download-path extraction main Normal
B #1303 — desktop login-code auth A Packaged RC
C #1304 — anonymous identity core B Normal
D #1305 — installer website-ID carrier C Packaged Windows RC
E #1306 — Firebase auth consensus D Packaged RC

Validation

  • pnpm run typecheck
  • pnpm run lint
  • pnpm run build
  • pnpm run test — 2,853 passed, 1 skipped

This mechanical slice can use the normal release path.

@coderabbitai

coderabbitai Bot commented Jul 24, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@benceruleanlu, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 45 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: e619513f-0d58-441e-953e-a6d9043c433b

📥 Commits

Reviewing files that changed from the base of the PR and between a1ebe29 and b9b9086.

📒 Files selected for processing (4)
  • src/main/lib/comfyDownloadManager.test.ts
  • src/main/lib/comfyDownloadManager.ts
  • src/main/sources/standalone/templateDownloadGate.test.ts
  • src/main/sources/standalone/templateDownloadTask.ts
📝 Walkthrough

Walkthrough

Model filename utilities and installation-aware model existence checks were moved into dedicated modules. ComfyDownloadManager now re-exports compatibility APIs, while standalone template handling uses static imports and dedicated filename utilities.

Changes

Model path resolution and template integration

Layer / File(s) Summary
Filename utility extraction
src/main/lib/downloadFilename.ts, src/main/lib/comfyDownloadManager.ts, src/main/sources/standalone/templateInputAssets.ts, src/main/sources/standalone/templateModels.ts
Allowed extensions and query-parameter stripping are centralized in downloadFilename, with compatibility re-exports retained.
Installation-aware model existence resolution
src/main/lib/modelDownloadPaths.ts, src/main/lib/comfyDownloadManager.ts
Model directories, legacy folder variants, extra paths, candidate files, and regular-file checks are handled by modelDownloadPaths; download deduplication uses fileExists.
Standalone template model wiring
src/main/sources/standalone/index.ts
Bundled-template handling uses top-level imports for template resolution and model-presence checks instead of dynamic imports.

Sequence Diagram(s)

sequenceDiagram
  participant TemplateCards
  participant areModelsPresent
  participant resolveDownloadContextById
  participant regularFileExists
  TemplateCards->>areModelsPresent: requested models and installationId
  areModelsPresent->>resolveDownloadContextById: resolve installation context
  resolveDownloadContextById-->>areModelsPresent: search context or null
  areModelsPresent->>regularFileExists: check candidate paths
  regularFileExists-->>areModelsPresent: file existence results
  areModelsPresent-->>TemplateCards: presence result
Loading

Possibly related PRs

Suggested reviewers: maanilverma

🚥 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 bl/gtm-93-a-download-path-extraction
✨ Simplify code
  • Create PR with simplified code
  • Commit simplified code in branch bl/gtm-93-a-download-path-extraction

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.

The extraction left comfyDownloadManager re-exporting all five moved
symbols, but only getModelsBaseDir still had a production consumer and
stripQueryParams had none at all. Point the remaining consumers at the
leaf modules directly so the facade carries no download-path surface.

@deepme987 deepme987 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Blind approval

@benceruleanlu
benceruleanlu added this pull request to the merge queue Jul 28, 2026
Merged via the queue into main with commit f0c4ab9 Jul 28, 2026
12 checks passed
@benceruleanlu
benceruleanlu deleted the bl/gtm-93-a-download-path-extraction branch July 28, 2026 16:40
@github-actions github-actions Bot locked and limited conversation to collaborators Jul 28, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants