← back to Designer Wallcoverings
fix(TK-11403): price-integrity gate fails CLOSED on empty/missing variants (finding #2)
674994eca65d4a293a26d48dde2b81138b97264a · 2026-09-14 16:18:02 -0700 · Steve
assertPriceIntegrity() coerces a non-array `variants` to [] and every price test
is per-variant, so zero variants meant the gate ran to completion proving NOTHING
and returned ok:true — a fail-OPEN a malformed/empty payload sailed through. Now
emit a block-severity Class-C `empty-variants` finding, per "an unmeasured input
is never PASS" (CLAUDE.md TK-11431 amendment 1). Closes review finding #2. This
protective commit lands an edit already present in the working tree (idle 36m,
no live writer); scoped to this one file by explicit path.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Files touched
M DW-Programming/ImportNewSkufromURL/lib/price-integrity-gate.ts
Diff
commit 674994eca65d4a293a26d48dde2b81138b97264a
Author: Steve <steve@designerwallcoverings.com>
Date: Mon Sep 14 16:18:02 2026 -0700
fix(TK-11403): price-integrity gate fails CLOSED on empty/missing variants (finding #2)
assertPriceIntegrity() coerces a non-array `variants` to [] and every price test
is per-variant, so zero variants meant the gate ran to completion proving NOTHING
and returned ok:true — a fail-OPEN a malformed/empty payload sailed through. Now
emit a block-severity Class-C `empty-variants` finding, per "an unmeasured input
is never PASS" (CLAUDE.md TK-11431 amendment 1). Closes review finding #2. This
protective commit lands an edit already present in the working tree (idle 36m,
no live writer); scoped to this one file by explicit path.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
---
.../lib/price-integrity-gate.ts | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
diff --git a/DW-Programming/ImportNewSkufromURL/lib/price-integrity-gate.ts b/DW-Programming/ImportNewSkufromURL/lib/price-integrity-gate.ts
index d579997a..2e980b1e 100644
--- a/DW-Programming/ImportNewSkufromURL/lib/price-integrity-gate.ts
+++ b/DW-Programming/ImportNewSkufromURL/lib/price-integrity-gate.ts
@@ -245,6 +245,28 @@ export function assertPriceIntegrity(input: PriceIntegrityInput): GateResult {
const variants = Array.isArray(input.variants) ? input.variants : [];
+ // ---- Structural guard (TK-11357, vp-engineering review 2026-09-14): an
+ // EMPTY/MISSING variants array is NEVER a pass. -------------------------------
+ // Every price test below is per-variant, so zero variants means the gate runs
+ // to completion having proven NOTHING and — before this guard — returned
+ // ok:true. That is a fail-OPEN a malformed/empty payload sails straight
+ // through. Per "an unmeasured input is never PASS" (CLAUDE.md TK-11431
+ // amendment 1), emit a BLOCK. No legitimate caller passes zero variants (all
+ // four price-writers construct >=1); a product that ships zero SAMPLE variants
+ // is a different, allowed case handled by the sample-outcome test below.
+ if (variants.length === 0) {
+ findings.push({
+ class: 'C',
+ code: 'empty-variants',
+ severity: 'block',
+ message:
+ `price-integrity gate received ZERO variants for ${input.dwSku ?? '(no dwSku)'} — ` +
+ `cannot prove any price is safe; a malformed/empty payload must fail closed`,
+ observed: 0,
+ expected: '>= 1 variant to evaluate',
+ });
+ }
+
// Cost known & positive? Needed to PROVE the Class B MARKUP floor. When
// unknown, markup is a non-blocking WARNING (A-with-teeth), and the cost-free
// absolute-dollar floor below is what keeps unknown-cost from being a blind allow.
← 854aaa3f fix(weight-guard): batch route honors real product_type for
·
back to Designer Wallcoverings
·
fix(TK-11357): versa scraper counts failed page-scrapes so a 87cf6ccc →