id: mod-idempotency-key-builder
language: ts
severity: error
message: hand-rolled idempotency key in money path
note: '{"severity":"high","category":"api","resolution":"Use buildIdempotencyKey from @platform-modules/util for money-path idempotency keys instead of template literals or string concatenation (money.md M3 — proven reversal-key divergence)."}'
files:
  - '**/packages/billing/src/**/*.ts'
  - '**/packages/ledger/src/**/*.ts'
  - '**/packages/commerce-*/src/**/*.ts'
  - '**/packages/invoicing/src/**/*.ts'
  - '**/.slopgate/fixtures/src/**/*.ts'
ignores:
  - '**/*.test.*'
rule:
  kind: pair
  all:
    - has: { field: key, regex: '^[''"]?idempotency_?[Kk]ey[''"]?$' }
    - has:
        field: value
        any:
          - kind: template_string
          - kind: binary_expression
