Skip to content

Serial-number create (POST /serial_numbers) semantics appear stale: 422 for unknown strings, not 200+failed #983

Description

@dougborg

Context

While verifying PR #980 assumptions against the live test tenant (2026-07-14), several documented POST /serial_numbers behaviors turned out to be stale. Our spec (CreateSerialNumberResourceType, CreateSerialNumberFailureReason, the endpoint description) and the MCP add_serial_numbers tool describe a graceful 200 + successful/failed arrays model where a non-existent serial string lands in failed with reason: MISSING. The live wire did not behave that way.

Observed (live test tenant, 2026-07-14)

  • POST /serial_numbers resource_type=SalesOrderRow, unknown serial string → 422 "serial numbers not found: …" (not 200+failed:MISSING).
  • resource_type=Production, unknown string → 422 UnknownSerialNumber.
  • Duplicate string, and mixed new+duplicate → 422 UnknownSerialNumber for every string.
  • Minting a new string to a freshly-created NOT_STARTED ManufacturingOrder also returned 422 UnknownSerialNumber (nothing attached) — so the "mint types don't need the string to pre-exist" claim is suspect, or minting is MO-state-dependent (serials only mintable once production has run).
  • Non-existent resource_id404 NotFoundError (already corrected in feat: attach serial numbers via unified traceability input #980).

What needs re-verification

  1. Does the 200 + successful/failed partial-outcome shape (CreateSerialNumbersResponse) still occur for any input, or has the endpoint moved to hard 422 on any invalid string?
  2. The real mint-vs-transfer boundary and whether minting requires the MO/PO to be in a specific state (e.g. a completed production).
  3. Whether CreateSerialNumberFailureReason (DUPLICATE/MISSING) is still reachable, or dead.

Scope note

PR #980 corrected only the claims it directly touched (Production is a valid transfer type; 404 for missing ids; removed the now-false "others return 200+failed" contrast). This issue tracks the fuller re-characterization of the create semantics + response shape, which is out of scope for #980.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions