Push typed IDs through repo trait layer — drop ~80 boundary conversions#176
Merged
Conversation
Contributor
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
13d870a to
fb9b81f
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Follow-up to #174. Migrates every
repo.rstrait + impl to take typed&TenantId/&AffiliateId/&SecretKeyId/&WebhookId/&UserId/&PublishableKeyId/&AuthSessionId/&AppId/&SourceId/&InstallEventIdparameters instead of&ObjectId. Inside repo bodies, BSON construction works through the existingFrom<Id<P>> for Bsonimpl — storage format unchanged (still native ObjectId on the wire).Result: 89 → 8
.as_object_id()/.to_object_id()calls in production code.What changed
13 repo modules migrated, one commit per domain:
domains,publishable_keys,tenants,users,secret_keys,webhooks,apps,sessions,event_counters,conversions,install_events,app_users,linksFor each: trait signatures → impl signatures → BSON
doc!literals → service-layer callers → route-layer callers → in-memory test mocks.Why
After #174 landed, services + routes spoke typed IDs everywhere but repos still spoke
ObjectId— so every repo call site was a boundary conversion. The architecture test allowlists**/repo.rs, so this dead weight was structurally invisible.This PR pushes typed IDs all the way to the repo trait boundary, and the boundary conversions vanish from service / route / mcp / test code.
Storage layer
ObjectIdstill appears inside repo bodies (e.g.tenant_id.as_object_id()for_idlookups,ObjectId::new()for the app_users sentinel). That's intentional — repos own storage. The architecture allowlist for**/repo.rsis unchanged.Verification
cargo test: 205 lib + 179 doc + 147 integration passing at every commitcargo clippy --all-targets -- -D warnings: cleancargo fmt: cleanOBJECT_ID_BACKLOGstill empty; architecture tests still actively enforcingTest plan