test: MongoDB config normalization — alias resolution#496
test: MongoDB config normalization — alias resolution#496anandgupta42 wants to merge 1 commit intomainfrom
Conversation
MongoDB was added in #482 but normalizeConfig() lacked any MongoDB-specific tests. These 11 tests verify that common field name aliases (uri, url, connectionString, authSource, replicaSet, directConnection, username, dbname, timeout fields) are correctly resolved to their canonical snake_case names, preventing silent connection failures when users provide MongoDB config from dbt profiles, MongoDB docs, or LLM-generated output. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> https://claude.ai/code/session_01UtQ9rqYTKybuvdu6bM4cTj
There was a problem hiding this comment.
Claude Code Review
This repository is configured for manual code reviews. Comment @claude review to trigger a review and subscribe this PR to future pushes, or @claude review once for a one-time review.
Tip: disable this comment in your organization's Code Review settings.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughAdded test suite for Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Suggested labels
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Consolidates tests from PRs #440, #441, #479, #483, #484, #485, #490, #491, #492, #495, #496. Deduplicates overlapping MongoDB normalize tests (3 PRs → 1), `keybind` tests (2 PRs → 1), and `connections.test.ts` additions (4 PRs → 1 merged file). New test files: - `sql-analyze-tool.test.ts` — `SqlAnalyzeTool` formatting (6 tests) - `sql-analyze-format.test.ts` — `sql.analyze` success semantics + dispatcher (5 tests) - `builtin-commands.test.ts` — altimate builtin command registration (10 tests) - `hints-discover-mcps.test.ts` — `Command.hints()` + discover-and-add-mcps (11 tests) - `fingerprint-detect.test.ts` — file-based project detection rules (11 tests) - `dbt-lineage-helpers.test.ts` — dbt lineage helper functions (13 tests) - `registry-env-loading.test.ts` — `ALTIMATE_CODE_CONN_*` env var loading (8 tests) - `warehouse-telemetry.test.ts` — MongoDB auth detection telemetry (4 tests) - `bus-event.test.ts` — bus event registry payloads (5 tests) - `git.test.ts` — git utility functions (5 tests) - `keybind.test.ts` — keybind parsing, matching, `fromParsedKey` (22 tests) Merged into existing files: - `connections.test.ts` — `loadFromEnv` (5), `detectAuthMethod` (14), credential stripping (1), `containerToConfig` (1), dbt profiles edge cases (3) - `driver-normalize.test.ts` — MongoDB alias resolution (13 tests) Fixes: - `fixture.ts` — disable `commit.gpgsign` in test tmpdir to prevent CI failures - `hints-discover-mcps.test.ts` — corrected sort order expectation - `registry-env-loading.test.ts` — fixed flaky assertion that assumed isolated env Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
Consolidated into #498. Tests deduplicated and merged into a single PR. |
What does this PR do?
1.
normalizeConfig()MongoDB aliases —packages/drivers/src/normalize.ts(11 new tests)MongoDB driver support was added in #482 but the config normalization test file (
driver-normalize.test.ts, 61 existing tests covering every other driver) had zero MongoDB coverage. This is a P0 gap: users who provide MongoDB connection config using common field names from MongoDB documentation, dbt profiles, or LLM-generated output would experience silent connection failures because aliases likeuri,url,connectionString,authSource, etc. would not be resolved to their canonical snake_case names.New coverage includes:
uri→connection_string,url→connection_string,connectionString→connection_stringconnection_stringtakes priority when both canonical and alias fields are presentauthSource→auth_source,replicaSet→replica_setdirectConnection→direct_connectionusername→user,dbname→database(shared with other drivers)mongoresolves identically tomongodbconnectTimeoutMS→connect_timeout,serverSelectionTimeoutMS→server_selection_timeoutconnectionString+uri) are both present, the first-listed alias wins per theapplyAliasescontractType of change
Issue for this PR
N/A — proactive test coverage for newly added MongoDB driver (#482)
How did you verify your code works?
All 89 tests pass. No source code was modified — tests only.
Checklist
https://claude.ai/code/session_01UtQ9rqYTKybuvdu6bM4cTj
Summary by CodeRabbit