Follow-up from PR #1883's Greptile review (#1883 (comment)... — comment on src/domain/analysis/query-helpers.ts:19).
That PR fixed withReadonlyDb + its callers (exports.ts, context.ts) to resolve config once via the new resolveDbConfig() export and pass it through to resolveAnalysisOpts({ ...opts, config: opts.config ?? config }), avoiding a redundant loadConfig() call per query.
fn-impact.ts has the identical pattern but through the withRepo path instead:
withRepo(customDbPath, fn) → openRepo(customDbPath) → resolveDbSettings(customDbPath, opts.engine) → loadConfig(deriveRootDirFromDbPath(customDbPath))
fn-impact.ts:280 then separately calls resolveAnalysisOpts(opts), which calls loadConfig() again (cwd-rooted) when opts.config is absent.
Fixing this is out of scope for #1883 because openRepo/resolveDbSettings in db/connection.ts are used by every native-engine call site (not just read-only analysis queries), so widening withRepo's callback signature to also pass config has a much larger blast radius than withReadonlyDb's change. Worth doing as its own focused PR.
Follow-up from PR #1883's Greptile review (#1883 (comment)... — comment on
src/domain/analysis/query-helpers.ts:19).That PR fixed
withReadonlyDb+ its callers (exports.ts,context.ts) to resolve config once via the newresolveDbConfig()export and pass it through toresolveAnalysisOpts({ ...opts, config: opts.config ?? config }), avoiding a redundantloadConfig()call per query.fn-impact.tshas the identical pattern but through thewithRepopath instead:withRepo(customDbPath, fn)→openRepo(customDbPath)→resolveDbSettings(customDbPath, opts.engine)→loadConfig(deriveRootDirFromDbPath(customDbPath))fn-impact.ts:280then separately callsresolveAnalysisOpts(opts), which callsloadConfig()again (cwd-rooted) whenopts.configis absent.Fixing this is out of scope for #1883 because
openRepo/resolveDbSettingsindb/connection.tsare used by every native-engine call site (not just read-only analysis queries), so wideningwithRepo's callback signature to also passconfighas a much larger blast radius thanwithReadonlyDb's change. Worth doing as its own focused PR.