Skip to content

fix(barrel): migrate src/lib/ off the @/lib/localDb barrel import (#11795 Phase 3) - #12052

Merged
diegosouzapw merged 1 commit into
diegosouzapw:release/v3.8.51from
jonlwheat2-gif:fix/issue-59-barrel-phase3-src-lib
Aug 30, 2026
Merged

diegosouzapw merged 1 commit into
diegosouzapw:release/v3.8.51from
jonlwheat2-gif:fix/issue-59-barrel-phase3-src-lib

Conversation

@jonlwheat2-gif

Copy link
Copy Markdown
Contributor

Part of #11795 — Phase 3 of the phased migration off the @/lib/localDb barrel.

What

Replaces all 46 src/lib/** imports from @/lib/localDb with direct imports from the owning @/lib/db/* modules, per AGENTS.md G14 ("Never barrel-import from localDb.ts — import specific db/ modules instead"). The barrel at src/lib/localDb.ts is 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:

  • Each imported name is resolved to its owning module via the TypeScript compiler API, including the export * star graph (e.g. getReasoningRoutingRules from reasoningRoutingRules.ts) and alias re-exports (updateWebhook as updateWebhookRecord)
  • Covers static named imports, dynamic imports (lazy semantics preserved), namespace destructures, and the Promise.all array-destructure pattern (e.g. providerDiscovery, internalUsageCommand, saturationSignals)
  • Type-only imports stay type-only; test vi.mock targets re-point at the real module
  • The 34 now-satisfied no-restricted-imports suppressions for migrated files are pruned from config/quality/eslint-suppressions.json

Verification

Rebased onto current release/v3.8.51 tip (065d9984).

…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
jonlwheat2-gif force-pushed the fix/issue-59-barrel-phase3-src-lib branch from 322f0c7 to 7e4d687 Compare August 29, 2026 19:27
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
diegosouzapw merged commit 2463781 into diegosouzapw:release/v3.8.51 Aug 30, 2026
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants