Conversation
…ndard) Co-authored-by: imnasnainaec <6411521+imnasnainaec@users.noreply.github.com>
|
commit 7104bfabf2: commit 5a158d65d3: |
|
@copilot Convert |
Co-authored-by: imnasnainaec <6411521+imnasnainaec@users.noreply.github.com>
Done in a08434c. Renamed to npx tsc --project database/tsconfig.json --noEmitSince mongosh 2.x supports mongosh CombineDatabase database/migrate-guids-to-subtype4.ts |
|
@copilot Your Also, running |
…rror Co-authored-by: imnasnainaec <6411521+imnasnainaec@users.noreply.github.com>
Fixed in 7104bfa.
BinData types: Fixed using the actual
Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
|
@copilot |
….js for mongosh Co-authored-by: imnasnainaec <6411521+imnasnainaec@users.noreply.github.com>
Done in 32aad5d. The Workflow: npx tsc database/migrate-guids-to-subtype4.ts
mongosh CombineDatabase database/migrate-guids-to-subtype4.jsAlso added |
|
@coderabbitai full review |
✅ Actions performedFull review triggered. |
📝 WalkthroughWalkthroughThis PR migrates MongoDB GUID serialization from CSharp-legacy subtype 3 to RFC 4122 subtype 4. Backend models are updated to use the Standard GUID representation, a TypeScript migration script is introduced to convert existing data, and supporting configuration files are added. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 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 |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #4179 +/- ##
=======================================
Coverage 74.95% 74.95%
=======================================
Files 302 302
Lines 11090 11090
Branches 1394 1394
=======================================
Hits 8312 8312
Misses 2378 2378
Partials 400 400
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
GUIDs were stored as BinData subtype 3 with C# mixed-endian byte order, making them inconvenient to query in
mongoshsince the byte layout differs from RFC 4122. Subtype 4 is stable across all MongoDB drivers.Backend
Changed
[BsonGuidRepresentation]fromGuidRepresentation.CSharpLegacy→GuidRepresentation.Standardon allGuidfields:Word.Guid(Backend/Models/Word.cs)Sense.Guid(Backend/Models/Sense.cs)Edit.GuidandUserEditStepWrapper.EditGuid(Backend/Models/UserEdit.cs)Database migration
Added
database/migrate-guids-to-subtype4.ts— a TypeScript script to convert existing subtype 3 GUIDs in place. Compile it first withtsc, then pass the resulting JS tomongosh:Covers
WordsCollection,FrontierCollection(top-levelguid+senses[].guid), andUserEditsCollection(edits[].guid). Idempotent — skips fields already at subtype 4.Byte conversion: CSharpLegacy stores the first three UUID components little-endian; the script reverses bytes
[0-3], swaps bytes[4-5], and swaps bytes[6-7], leaving bytes[8-15]unchanged.Type declarations are inline in the
.tsfile usingdeclarestatements (erased bytsc, producing no JS output). TheBsonBinaryinterface documents the verified bson@^7 API (sub_type: number,toString("hex")). The file contains noimportstatements so the compiled JS is a clean script with no CommonJS module boilerplate.A
database/tsconfig.jsonis included for isolated type-checking of the migration script.database/*.jsis added to.gitignoreso compiled output is not committed.bsonis added as a devDependency to support type-checking.SCRIPT TO BE DELETED IN A SUBSEQUENT PR AFTER THE GUID MIGRATION IN THE DATABASE IS SUCCESSFUL
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.
This change is
Summary by CodeRabbit