Skip to content

Worked journey

Cancel one line without cancelling the whole order

A support lead asks to cancel one unshipped item. Workshop notes mention refunds, but the agreed scope only covers order changes. There is no existing implementation to cite for partial cancellation.

Spec-driven development for a new feature

Intended, not yet built

Plan line-item cancellation against existing order, shipment and payment boundaries, with clear criteria for behaviour that does not exist yet.

New behaviour starts at the top of the twin with nothing below it. Existing order lines, shipment checks and payment interfaces supply the evidence for its boundaries.

Code structureSymbolsCall chainsData modelsBehaviourBusiness modelRequirements

Requirements

Use cases and stories recovered from existing code, plus new ones a team asks for. Each points at the behaviour that implements it, or says nothing does yet.

use case  Customer cancels an order
story     Require a cancellation reason
criterion Shipped orders stay ineligible
code      none yet
Requested, not yet builtRecover requirements from code

Walkthrough

Step by step.

  1. Separate the request from the evidence

    Cite existing order-line identity, shipment checks and payment interfaces where available. Keep partial cancellation labelled as intended. The lead records whether refunds are part of this release instead of letting a plan silently decide.

  2. Write outcomes the reviewer can check

    Given two open lines, cancel the selected line and keep the other active. Given a shipped selected line, return a refusal and preserve both states. Decide separately what the aggregate status should do when the last active line is cancelled.

  3. Plan dependencies and open questions

    Inventory release may need its own integration and evidence. Payment remains an open question unless the scope includes it. The plan records exactly where it stops so a coding agent can avoid inventing work outside the approved feature.

Examples the plan must distinguish

Starting stateActionExpected outcome
Two unshipped active linesCancel one authorized lineOnly the selected line changes
Selected line has shippedRequest the same cancellationRefuse and preserve both states
Only one active line remainsCancel the final lineApply the aggregate-state decision agreed in the requirement
A refund is mentioned only in workshop notesReview scopeResolve the disagreement before adding payment work