fix(api): stop silently mapping v1 lottery router to v2 implementation - #1015
Open
TheBigWealth89 wants to merge 1 commit into
Open
fix(api): stop silently mapping v1 lottery router to v2 implementation#1015TheBigWealth89 wants to merge 1 commit into
TheBigWealth89 wants to merge 1 commit into
Conversation
v1Router was mounting v2Lottery at /lottery, so v1 consumers were transparently getting v2 behavior. This makes the API versioning promise meaningless and risks breaking v1 clients whenever v2 changes. Explicitly document and wire the shared v1/v2 lottery router in backend/src/routes/api.ts, add CHANGELOG entry, and add integration tests verifying version contract parity.
|
@TheBigWealth89 is attempting to deploy a commit to the Ayomide Adeniran's projects Team on Vercel. A member of the Team first needs to authorize it. |
|
@TheBigWealth89 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
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.
fix(api): stop silently mapping v1 lottery router to v2 implementation
Fixes #1000
Problem
The v1 lottery router in
backend/src/routes/api.tswas mountingv2Lotterywithout explicit documentation or architectural rationale. Clients calling/api/v1/lottery/*were silently receiving v2 behavior, rendering the API version contract misleading and risking unintended breaking changes for v1 consumers if v2 behavior diverges in the future.Root Cause
Investigation of codebase files, git history, and documentation confirmed that no separate v1-specific lottery implementation ever existed. The shared router setup was an uncoordinated mapping rather than an explicitly documented versioning strategy.
Fix
Implemented Option 2 (Explicit Documented Sharing):
backend/src/routes/api.tsandbackend/src/routes/lottery.routes.ts.v2Lotteryunder bothv1Routerandv2Routerwith explicit code comments explaining why both versions deliberately share the current lottery implementation.backend/src/routes/index.tsandbackend/src/index.tsto register the versioned/apirouter.CHANGELOG.md.backend/tests/lottery.routes.test.tsto assert contract parity and endpoint behavior.Verification
Executed automated Jest integration test suite (
npx jest tests/lottery.routes.test.ts --forceExit):Open Questions for Maintainers
/api/v1/lotteryand/api/v2/lotteryshould continue sharing the same implementation until future product requirements necessitate separate v1/v2 logic.