Skip to content

fix(returns): lane-2 verified destination and zero-leg ledger crash on pickup (#1224) - #1238

Merged
KaluMuso merged 1 commit into
masterfrom
claude/fix-1224-1796508101
Dec 6, 2026
Merged

KaluMuso merged 1 commit into
masterfrom
claude/fix-1224-1796508101

Conversation

@KaluMuso

@KaluMuso KaluMuso commented Dec 5, 2026

Copy link
Copy Markdown
Owner

Requested by King Knowing · project thread

Fixes #1224.

Problem

  1. Lane-2 (change of mind) always returned 422: the router never passes customer_momo and create_lane2_return required it.
  2. Wiring that up as is would crash pickup orders: refund_lane2 posted a zero vendor_payable leg when vendor_retained is 0 (pickup, no return transport), and a zero leg is rejected. The refund row was already inserted as processing. A partial dispute on a pickup order could hit the same crash.

Change

  • refund_lane2 drops zero legs (vendor retained, restocking fee, coupon), so the remaining legs still balance. The non-zero shape is unchanged (golden test untouched).
  • create_lane2_return resolves the destination with the same verified-number rule as lane 1 (the Mobile Money number that paid, else the SMS-confirmed phone). customer_momo and customer_rail in the call are ignored, so a request can never choose where the money goes. A refusal happens before any write, so no return row is left behind. The payout kill switch still runs first.

Tests

New: lane-2 works with no number in the request; the request cannot redirect the destination; an unverified destination refuses with no returns row and no refund; pickup order drops the zero vendor leg; a 0% restocking fee drops the commission leg. tests/test_returns_lane2.py, test_ledger.py, test_coupons_rules.py, test_refund_payout_guard.py: 99 passed, 5 skipped. ruff, mypy and gitleaks 8.28.0 clean. This touches money legs and refund destination, so it needs a reviewer and King's approval before merge.


Generated by Claude Code

…orders no longer crash the ledger (#1224)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SgAB9Eyg7j2WRP7JBQPV6C
@KaluMuso KaluMuso self-assigned this Dec 5, 2026
@vercel

vercel Bot commented Dec 5, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
convergeo-admin Ready Ready Preview Dec 5, 2026 10:54pm UTC
convergeo-customer Ready Ready Preview Dec 5, 2026 10:54pm UTC
convergeo-vendor Ready Ready Preview Dec 5, 2026 10:54pm UTC

Request Review

@KaluMuso
KaluMuso marked this pull request as ready for review December 5, 2026 22:04
@chatgpt-codex-connector

Copy link
Copy Markdown
Codex Review Summary: ❌ Failed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ❌ Failed 2026-12-05T22:04:06.607650Z
We couldn’t complete this review. Comment @codex review to try again.
5576287 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

This branch was successfully deployed

3 active deployments
Preview – convergeo-customer — 5576287b Deployed Dec 5, 2026 by vercel[bot]
Preview – convergeo-vendor — 5576287b Deployed Dec 5, 2026 by vercel[bot]
Preview – convergeo-admin — 5576287b Deployed Dec 5, 2026 by vercel[bot]
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.

QA-1 MONEY Medium: lane-2 returns always 422, and zero vendor_retained leg crashes refund_lane2 on pickup orders

2 participants