Skip to content

Worked journey

Require a reason to cancel an order

A product lead asks for a reason on new customer cancellations. The engineer finds the shipping guard, an older client with no reason field and a support override whose entry point has not been traced. The proposed rule needs a precise boundary.

Code change impact analysis example

The impact map

Follow a cancellation change from source evidence to criteria, task coverage and the review triggered by a later push.

What to edit, what depends on it, what must keep working, and the one path the twin cannot follow.

Proposed changeRequire a reason when a customer cancels an order

Direct edits

Code the plan expects to change.

  • CancelOrderRequestAdd a required reason field.
  • OrderService.cancelValidate the reason before the status write.
  • V31__add_cancel_reason.sqlNew nullable column, so historical rows stay readable.

Indirect dependencies

Not edited, but reaches the change. Each comes with the path that proves it.

  • mobile-app 3.2 · CancelButtonCalls the endpoint without a reason. It will start receiving validation errors.CancelButton.onPressapi.cancelOrderPOST /orders/{id}/cancel
  • SupportController.overridePossible caller through an interface with two implementations. Check before rollout.SupportController.overrideOrderOps.cancelOrderService.cancel

Regression only

Must keep working. Needs a check, not an edit.

  • order.isShipped() guardUntouched, but a valid reason must not bypass it.
  • Historical cancellationsRows with no reason must still load and export.
  • NightlyExportJob.runPossible reader of orders. Confirm it tolerates the new column.

The map stops here

Known gaps. The report will not say “no impact” past this line.

  • refunds.dispatch(event)The refund handler is chosen at runtime. Whether refunds need the reason is an open question for a person.

Walkthrough

Step by step.

  1. Decide the rollout and data scope

    Record the reason on new customer cancellations. Older records remain readable. Decide whether older client requests receive a compatibility window. Keep the override out of scope until its entry point and shared code have been reviewed.

  2. Make the old guard a criterion

    Reject a missing reason on an otherwise cancellable order. Keep shipped orders blocked even when the reason is present. Verify a historical record still reads. A plan that covers validation and persistence but leaves out the shipping guard has work missing.

  3. Recheck the plan after a push

    Another developer moves the guard into a shared service. The requirement can stay current while the plan needs review against the new source. If support overrides become part of the request, that changes the requirement too.

Change, preserve, or investigate

BoundaryDecisionCheck
New customer requestsRequire and store a reasonValid reason succeeds. Missing reason refuses the request
Shipped ordersPreserve the current refusalA valid reason cannot bypass shipment eligibility
Support overrides and older clientsKeep support out of scope. Review compatibility separatelyTrace the alternate caller and test the supported old client

Review the cancellation change

Follow a source citation, check the plan, and decide what the trace supports. This demo uses mock code and telemetry.

OrderService.java · example

if (order.isShipped()) {
    throw new OrderAlreadyShipped();
}

The captured path rejects a shipped order. Preserve this rule when adding reason validation.