Skip to content

fix(contract-service): contractId is a client-optional field, not required#65

Merged
RedAvocado22 merged 1 commit into
mainfrom
fix/create-contract-optional-contract-id
Jul 6, 2026
Merged

fix(contract-service): contractId is a client-optional field, not required#65
RedAvocado22 merged 1 commit into
mainfrom
fix/create-contract-optional-contract-id

Conversation

@RedAvocado22

Copy link
Copy Markdown
Owner

Problem

The #49 fix (PR #62) added @NotBlank to CreateContractRequest.contractId, but that broke the idempotency design: CreateContractUseCase.execute() treats a null contractId as 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 same contractId (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-contract regressed from 201 to 400 and cascaded failures through the rest of the saga.

Fix

Removed @NotBlank from contractId. listingId/terms keep their constraints.

Test plan

  • contract-service test suite passes
  • Full Bruno e2e suite (scripts/run-e2e.sh) passes the core saga end to end

…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.
@RedAvocado22 RedAvocado22 merged commit 7a93d22 into main Jul 6, 2026
2 checks passed
@RedAvocado22 RedAvocado22 deleted the fix/create-contract-optional-contract-id branch July 6, 2026 10:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant