fix: normalize record identifiers for stable retry scopes
continuous-integration/drone/push Build is passing Details

This commit is contained in:
mihir 2026-10-13 14:36:38 +05:30
parent 5889158b3c
commit c93fe5ef6b
6 changed files with 15 additions and 5 deletions

View File

@ -1,6 +1,6 @@
# Phase 2 implementation verification — 13 October 2026
Final local gate: 29 tests passed, strict TypeScript and lint passed, production build passed with all 27 JavaScript chunks below 500 kB (largest approximately 494 kB). The dependency audit reported zero vulnerabilities.
Final local gate: 30 tests passed, strict TypeScript and lint passed, production build passed with all 27 JavaScript chunks below 500 kB (largest approximately 494 kB). The dependency audit reported zero vulnerabilities.
| Area | Evidence / outcome |
| ---------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |

View File

@ -1,5 +1,5 @@
import { z } from "zod";
export const uuid = z.string().uuid();
export const uuid = z.string().uuid().toLowerCase();
export const currency = z.enum(["INR", "USD", "EUR", "GBP"]);
export const decimal = z.string().regex(/^\d+(?:\.\d{1,2})?$/);
export const amount = z.string().regex(/^(0|[1-9]\d{0,9})\.\d{2}$/);

View File

@ -425,7 +425,7 @@ export default function CatalogAdminPage({ id }: { id?: string }) {
{id && !uuid.safeParse(id).success ? (
<Alert severity="error">Invalid product identifier.</Alert>
) : id ? (
<ProductEditor key={id} id={id} />
<ProductEditor key={uuid.parse(id)} id={uuid.parse(id)} />
) : (
<Products />
)}

View File

@ -361,7 +361,7 @@ export default function InventoryPage({ id }: { id?: string }) {
{id && !uuid.safeParse(id).success ? (
<Alert severity="error">Invalid stock identifier.</Alert>
) : id ? (
<StockEditor key={id} id={id} />
<StockEditor key={uuid.parse(id)} id={uuid.parse(id)} />
) : (
<StockList />
)}

View File

@ -167,7 +167,7 @@ export default function OrdersPage({
{id && !uuid.safeParse(id).success ? (
<Alert severity="error">Invalid order identifier.</Alert>
) : id ? (
<OrderDetail key={id} admin={admin} id={id} />
<OrderDetail key={uuid.parse(id)} admin={admin} id={uuid.parse(id)} />
) : (
<OrderList admin={admin} />
)}

View File

@ -14,6 +14,7 @@ import {
variant,
warehouse,
stock,
stockInput,
adminProductSummary,
pricing,
checkoutInput,
@ -27,6 +28,15 @@ const id = "d66c798a-f764-4b88-8d13-ace328ff1010";
test("organization UUIDs normalize case before session organization checks", () => {
assert.equal(organizationSchema.parse(id.toUpperCase()), id);
});
test("stock identifiers normalize case before request and retry scopes", () => {
assert.equal(
stockInput.parse({
variantId: id.toUpperCase(),
warehouseId: id.toUpperCase(),
}).variantId,
id,
);
});
test("response schemas accept persisted metadata while write schemas stay strict", () => {
const extra = {
id,