fix(products): serialize Variant Position explicitly — INV-12 round-trip bug
A stored variant position is a CatalogVariant attribute, not a fields{} entry,
so the serializer emitted an empty Variant Position cell — which re-imports as
'reset to file order'. A non-sequential stored position (a merchant can import
explicit positions) then round-tripped to a spurious update, violating INV-12.
Emit str(variant.position) explicitly (like _write_image). The property-test
generator now assigns non-sequential positions to lock the regression, plus a
targeted test. Also wires isExportEnabled into ProductsPage (was dead code).
Both caught by the final code review.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -109,6 +109,11 @@ def _write_variant(row: dict[str, str], product: CatalogProduct, variant) -> Non
|
||||
# (a no-option product's single variant carries all-NULL options).
|
||||
if product.option_names[slot - 1] and value is not None:
|
||||
row[f"Option{slot} Value"] = value
|
||||
# position is a CatalogVariant attribute, not a fields{} entry — emit it
|
||||
# explicitly. An empty Variant Position cell re-imports as "reset to file
|
||||
# order", so a non-sequential stored position would round-trip to an update
|
||||
# (INV-12). (Like _write_image, which emits its position attribute.)
|
||||
row["Variant Position"] = str(variant.position)
|
||||
for field, col in _VARIANT_FIELD_TO_COL.items():
|
||||
if field in variant.fields:
|
||||
row[col] = _cell(variant.fields[field])
|
||||
|
||||
Reference in New Issue
Block a user