Skip to content

feat(export): send reviewed line items to the ERP (contract v2) #46

Description

@Fluory

Ziel

Approved requests reach the ERP with their reviewed line items (description, quantity, unit, material, dimensions), not only the three header fields of contract v1. Today corrected line items are audited (#25, PR #42) but never exported.

Akzeptanzkriterien

  • The ERP contract (contracts/erp-export.openapi.yaml) gains lineItems in a backwards-compatible way (new version or optional field – decision below) and the REST adapter + in-memory mock accept it.
  • When a request with line items is approved, the export payload contains every line item with its reviewed value (latest correction of the current run, else the extraction).
  • A line-item value that breaks an ERP limit blocks the approval with a readable message (same rule as exportLimitViolations for header fields) – never cut silently.
  • The payload stays deterministic: a retry sends the same body under the same Idempotency-Key; exactly-once (idempotency key + unique export row + row lock) is unchanged.

Nicht Teil dieser Aufgabe

Betroffene Bereiche

  • contracts/erp-export.openapi.yaml, src/features/export/{contract,payload,adapter}.ts, src/features/review (reviewed values per item)

Testplan

Kriterium Prüfart
Contract + mock accept line items contract/unit test
Payload carries reviewed line items integration test (approve → export → mock record)
Limit violation blocks approval integration test
Retry sends identical body integration test (existing exactly-once suite extended)

Offene Entscheidungen

  • Contract v2 (/v2/) or an optional lineItems field in v1? (API rule: breaking changes only with a new version.)
  • ERP limits per line-item field (length, max. number of items).

Security/Privacy betroffen?

Public API contract change → human approval of the contract (SYSTEM.md §5). No new personal data beyond what is already exported.

Found during the overnight run (#2 morning report, review of PR #42).

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

featureNew capabilityreadyDefinition of Ready met – may be claimed

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions