Skip to content

refactor(db): modular lib/ architecture and expanded test coverage - #18

Merged
unclecatvn merged 1 commit into
stagingfrom
refactor/db-modular-architecture
Jun 16, 2026
Merged

refactor(db): modular lib/ architecture and expanded test coverage#18
unclecatvn merged 1 commit into
stagingfrom
refactor/db-modular-architecture

Conversation

@unclecatvn

@unclecatvn unclecatvn commented Jun 16, 2026

Copy link
Copy Markdown
Owner

Summary

  • Refactor @unclecat/mcp-multi-db into focused lib/ modules: toolDescriptors, tableListingSql, normalizeAlias, aliasConstants, instructions, loggertoolHandlers.js shrinks ~480 → ~215 lines.
  • Hoist shared driver logic into BaseDriver (listTables, healthCheck, error mapping); dialect drivers only implement executeQuery + describeTable.
  • Add optional defaultAlias (omit databaseAlias in tool calls), per-alias defaultSchema, and db_list_tables pagination/filter (limit, offset, namePattern).
  • Harden security: modeEnforcer gates on effectiveType so EXPLAIN ANALYZE <write> cannot bypass readonly mode.
  • Expand tests to 203 with full lib/ + drivers/ coverage gate (≥88% lines).

Toolchain / CI cleanup

  • Fix eslint: drop unused DEFAULT_PORTS import, use const in normalizeAlias.
  • Apply prettier formatting to config.js, configFile.js, toolDescriptors.js.
  • Bump vitest & @vitest/coverage-v8 to ^3.2.6 (db + odoo) — clears the critical vitest advisory.
  • Add pnpm overrides forcing vite >=6.4.3 and esbuild >=0.28.1 — clears the remaining high advisories. pnpm audit --audit-level=high now passes (0 critical / 0 high).

Includes changeset .changeset/db-refactor-modular.md (minor bump). Pending .changeset/vscode-docs.md on staging/master will aggregate into the same Version Packages PR.

Test plan

  • pnpm --filter @unclecat/mcp-multi-db test — 203/203 pass
  • pnpm --filter @unclecat/mcp-multi-db test:coverage — ≥80% thresholds pass
  • pnpm --filter @unclecat/mcp-odoo test — 94/94 pass
  • Live MCP smoke test against unleashed alias (connection, query orders, list tables)
  • CI ci-success green on PR
  • After merge to master: verify Version Packages PR picks up both changesets

@unclecatvn
unclecatvn changed the base branch from staging to master June 16, 2026 09:03
@unclecatvn
unclecatvn changed the base branch from master to staging June 16, 2026 09:04
Split toolHandlers into focused lib/ modules, deduplicate config loaders,
hoist shared driver logic into BaseDriver, and add optional defaultAlias/
defaultSchema plus db_list_tables pagination.

Also clean up the toolchain so CI passes:
- drop unused DEFAULT_PORTS import and use const in normalizeAlias (eslint)
- apply prettier formatting to config.js, configFile.js, toolDescriptors.js
- bump vitest & @vitest/coverage-v8 to ^3.2.6 (db + odoo) to clear the
  critical vitest advisory
- add pnpm overrides forcing vite >=6.4.3 and esbuild >=0.28.1 to clear
  the remaining high advisories

297 tests pass (203 db + 94 odoo), >=88% coverage.
@unclecatvn
unclecatvn force-pushed the refactor/db-modular-architecture branch from dd04166 to ec28ba6 Compare June 16, 2026 09:14
@unclecatvn
unclecatvn merged commit 3a07930 into staging Jun 16, 2026
7 checks passed
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.

1 participant