Skip to content

Break the loraDatasetCaption <-> loraDatasetGenerate static import cycle (#5917) - #6085

Merged
atomantic merged 1 commit into
mainfrom
claim/issue-5917
Sep 3, 2026
Merged

Break the loraDatasetCaption <-> loraDatasetGenerate static import cycle (#5917)#6085
atomantic merged 1 commit into
mainfrom
claim/issue-5917

Conversation

@atomantic

Copy link
Copy Markdown
Owner

Summary

Breaks the loraDatasetCaption.js <-> loraDatasetGenerate.js static ESM import cycle by extracting the shared subject-derivation helpers into a new leaf, server/services/loraDatasetSubject.js.

  • New leaf owns loadDatasetSubject, extractSubjectSignaturePhrases, plus the small helpers they are built on (normalizeEntryKind, subjectLabel, flattenValue). Its only service import is getUniverse from universeBuilder.js, which imports no loraDataset* module, so no new ring is possible.
  • loraDatasetCaption.js now imports the subject helpers from the leaf instead of from the generator — the Caption -> Generate edge is gone. The remaining Generate -> Caption edge (resolveCaptionModel / withCaptionVisionLock) is one-directional and acyclic, so no second leaf was needed.
  • loraDatasetGenerate.js imports the moved helpers back from the leaf; its public API (generateDatasetImages, getDatasetVariationAxes, sliceReferenceSheet, prompt/crop builders) is unchanged.
  • Deletes this component's entry from KNOWN_CYCLIC_COMPONENTS in serviceImportCycles.test.js (the suite fails on a stale entry, so the baseline only shrinks).

Closes #5917

Test plan

  • npx vitest run services/serviceImportCycles.test.js services/loraDatasetGenerate.test.js services/loraDatasetCaption.test.js — 3 files, 60 tests, all pass (cycle ratchet confirms the component is gone and no new cycle appeared).
  • npx vitest run routes/loraDatasets.pagination.test.js — 2 tests pass (route layer that mocks both modules still wires correctly).
  • Local reviewer (mtplx, low effort): one finding (removed extractSubjectSignaturePhrases export from the generator without re-export). Verified repo-wide that no consumer uses the old path — routes import only generateDatasetImages / getDatasetVariationAxes / sliceReferenceSheet, and the one test that imported the moved symbol now imports it from the leaf — so no re-export shim was added.

@atomantic
atomantic merged commit 03886f2 into main Sep 3, 2026
7 checks passed
@atomantic
atomantic deleted the claim/issue-5917 branch September 3, 2026 19:06
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.

Break the loraDatasetCaption <-> loraDatasetGenerate static import cycle

1 participant