Break the loraDatasetCaption <-> loraDatasetGenerate static import cycle (#5917) - #6085
Merged
Conversation
atomantic
force-pushed
the
claim/issue-5917
branch
from
September 3, 2026 19:04
a9da594 to
f004d57
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Breaks the
loraDatasetCaption.js<->loraDatasetGenerate.jsstatic ESM import cycle by extracting the shared subject-derivation helpers into a new leaf,server/services/loraDatasetSubject.js.loadDatasetSubject,extractSubjectSignaturePhrases, plus the small helpers they are built on (normalizeEntryKind,subjectLabel,flattenValue). Its only service import isgetUniversefromuniverseBuilder.js, which imports noloraDataset*module, so no new ring is possible.loraDatasetCaption.jsnow imports the subject helpers from the leaf instead of from the generator — theCaption -> Generateedge is gone. The remainingGenerate -> Captionedge (resolveCaptionModel/withCaptionVisionLock) is one-directional and acyclic, so no second leaf was needed.loraDatasetGenerate.jsimports the moved helpers back from the leaf; its public API (generateDatasetImages,getDatasetVariationAxes,sliceReferenceSheet, prompt/crop builders) is unchanged.KNOWN_CYCLIC_COMPONENTSinserviceImportCycles.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).mtplx, low effort): one finding (removedextractSubjectSignaturePhrasesexport from the generator without re-export). Verified repo-wide that no consumer uses the old path — routes import onlygenerateDatasetImages/getDatasetVariationAxes/sliceReferenceSheet, and the one test that imported the moved symbol now imports it from the leaf — so no re-export shim was added.