feat(F-091): completed feature

This commit is contained in:
chattie
2026-08-20 21:47:31 +02:00
parent d29c9b71c9
commit 4d0970df5d
12 changed files with 204 additions and 61 deletions

View File

@@ -0,0 +1,17 @@
# F-091 — Implementer evidence
## Changes
- `project/src/modules/catalog/domain/errors.ts` now records whether a duplicate variant code is `sku` or `ean`.
- `project/src/modules/catalog/infrastructure/pg-variant-repository.ts` maps PostgreSQL unique constraints (`*_sku_key`, `*_ean_key`) to that field while preserving the 409 uniqueness rule.
- `project/apps/admin/src/features/products/components/sections/InventorySection.tsx`
- Guards each SKU/EAN variant save with an in-flight key so Enter followed by blur cannot submit duplicate PATCH requests.
- Shows `El SKU ya existe en otra variante` or `El EAN ya existe en otra variante` for 409 conflicts instead of generic `Error`.
## Validation
- Root `npm run typecheck` → exit 0
- Root `npm test -- --run` → 133 passed, 56 skipped
- Admin `npx tsc --noEmit` → exit 0
- Admin ESLint on `InventorySection.tsx` → exit 0
- SKU/EAN uniqueness remains enforced by the existing database constraints.

View File

@@ -0,0 +1,15 @@
{
"feature_id": "F-091",
"agent": "leader",
"verdict": "APPROVED",
"summary": "F-091 keeps SKU/EAN uniqueness, prevents duplicate in-flight updates, and explains 409 conflicts by field.",
"evidence": [
"reviewer.json verdict=APPROVED",
"security.json verdict=APPROVED",
"qa.json verdict=APPROVED",
"scripts/verify.sh exit 0",
"Root tests: 133 passed, 56 skipped",
"Root and admin typechecks exit 0"
],
"timestamp": "2026-08-20T19:47:30Z"
}

View File

@@ -0,0 +1,14 @@
{
"feature_id": "F-091",
"agent": "qa",
"verdict": "APPROVED",
"summary": "Variant conflict handling and duplicate-submit protection pass the complete available checks.",
"evidence": [
"Root npm run typecheck exit 0",
"Root npm test: 133 passed, 56 skipped",
"Admin npx tsc --noEmit exit 0",
"Admin ESLint on InventorySection exit 0",
"scripts/verify.sh exit 0"
],
"timestamp": "2026-08-20T19:47:20Z"
}

View File

@@ -0,0 +1,13 @@
{
"feature_id": "F-091",
"agent": "reviewer",
"verdict": "APPROVED",
"summary": "The API keeps SKU/EAN uniqueness, identifies the conflicting field from the database constraint, and the UI prevents duplicate in-flight saves while presenting actionable conflict feedback.",
"evidence": [
"Existing 409 uniqueness behavior is preserved",
"SKU and EAN constraint names map to field-specific domain messages",
"Enter plus blur is guarded by a per-field in-flight key",
"Root and admin typechecks pass"
],
"timestamp": "2026-08-20T19:47:00Z"
}

View File

@@ -0,0 +1,13 @@
{
"feature_id": "F-091",
"agent": "security",
"verdict": "APPROVED",
"summary": "The fix does not relax uniqueness or alter authorization. Conflict messages reveal only that the submitted SKU/EAN is already in use, without exposing another variant's identity or data.",
"evidence": [
"Database UNIQUE constraints remain authoritative for SKU and EAN",
"No SQL interpolation or new input path added",
"Only field type (SKU/EAN) is returned, not conflicting records",
"No dependencies, secrets, auth, or permission changes"
],
"timestamp": "2026-08-20T19:47:10Z"
}