fix(contract-service): contractId is a client-optional field, not required#65
Merged
Merged
Conversation
…uired PR #62 (#49 fix) added @notblank to CreateContractRequest.contractId, but CreateContractUseCase.execute() explicitly treats a null contractId as valid: it generates one via UUID.randomUUID() when the client omits it, and only requires the client to resend the same contractId on an idempotent retry. @notblank made the initial create call (no contractId) fail with 400, breaking the idempotency design entirely — caught by re-running the Bruno e2e suite after merging #49, which showed 06-create-contract regressing from 201 to 400 and cascading failures through the rest of the saga.
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.
Problem
The #49 fix (PR #62) added
@NotBlanktoCreateContractRequest.contractId, but that broke the idempotency design:CreateContractUseCase.execute()treats a nullcontractIdas valid on purpose — it generates a UUID server-side when the client omits it on the initial create, and only expects the client to resend the samecontractId(from the response) on an idempotent retry. Requiring it up front makes the very first create call fail with 400.Caught by re-running the Bruno e2e suite (
scripts/run-e2e.sh) after merging the #46-53 batch —06-create-contractregressed from 201 to 400 and cascaded failures through the rest of the saga.Fix
Removed
@NotBlankfromcontractId.listingId/termskeep their constraints.Test plan
contract-servicetest suite passesscripts/run-e2e.sh) passes the core saga end to end