-
Notifications
You must be signed in to change notification settings - Fork 10
Fixes Circular Dependency btwn LogUtils and LangUtils and reduces risk of future occurence #4097
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Conversation
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
…es of LogUtils.ts and LangUtils.ts
amcclain
reviewed
Sep 18, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for continuing to work through this!
- Could we summarize - for this PR + resulting squash commit message - what was going wrong here? So we have some record of what we've learned and how this resolves?
- How could we document that in the code in any way?
- Would be answered by above, but why did VersionUtils also need to move?
amcclain
approved these changes
Sep 18, 2025
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.
The bugs below were caused by a circular dependency issue.
It took a lot of trial and error to identify the cause, but ultimately it was determined to be these changes:
99264e3#diff-0e3d75d14bd9d478ce2a63d57efd6d7dfdc9fc3fcfce7598e187db141e5f1358R8
99264e3#diff-059e005c44af2ebad384deb53208cf43a0b35c787da98e4b39b4164ea4292354R8
where the import path of
checkVersion
was changed fromimport {checkVersion} from '@xh/hoist/utils/js/VersionUtils';
to the less specific:
import {checkVersion, logError} from '@xh/hoist/utils/js';
How we resolved the bug:
The Version Utils were moved into their own directory and 'unlinked' from other libs because they are called very early in the runtime cycle. If other libs are linked to them via index.ts, it looks like "PORTIONS" of the other libs get called in, and then the other libs do not get loaded again, which is why we were seeing many "undefined" and "not initialized" errors in the client.
After this VersionUtils problem was solved, another circDep issue came up, between LogUtils and LangUtils.
We decided to remove the one dependency LogUtils had on LangUtils by duplicating the
interspersed
method in LogUtils.The lesson I took from this is that circular dependency risk can be reduced by isolating libs that are loaded/used very early in the runtime cycle.
By isolating I mean:
VersionUtils and LogUtils are both examples of libs with methods that we want to call early in the app startup/run time start up, so, we have moved them into their own packages and removed any dependencies on other packages in the framework.
Corresponding Toolbox PR with required import path changes:
xh/toolbox#778
Hoist P/R Checklist
Pull request authors: Review and check off the below. Items that do not apply can also be
checked off to indicate they have been considered. If unclear if a step is relevant, please leave
unchecked and note in comments.
develop
branch as of last change.breaking-change
label + CHANGELOG if so.If your change is still a WIP, please use the "Create draft pull request" option in the split
button below to indicate it is not ready yet for a final review.