Conversation
Signed-off-by: lazerg <lazerg2@gmail.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository: prisma/orm/.coderabbit.yml Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (2)
Included review availability: Your plan provides up to 10 included reviews per hour; 8 remain after this review. 📝 WalkthroughWalkthroughThe MongoDB runtime now parses multi-host seed-list URLs for validation while preserving the original URL for the driver. Tests cover credentials, IPv6 hosts, commas in passwords, database parsing, and missing database names. ChangesMongoDB seed-list support
Priority: ➖ Normal Estimated code review effort: 2 (Simple) | ~10 minutes Change: Bug fix · Severity of issue fixed: Medium Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
Signed-off-by: lazerg <lazerg2@gmail.com>
Linked issue
Fixes #30353
Summary
The Mongo runtime validates a connection URL with
new URL, which cannot parse a seed list. Givenmongodb://host1:27017,host2:27017/dbit reads27017,host2:27017as the port and throws, so every replica-set URI with more than one host was rejected asMongo URL must be a valid URLbefore the driver ever saw it. Validation now drops the extra hosts before parsing. Only the scheme and the database path are read off the parsed URL, and the driver still receives the original string.Testing performed
pnpm --dir packages/3-extensions/mongo test— 128 passed. The seed-list test reproduces the report throughmongo({ contract, url })and fails onmainwith the reported error.pnpm typecheckandpnpm lint— clean.pnpm test:packages— 17300 passed. Three tarball suites fail, but they fail the same way on an unmodifiedmain: their scratchpnpm installcannot resolve dependencies here.test/mongo,test/mongo-runtime) — 145 passed across 17 files.Skill update
n/a — no CLI flag, public API, config field, or error code changes. A connection string the MongoDB driver already accepts simply stops being rejected.
Checklist
git commit -s) per the DCO.TML-NNNN: <sentence-case title>form — no Linear ticket, this comes from the issue tracker.Notes for the reviewer
The scan for the host list starts after the last
@in the authority, because a password is allowed to contain an unencoded comma. Tests cover that case along with a bracketed IPv6 seed list and a seed list with no database path, which still raises the existing "must include a database name" error.mongodb+srv://is unaffected: an SRV URI carries one host and no port, so there is no host list to collapse.Worth noting separately:
packages/3-extensions/postgres/src/runtime/binding.tsvalidates the same way and libpq also accepts multi-host strings, so it likely has the same gap. I left it alone to keep this scoped to the reported issue.Summary by CodeRabbit
Bug Fixes
Tests