Repository navigation
Description
P2 · Reproduced locally against 44e0dcf254975286c0e9dea443b5cd1ca6b23347. No production testing.
Valid input is silently corrupted by a factor of 1000, making inventory counts incorrect.
Reproduction:
- Open Add product → Manual entry, enter a name, and continue to Pricing & inventory.
- Set Stock to
1e3(the native number input accepts exponent notation). - 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=falseThe 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:
- services/platform/app/features/products/utils/product-number-schema.ts:29
- services/platform/app/features/products/components/product-create-dialog.tsx:217
- services/platform/app/features/products/components/product-edit-dialog.tsx:210
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
fix(platform): send product stock as the number the form accepted
fix(platform): send product stock as the number the form accepted
fix(platform): send product stock as the number the form accepted