From 0391bb2cd4704093d12989ffc9ee70e6d0ca7ce5 Mon Sep 17 00:00:00 2001 From: bruno souza Date: Fri, 9 Oct 2026 19:16:49 +0100 Subject: [PATCH 1/3] spec: propose add-estimated-delivery-date from the one-line request (v1, Claude) --- .../.openspec.yaml | 2 + .../add-estimated-delivery-date/design.md | 7 +++ .../add-estimated-delivery-date/proposal.md | 61 +++++++++++++++++++ .../specs/delivery-status/spec.md | 26 ++++++++ .../add-estimated-delivery-date/tasks.md | 16 +++++ 5 files changed, 112 insertions(+) create mode 100644 openspec/changes/add-estimated-delivery-date/.openspec.yaml create mode 100644 openspec/changes/add-estimated-delivery-date/design.md create mode 100644 openspec/changes/add-estimated-delivery-date/proposal.md create mode 100644 openspec/changes/add-estimated-delivery-date/specs/delivery-status/spec.md create mode 100644 openspec/changes/add-estimated-delivery-date/tasks.md diff --git a/openspec/changes/add-estimated-delivery-date/.openspec.yaml b/openspec/changes/add-estimated-delivery-date/.openspec.yaml new file mode 100644 index 0000000..8126432 --- /dev/null +++ b/openspec/changes/add-estimated-delivery-date/.openspec.yaml @@ -0,0 +1,2 @@ +schema: spec-driven +created: 2026-10-09 diff --git a/openspec/changes/add-estimated-delivery-date/design.md b/openspec/changes/add-estimated-delivery-date/design.md new file mode 100644 index 0000000..8df662e --- /dev/null +++ b/openspec/changes/add-estimated-delivery-date/design.md @@ -0,0 +1,7 @@ +## Design + +No technical decision between real alternatives. Each entry in the existing +DataWeave `orders` variable holds a status and an estimated delivery date +(`null` for `DELIVERED`); the success branch adds `estimatedDeliveryDate` to the +body. The date is kept as a `YYYY-MM-DD` string so it is returned exactly as +stored. Validation, `404` and `405` branches are unchanged. diff --git a/openspec/changes/add-estimated-delivery-date/proposal.md b/openspec/changes/add-estimated-delivery-date/proposal.md new file mode 100644 index 0000000..4e53fb1 --- /dev/null +++ b/openspec/changes/add-estimated-delivery-date/proposal.md @@ -0,0 +1,61 @@ +## Why + +The product owner asked: "Agora precisamos mostrar também a data prevista de +entrega." The delivery-status endpoint returns only `orderNumber` and `status`; +clients cannot see when an order is expected to arrive. + +## What Changes + +- The successful response of `GET /api/orders/{orderNumber}/delivery-status` + gains a third field with the estimated delivery date. +- The sample orders gain an estimated delivery date each. +- Error responses, validation, `404` and `405` behaviour do not change. + +Proposed defaults, pending the product owner's answers below: + +- Field name `estimatedDeliveryDate`, a date string `YYYY-MM-DD` (no time, no + time zone). +- The date is stored with each sample order, not calculated. +- The field is always present; it is `null` for a `DELIVERED` order. +- Sample data: `1001` `IN_TRANSIT` `2026-10-15`, `1002` `PENDING` + `2026-10-20`, `1003` `DELIVERED` `null`. + +## Open Questions + +1. **Delivered orders**: should a `DELIVERED` order show the estimate it had, + the actual delivery date (a different field), nothing (`null`), or omit the + field? Proposed: `null`. +2. **Unknown estimate**: can a `PENDING` order have no estimate yet? If so, + `null` or omit the field? Proposed: `null`; no sample order exercises it. +3. **Format and precision**: date only, or date and time / time window? Which + time zone? Proposed: date only, `YYYY-MM-DD`. +4. **Source**: a fixed value per order, or calculated (e.g. from a shipping + date plus a lead time)? Proposed: fixed per order in the sample data. +5. **Field name**: proposed `estimatedDeliveryDate`. + +This change must not be approved until these are answered or the defaults are +accepted. + +## Out of Scope + +- Actual delivery date, delivery history, tracking events, carrier details. +- Calculating or updating estimates; any new endpoint or query parameter. +- Changes to error responses, validation or supported methods. + +## Capabilities + +### New Capabilities + +None. + +### Modified Capabilities + +- `delivery-status`: the successful response includes the estimated delivery + date. + +## Impact + +- `src/main/mule/delivery-status.xml`: sample data and success body. +- `README.md`: updated curl evidence for the success scenarios. +- Breaking for clients that reject unknown fields: the body no longer has + "exactly two fields". diff --git a/openspec/changes/add-estimated-delivery-date/specs/delivery-status/spec.md b/openspec/changes/add-estimated-delivery-date/specs/delivery-status/spec.md new file mode 100644 index 0000000..0fa0605 --- /dev/null +++ b/openspec/changes/add-estimated-delivery-date/specs/delivery-status/spec.md @@ -0,0 +1,26 @@ +## MODIFIED Requirements + +### Requirement: Return delivery status by order number +The API SHALL return the current delivery status of an order when called with +`GET /api/orders/{orderNumber}/delivery-status` for an order number it knows. +The order number is an identifier matched exactly as sent: leading zeros are +part of it and are not removed. A successful response SHALL have status `200`, +header `Content-Type: application/json` and a body with exactly three fields: +`orderNumber` (string, as sent), `status` (one of `PENDING`, `IN_TRANSIT`, +`DELIVERED`) and `estimatedDeliveryDate` (string `YYYY-MM-DD`, or `null` when +the order is `DELIVERED`). + +#### Scenario: Known order in transit +- **WHEN** a client sends `GET /api/orders/1001/delivery-status` and order `1001` has status `IN_TRANSIT` and estimated delivery date `2026-10-15` +- **THEN** the API responds `200` with `Content-Type: application/json` +- **AND** the body is `{"orderNumber": "1001", "status": "IN_TRANSIT", "estimatedDeliveryDate": "2026-10-15"}` + +#### Scenario: Known order pending +- **WHEN** a client sends `GET /api/orders/1002/delivery-status` and order `1002` has status `PENDING` and estimated delivery date `2026-10-20` +- **THEN** the API responds `200` with `Content-Type: application/json` +- **AND** the body is `{"orderNumber": "1002", "status": "PENDING", "estimatedDeliveryDate": "2026-10-20"}` + +#### Scenario: Known order delivered +- **WHEN** a client sends `GET /api/orders/1003/delivery-status` and order `1003` has status `DELIVERED` +- **THEN** the API responds `200` with `Content-Type: application/json` +- **AND** the body is `{"orderNumber": "1003", "status": "DELIVERED", "estimatedDeliveryDate": null}` diff --git a/openspec/changes/add-estimated-delivery-date/tasks.md b/openspec/changes/add-estimated-delivery-date/tasks.md new file mode 100644 index 0000000..36b60c2 --- /dev/null +++ b/openspec/changes/add-estimated-delivery-date/tasks.md @@ -0,0 +1,16 @@ +# Tasks + +Blocked until the product owner answers the open questions in `proposal.md` +or accepts the proposed defaults. + +## 1. Application + +- [ ] 1.1 Add the estimated delivery date to the sample orders and `estimatedDeliveryDate` to the success body in `src/main/mule/delivery-status.xml`; verified by `mvn clean package` succeeding (HTTP behaviour is verified in group 2) + +## 2. Evidence + +Run the application locally. For each task, update `README.md` with the curl call and the real response (status line, `Content-Type` and body). A task is done only when the captured status and `Content-Type` match its scenario and the JSON body matches it structurally (same field names, types and values; whitespace and field order do not matter). + +- [ ] 2.1 Scenarios "Known order in transit", "Known order pending" and "Known order delivered" +- [ ] 2.2 Re-run one call per unchanged error scenario (`404`, `400`, `405`) and confirm the responses are unchanged +- [ ] 2.3 Run `openspec validate --all --strict`; verified by it passing From 73ac467f1620fc00978e8f603a52e5160a6165b4 Mon Sep 17 00:00:00 2001 From: bruno souza Date: Fri, 9 Oct 2026 19:20:45 +0100 Subject: [PATCH 2/3] spec: record the owner's answers in add-estimated-delivery-date (v2) --- .../add-estimated-delivery-date/proposal.md | 36 +++++++++---------- .../add-estimated-delivery-date/tasks.md | 3 -- 2 files changed, 18 insertions(+), 21 deletions(-) diff --git a/openspec/changes/add-estimated-delivery-date/proposal.md b/openspec/changes/add-estimated-delivery-date/proposal.md index 4e53fb1..09f6111 100644 --- a/openspec/changes/add-estimated-delivery-date/proposal.md +++ b/openspec/changes/add-estimated-delivery-date/proposal.md @@ -11,30 +11,30 @@ clients cannot see when an order is expected to arrive. - The sample orders gain an estimated delivery date each. - Error responses, validation, `404` and `405` behaviour do not change. -Proposed defaults, pending the product owner's answers below: +Decided with the product owner (2026-10-09): - Field name `estimatedDeliveryDate`, a date string `YYYY-MM-DD` (no time, no time zone). - The date is stored with each sample order, not calculated. -- The field is always present; it is `null` for a `DELIVERED` order. +- The field is always present. `PENDING` and `IN_TRANSIT` orders always have a + date; only a `DELIVERED` order has `null`. - Sample data: `1001` `IN_TRANSIT` `2026-10-15`, `1002` `PENDING` `2026-10-20`, `1003` `DELIVERED` `null`. -## Open Questions - -1. **Delivered orders**: should a `DELIVERED` order show the estimate it had, - the actual delivery date (a different field), nothing (`null`), or omit the - field? Proposed: `null`. -2. **Unknown estimate**: can a `PENDING` order have no estimate yet? If so, - `null` or omit the field? Proposed: `null`; no sample order exercises it. -3. **Format and precision**: date only, or date and time / time window? Which - time zone? Proposed: date only, `YYYY-MM-DD`. -4. **Source**: a fixed value per order, or calculated (e.g. from a shipping - date plus a lead time)? Proposed: fixed per order in the sample data. -5. **Field name**: proposed `estimatedDeliveryDate`. - -This change must not be approved until these are answered or the defaults are -accepted. +## Decisions on the open questions + +1. **Delivered orders**: `null`. An estimate for something already delivered + means nothing, and the actual delivery date is a different requirement + nobody asked for. +2. **Unknown estimate**: not allowed. `PENDING` and `IN_TRANSIT` always carry + a date. +3. **Format and precision**: date only, `YYYY-MM-DD`. +4. **Source**: fixed per order in the sample data. +5. **Field name**: `estimatedDeliveryDate`. +6. **Breaking change** (raised by the proposal itself): accepted on purpose. + The previous spec promised "exactly two fields", so clients that reject + unknown fields will break. For this example, versioning the API would be + more change than the request asks for. ## Out of Scope @@ -58,4 +58,4 @@ None. - `src/main/mule/delivery-status.xml`: sample data and success body. - `README.md`: updated curl evidence for the success scenarios. - Breaking for clients that reject unknown fields: the body no longer has - "exactly two fields". + "exactly two fields". Accepted by the product owner (decision 6). diff --git a/openspec/changes/add-estimated-delivery-date/tasks.md b/openspec/changes/add-estimated-delivery-date/tasks.md index 36b60c2..4732d0d 100644 --- a/openspec/changes/add-estimated-delivery-date/tasks.md +++ b/openspec/changes/add-estimated-delivery-date/tasks.md @@ -1,8 +1,5 @@ # Tasks -Blocked until the product owner answers the open questions in `proposal.md` -or accepts the proposed defaults. - ## 1. Application - [ ] 1.1 Add the estimated delivery date to the sample orders and `estimatedDeliveryDate` to the success body in `src/main/mule/delivery-status.xml`; verified by `mvn clean package` succeeding (HTTP behaviour is verified in group 2) From 64367c6abae65d9aceab68d9b2450ff86da56a2d Mon Sep 17 00:00:00 2001 From: bruno souza Date: Fri, 9 Oct 2026 19:21:32 +0100 Subject: [PATCH 3/3] spec: tighten estimatedDeliveryDate wording per review (v3) --- .../add-estimated-delivery-date/specs/delivery-status/spec.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/openspec/changes/add-estimated-delivery-date/specs/delivery-status/spec.md b/openspec/changes/add-estimated-delivery-date/specs/delivery-status/spec.md index 0fa0605..74f209d 100644 --- a/openspec/changes/add-estimated-delivery-date/specs/delivery-status/spec.md +++ b/openspec/changes/add-estimated-delivery-date/specs/delivery-status/spec.md @@ -7,8 +7,8 @@ The order number is an identifier matched exactly as sent: leading zeros are part of it and are not removed. A successful response SHALL have status `200`, header `Content-Type: application/json` and a body with exactly three fields: `orderNumber` (string, as sent), `status` (one of `PENDING`, `IN_TRANSIT`, -`DELIVERED`) and `estimatedDeliveryDate` (string `YYYY-MM-DD`, or `null` when -the order is `DELIVERED`). +`DELIVERED`) and `estimatedDeliveryDate`, which SHALL be a `YYYY-MM-DD` string +for `PENDING` and `IN_TRANSIT` and SHALL be `null` for `DELIVERED`. #### Scenario: Known order in transit - **WHEN** a client sends `GET /api/orders/1001/delivery-status` and order `1001` has status `IN_TRANSIT` and estimated delivery date `2026-10-15`