refactor: route Global path consumers through the service - #41632
Merged
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
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.
What
Global.Pathto the logging bootstrap andGlobal.make()internals.Global.Service.Global.Servicein their effect environment instead of reading a module-scope static path.Why
Static paths are names only and do not carry acquisition guarantees. Import-time directory creation was removed in #41619, while
Global.Serviceguarantees acquired directories and a canonical temporary directory. Declared service dependencies are also injectable and testable.How
whichhelper receives the acquired bin path from its callers.Global.Service; the runner lets that single requirement propagate through its transactions so the enclosing application or test runtime provides it once. The legacy credential migration and V1 migration use the acquired data path, and migration tests inject a fake Global value through their suite helpers.Tui.runrather than reading the static path table.Global.nodealongside Database and the other application services, soV1Migration.layerreceives the same acquired instance. This also keeps embedded SDK runtimes self-contained: without Global in the server context,createEmbeddedRoutesleaked an unsatisfied environment intoManagedRuntime.makeand SDK construction failed to typecheck.Testing
bunx tsgo --noEmitinpackages/util,packages/core, andpackages/clibun run typecheckinpackages/tui,packages/server, andpackages/sdk-nextbun turbo typecheck --concurrency=3: 33/33 packages passedorigin/v2in this local environment