Skip to content

Bug: Product stock 1e3 passes validation and is silently saved as 1 #3616

Closed

Description

@yannickmonney

P2 · Reproduced locally against 44e0dcf254975286c0e9dea443b5cd1ca6b23347. No production testing.

Valid input is silently corrupted by a factor of 1000, making inventory counts incorrect.

Reproduction:

  1. Open Add product → Manual entry, enter a name, and continue to Pricing & inventory.
  2. Set Stock to 1e3 (the native number input accepts exponent notation).
  3. Continue to Review: it displays 1e3; choose Create. The same issue occurs when editing a saved product.

Expected: Either accept the numeric meaning, 1000, or reject this spelling before save. Never persist a different count.

Observed: The stock schema validates Number("1e3") as the integer 1000. Create and edit instead call parseInt("1e3"), forwarding stock 1. The actual create wizard reaches Review and submits that different value.

Cause: Stock validation and serialization use different numeric parsers. Both form submit sites carry the same root and belong in one fix.

Frozen observation/control output:

STOCK_EDIT {"entered":"1e3","inputValid":true,"numericMeaning":1000,"submitted":1}
STOCK_EDIT_CONTROL {"entered":"1000","submitted":1000}
STOCK_CREATE {"reviewed":"1e3","submitted":1}

Control: The ordinary decimal spelling 1000 forwards stock 1000. The input reports validity true and valueAsNumber 1000 for the exponent case.

Verification command (audit scratch files are outside the source checkout):

/Users/yannick/.npm/_npx/22f2fe8d8bc13000/node_modules/.bin/bun x vitest run --config /Users/yannick/.codex/notes/tale-100-findings/commerce-proof/vitest.config.ts --maxWorkers 2 --reporter verbose --silent=false

The real HTTP readback checks use python3 /Users/yannick/.codex/notes/tale-100-findings/commerce-proof/api-probe.py; all writes were to six named Commerce audit fixtures retained on the isolated local stack.

Proof boundary: Actual ProductCreateDialog and ProductEditDialog, real form schemas and input change/submit events executed in jsdom. Only mutation/upload seams were mocked. No production testing or browser-native typing claim.

Source:

Deduplication: All-state stock exponent search returned no issues; product issue titles reviewed. Import/parser issues #3580–3582 are a different path and are excluded.

Acceptance: Add a regression across the failing boundary, preserve the successful control, and verify the corrected UI/request/readback behavior.

Parent verification: independently reran the frozen component suite successfully; retained output: commerce-proof/parent-components-confirmed.log. Live all-state issue titles and relevant older reports were reviewed before filing.

Activity

  1. added 3 commits that reference this issue on Oct 9, 2026
    f6b0b7e
    e3bdb6a
    4ff3ff2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugservice: platform

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions