fix(image-analysis): wrap defaultDeps in arrow functions to fix circular dep capture

Direct function references in defaultDeps (checkRemoteProxy, fetchRemoteAuthStatus,
getAuthStatus, getProxyTarget, initializeAccounts) are captured at module load time.
Due to circular dependencies in the module graph, auth-handler.js may not have
finished initializing when this module is first evaluated, causing these references
to be captured as undefined.

Wrapping each reference in an arrow function defers evaluation to call time,
by which point all modules are fully initialized.

isCliproxyRunning was already wrapped correctly; this patch applies the same
pattern consistently to all deps.

Fixes #973
This commit is contained in:
Wooseong Kim
2026-04-13 15:05:22 +09:00
parent d725a3c061
commit a76265a7c0
@@ -29,11 +29,11 @@ interface ImageAnalysisRuntimeStatusDeps {
}
const defaultDeps: ImageAnalysisRuntimeStatusDeps = {
checkRemoteProxy,
fetchRemoteAuthStatus,
getAuthStatus,
getProxyTarget,
initializeAccounts,
checkRemoteProxy: (...args) => checkRemoteProxy(...args),
fetchRemoteAuthStatus: (...args) => fetchRemoteAuthStatus(...args),
getAuthStatus: (...args) => getAuthStatus(...args),
getProxyTarget: () => getProxyTarget(),
initializeAccounts: () => initializeAccounts(),
isCliproxyRunning: () => isCliproxyRunning(),
};