fix(barrel): migrate src/lib/ off the @/lib/localDb barrel import (#11795 Phase 3) - #12052
Merged
diegosouzapw merged 1 commit intoAug 30, 2026
Conversation
…orts (#59) Replace all 46 src/lib imports from @/lib/localDb with direct imports from the owning @/lib/db/* modules, per AGENTS.md G14. Covers static named imports, alias re-exports, dynamic imports (lazy semantics kept), namespace destructures, and the Promise.all array-destructure pattern (e.g. providerDiscovery, internalUsageCommand, saturationSignals). Mechanical codemod only - no behavior change. Type-only imports stay type-only, test vi.mock targets re-point at the real module, and the star-export graph (reasoningRoutingRules, etc.) is resolved via the TypeScript compiler API. Prune the 34 now-satisfied no-restricted-imports suppressions for the migrated files. Verified: typecheck:core green, eslint src/lib green, check:cycles green, focused db unit tests pass (183/191; the 8 failures are the pre-existing stdio-guard suite diegosouzapw#8181, identical on clean HEAD).
jonlwheat2-gif
force-pushed
the
fix/issue-59-barrel-phase3-src-lib
branch
from
August 29, 2026 19:27
322f0c7 to
7e4d687
Compare
diegosouzapw
pushed a commit
that referenced
this pull request
Aug 30, 2026
…1795 Phase 2) (#12051) Boarded together with Phases 3-5 (#12052, #12053, #12055) and validated in one combined worktree: typecheck:core, check:file-size, check:changelog-integrity, check:complexity, check:cognitive-complexity, check:cycles, check-db-rules all green. Mechanical import-path migration only, no behavior change. Thanks for the phased, well-tested cleanup.
diegosouzapw
merged commit Aug 30, 2026
2463781
into
diegosouzapw:release/v3.8.51
13 of 15 checks passed
diegosouzapw
pushed a commit
that referenced
this pull request
Aug 30, 2026
…omain off the @/lib/localDb barrel import (#11795 Phase 4) (#12053) Resynced onto the release tip after #12051/#12052 landed. One real conflict in open-sse/services/combo.ts at both LKGP-clear call sites (handleComboChat + round-robin path): the release tip already has #12013's clearStaleLKGP() helper, which this PR's branch predates — kept the current helper call at both sites, discarding the pre-refactor inline pattern. typecheck:core and the open-sse test suite (vitest, 9/9 on volumeDetector) both green after resync. Thanks for the well-scoped Phase 4 migration.
diegosouzapw
pushed a commit
that referenced
this pull request
Aug 30, 2026
#11795 Phase 5) (#12055) Resynced onto the release tip after #12051/#12052/#12053 landed. Same LKGP-clear conflict as #12053 (kept the current clearStaleLKGP() helper at both call sites). One additional issue this final phase's combined-worktree validation surfaced: clearStaleLKGP() itself (added by #12013, which none of the 4 phase PRs could have seen since it landed after they were authored) still had a dynamic `await import("@/lib/localDb")` — a real break once this PR deletes the barrel. Fixed to `await import("@/lib/db/settings")`, matching the direct-import pattern used at every other call site. typecheck:core, check-db-rules, check:cycles, and the eslint-import-boundaries regression test (3/3, including "G14 rejects localDb barrel imports") all green after resync — zero barrel-importing production files remain. Nice clean 5-phase migration, and thanks for taking on the full #11795 cleanup.
diegosouzapw
added a commit
that referenced
this pull request
Sep 2, 2026
… + api-typecheck baseline ratchet (#12414) * fix(memory): point the rerank-providers dynamic import at the real db module #11390 landed with a dynamic import of the localDb barrel, which #12052 had already removed from the base (and which Hard Rule #2 forbids) — the API Route Typecheck gate reds on the tip with TS2307. getCachedProviderNodes lives in src/lib/db/readCache. * chore(quality): ratchet the api-typecheck baseline down (163 stale entries gone) Regenerated with --update on a faithful npm ci environment (the .113 box) against the current tip plus the rerank-providers import fix — the gate now reads OK at 289 pre-existing errors, all baselined. No new entries added.
muhamadgalihsaputra
pushed a commit
to niyatna/NiyatnaRoute
that referenced
this pull request
Sep 27, 2026
…egosouzapw#11795 Phase 2) (diegosouzapw#12051) Boarded together with Phases 3-5 (diegosouzapw#12052, diegosouzapw#12053, diegosouzapw#12055) and validated in one combined worktree: typecheck:core, check:file-size, check:changelog-integrity, check:complexity, check:cognitive-complexity, check:cycles, check-db-rules all green. Mechanical import-path migration only, no behavior change. Thanks for the phased, well-tested cleanup.
muhamadgalihsaputra
pushed a commit
to niyatna/NiyatnaRoute
that referenced
this pull request
Sep 27, 2026
…orts (diegosouzapw#59) (diegosouzapw#12052) Boarded together with Phases 2, 4, 5 (diegosouzapw#12051, diegosouzapw#12053, diegosouzapw#12055) and validated in one combined worktree: typecheck:core, check:file-size, check:changelog-integrity, check:complexity, check:cognitive-complexity, check:cycles, check-db-rules all green. Mechanical import-path migration only, no behavior change. Thanks for the phased, well-tested cleanup.
muhamadgalihsaputra
pushed a commit
to niyatna/NiyatnaRoute
that referenced
this pull request
Sep 27, 2026
…omain off the @/lib/localDb barrel import (diegosouzapw#11795 Phase 4) (diegosouzapw#12053) Resynced onto the release tip after diegosouzapw#12051/diegosouzapw#12052 landed. One real conflict in open-sse/services/combo.ts at both LKGP-clear call sites (handleComboChat + round-robin path): the release tip already has diegosouzapw#12013's clearStaleLKGP() helper, which this PR's branch predates — kept the current helper call at both sites, discarding the pre-refactor inline pattern. typecheck:core and the open-sse test suite (vitest, 9/9 on volumeDetector) both green after resync. Thanks for the well-scoped Phase 4 migration.
muhamadgalihsaputra
pushed a commit
to niyatna/NiyatnaRoute
that referenced
this pull request
Sep 27, 2026
diegosouzapw#11795 Phase 5) (diegosouzapw#12055) Resynced onto the release tip after diegosouzapw#12051/diegosouzapw#12052/diegosouzapw#12053 landed. Same LKGP-clear conflict as diegosouzapw#12053 (kept the current clearStaleLKGP() helper at both call sites). One additional issue this final phase's combined-worktree validation surfaced: clearStaleLKGP() itself (added by diegosouzapw#12013, which none of the 4 phase PRs could have seen since it landed after they were authored) still had a dynamic `await import("@/lib/localDb")` — a real break once this PR deletes the barrel. Fixed to `await import("@/lib/db/settings")`, matching the direct-import pattern used at every other call site. typecheck:core, check-db-rules, check:cycles, and the eslint-import-boundaries regression test (3/3, including "G14 rejects localDb barrel imports") all green after resync — zero barrel-importing production files remain. Nice clean 5-phase migration, and thanks for taking on the full diegosouzapw#11795 cleanup.
muhamadgalihsaputra
pushed a commit
to niyatna/NiyatnaRoute
that referenced
this pull request
Sep 27, 2026
… + api-typecheck baseline ratchet (diegosouzapw#12414) * fix(memory): point the rerank-providers dynamic import at the real db module diegosouzapw#11390 landed with a dynamic import of the localDb barrel, which diegosouzapw#12052 had already removed from the base (and which Hard Rule diegosouzapw#2 forbids) — the API Route Typecheck gate reds on the tip with TS2307. getCachedProviderNodes lives in src/lib/db/readCache. * chore(quality): ratchet the api-typecheck baseline down (163 stale entries gone) Regenerated with --update on a faithful npm ci environment (the .113 box) against the current tip plus the rerank-providers import fix — the gate now reads OK at 289 pre-existing errors, all baselined. No new entries added.
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.
Part of #11795 — Phase 3 of the phased migration off the
@/lib/localDbbarrel.What
Replaces all 46
src/lib/**imports from@/lib/localDbwith direct imports from the owning@/lib/db/*modules, per AGENTS.md G14 ("Never barrel-import fromlocalDb.ts— import specificdb/modules instead"). The barrel atsrc/lib/localDb.tsis a pure re-export layer (850 lines, zero logic) and remains untouched in this PR — it is deleted in Phase 5 once every consumer is migrated.How
Mechanical codemod only — no behavior change:
export *star graph (e.g.getReasoningRoutingRulesfromreasoningRoutingRules.ts) and alias re-exports (updateWebhook as updateWebhookRecord)Promise.allarray-destructure pattern (e.g.providerDiscovery,internalUsageCommand,saturationSignals)vi.mocktargets re-point at the real moduleno-restricted-importssuppressions for migrated files are pruned fromconfig/quality/eslint-suppressions.jsonVerification
typecheck:coregreeneslint src/libgreen (no-restricted-imports gate satisfied without suppressions)check:cyclesgreenRebased onto current
release/v3.8.51tip (065d9984).