Split credentials refactor out of #1225 into an independent PR
#1290 aperta il 3 ago 2026
Metriche repository
- Star
- (270 stelle)
- Metriche merge PR
- (Metriche PR in attesa)
Descrizione
Summary
Split the credentials refactor (and the internal/configpaths refinements) out
of #1225 so they can land ahead of the new registry/remote/config package.
Background
#1225 ("feat(config): add remote config package with credentials refactor") bundles three things:
- the new
registry/remote/configpackage, - a refactor of
registry/remote/credentials, and - refinements to
registry/remote/internal/configpaths.
The PR description states these "cannot be split without breaking compilation or
tests." In practice the coupling is weaker than that: the production code is
cleanly decoupled, and only two _test.go files tie credentials back to
config.
Why a split is feasible
Production dependency direction is one-way: config → credentials.
credentials/store.goexposes a registration hook — theConfigFileLoadertype, a package-leveldefaultConfigLoader, and the exportedSetDefaultConfigLoader(). It imports nothing fromconfig.config/config.goregisters itself ininit()viacredentials.SetDefaultConfigLoader(...).internal/configpathsimports neitherconfignorcredentials, so it can ship first with zero coupling.
The only credentials → config references are test-only:
credentials/file_store_test.goandcredentials/store_test.gouseconfig/configtest.Configas a fixture struct.configtestis a standalone ~39-line package of JSON-shaped structs that imports nothing (not evenconfig).credentials/file_store_test.goadditionally blank-importsconfig(_ ".../config" // registers config loader) because those tests exerciseNewStore/NewStoreFromDocker, which require a registered loader.
Nothing here breaks compilation without config.
Proposed work
- Land
internal/configpathsrefinements on their own (independent, no coupling). - Land the
credentialsrefactor without theconfigpackage by:- inlining or relocating the
configtestfixture struct into the credentials test package (or a shared internal test helper), and - registering a stub loader via
SetDefaultConfigLoader(or switching toNewStoreFromConfig) infile_store_test.goinstead of blank-importingconfig.
- inlining or relocating the
- Land the
registry/remote/configpackage as a follow-up, swapping the stub test loader for the realconfigregistration.
Benefit
Smaller, independently reviewable PRs; configpaths and the credentials
refactor stop being blocked on review of the much larger config package.
Trade-off
The credentials tests get touched twice (stub first, real config later). If the
priority is simply landing the config layer to unblock the signature package,
the existing bundle in #1225 is reasonable — this issue tracks the split as the
alternative for reviewability.
Refs #1225. Part of the feat/everything (#1130) v3 breakdown.