Backoffice: Fix core circular import (fetchAllPages) breaking the test check - #23133
Conversation
…core circular import #22765 added the offset pagination helper `fetchAllPages` under `@umbraco-cms/backoffice/utils`, but its contract is expressed entirely in repository-owned types (`UmbDataSourceResponse<UmbPagedModel<T>>`). That made `utils` import `repository` while `repository` already imports `utils`, introducing a 17th core bidirectional module import and tripping `check:module-dependencies` (threshold 16) — failing the `test` job on every open PR. Relocate the helper (and its test) into the `repository` module, which legitimately owns those types, and export it from `@umbraco-cms/backoffice/repository`. The sole consumer (UmbLanguageCollectionRepository) already imports from that module. Core bidirectional imports are back to 16. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
Claude finished @iOvergaard's task in 3m 16s —— View job PR ReviewTarget: Moves
Important
Suggestions
Approved with Suggestions for improvementThe architectural fix is correct — Labels applied: |
There was a problem hiding this comment.
Pull request overview
This PR resolves a new core-module bidirectional import introduced by fetchAllPages by relocating the helper (and its unit test) from the utils module into the repository module, and then re-exporting it from @umbraco-cms/backoffice/repository. This removes the utils → repository dependency while keeping the consumer (UmbLanguageCollectionRepository) functioning with the same behavior.
Changes:
- Moved
fetchAllPages(+ test) intopackages/core/repository/pagination/and exported it via the repository barrel. - Updated
UmbLanguageCollectionRepositoryto importfetchAllPagesfrom@umbraco-cms/backoffice/repository. - Removed the
fetchAllPagesexport frompackages/core/utils/pagination/offset/index.tsto prevent the circular dependency.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| src/Umbraco.Web.UI.Client/src/packages/language/collection/repository/language-collection.repository.ts | Switches fetchAllPages import to the repository module (removes utils↔repository circular pair). |
| src/Umbraco.Web.UI.Client/src/packages/core/utils/pagination/offset/index.ts | Stops exporting fetchAllPages from utils’ offset pagination barrel. |
| src/Umbraco.Web.UI.Client/src/packages/core/repository/pagination/index.ts | New barrel export for repository pagination helpers. |
| src/Umbraco.Web.UI.Client/src/packages/core/repository/pagination/fetch-all-pages.function.ts | Relocated helper; now uses repository-local type imports to avoid cross-module dependency. |
| src/Umbraco.Web.UI.Client/src/packages/core/repository/pagination/fetch-all-pages.function.test.ts | Relocated unit test alongside the helper under repository/pagination. |
| src/Umbraco.Web.UI.Client/src/packages/core/repository/index.ts | Re-exports the new repository pagination barrel so consumers can import from @umbraco-cms/backoffice/repository. |
What and why
The
testCI job is currently failing on every open PR with:check:module-dependenciesallows 16 bidirectional core-module imports; a recent merge pushed it to 17.Root cause
#22765 added the offset pagination helper
fetchAllPagesunder@umbraco-cms/backoffice/utils. Its contract is expressed entirely in repository-owned types —UmbDataSourceResponse<UmbPagedModel<T>>(declared inpackages/core/repository/). That made theutilsmodule import therepositorymodule, whilerepositoryalready importsutils→ a newrepository ↔ utilsbidirectional pair (the 17th).Fix
Move the helper (and its test) into the
repositorymodule, which legitimately owns those types, and export it from@umbraco-cms/backoffice/repository. The sole consumer —UmbLanguageCollectionRepository— already imports from that module, so its import just moves from@umbraco-cms/backoffice/utilsto@umbraco-cms/backoffice/repository. No type changes, no behaviour change.Core bidirectional imports are back to 16.
Verification
node ./devops/module-dependencies/index.js→ exits 0 (Core 16/16, Packages 14/14, illegal 5/5, self 0).tsc(npm run compile) → 0 errors (confirms no other consumer's import broke).Unblocks the
testcheck on all open PRs (e.g. #23094).