Skip to content

Honor duplicate planning when manually adding orders - #480

Merged
OziinG merged 1 commit into
mainfrom
fix/kfood-duplicate-manual-add
Oct 2, 2026
Merged

OziinG merged 1 commit into
mainfrom
fix/kfood-duplicate-manual-add

Conversation

@OziinG

@OziinG OziinG commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

Manual Add orders still rejected an order already planned in another group, despite the existing duplicate-planning contract. This allows that addition while retaining each group's child partition and leaving the source route and delivery facts unchanged.

Reserved or executing target routes recheck exclusive execution and claim the compatibility projection atomically. Manual additions acquire the same sorted stop locks before order row locks as Dispatch, avoiding a deadlock when they race.

Validation:

  • 153 targeted tests passed, including disposable PostgreSQL regressions for duplicate READY plans, source preservation, retry deduplication, execution conflicts and a forced Dispatch/manual-add race.
  • Prisma generation, full lint and typecheck passed; independent code review has no remaining findings.
  • Full CI is required before merge/deploy. Initial concurrent local lint timed out under memory contention; sequential full lint passed in 148 seconds.

No schema migration or production data mutation. Release the API before the matching K-food Shopify candidate-filter correction.

Change control: EVNSolution/clever-change-control#309

Release verified: merged as 8974e31; exact-main CI 37042597925 and manual deploy 37043266209 succeeded. Production image revision and healthy API were verified. Matching Shopify PR320 is deployed; authenticated order #2324 is now selectable without submitting an addition.

Constraint: Saved plans may share real orders; Dispatch and Start remain exclusive.
Rejected: Remove execution guards with the planning guard | active routes must retain exclusive execution.
Directive: Acquire sorted stop locks before order projection row locks in manual-add paths.
Tested: Prisma generation, typecheck, 151 targeted tests including disposable database concurrency regressions.
Scope-risk: moderate
@OziinG
OziinG merged commit 8974e31 into main Oct 2, 2026
2 checks passed
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