Skip to content

feat(export): export approved requests exactly once to the ERP mock #9

Description

@Fluory

Goal

Approved requests go through the ERP port to the mock (contracts/erp-export.openapi.yaml) with an idempotency key; a request can never be exported twice.

Acceptance criteria

  • The ERP mock stores idempotency keys; a repeated POST with the same key returns the same ERP reference
  • Export record with unique(request_id); transition APPROVED → EXPORTED under a row lock
  • With injected 5xx/timeouts and duplicate job delivery, the request ends EXPORTED exactly once
  • Outbound timeout configured; failures visible as ERROR (stage export)
  • The mock is active only with ERP_MOCK_ENABLED=true

Not part of this task

  • Real ERP mapping, file-based export

Affected areas

  • src/features/export/
  • src/features/erp-mock/
  • contracts/erp-export.openapi.yaml

Test plan

Criterion Check
exactly once integration test with injected failures and duplicate delivery
contract contract test against the OpenAPI schema

Security/Privacy affected?

Outbound data contains personal contact data – synthetic only; no payloads in logs.

Epic: #2 · Architecture: docs/decisions/ADR-0001-pilot-architecture.md

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