3.9 KiB
Product variants: unified implementation
Review branch: codex/product-variants-unified.
Team baseline: 7b0c502a3c17738bd4be6c0623736c7a7d1b775a.
Previous implementation: independent snapshot of the 61 uncommitted source
files from codex/product-variants; the original worktree is preserved.
This change combines the team's catalogue/import/UI integration with the previous implementation's inventory, costing, reservations and durable commerce contracts. It does not apply migrations to an application database.
Integration contracts
- Keep the team's existing core table names and API response compatibility. Extend that schema with a new migration after its existing migration head.
- One physical, posted warehouse ledger is authoritative for native variants; ordinary products retain their established behavior.
- Every posted native line has exact main-unit allocations and a frozen attribute/cost/source snapshot. Cancellation removes the original once; reversals used for audit never create a second stock effect.
- Costing, unit conversion and analytical profit policies remain explicit. Unknown historical costs block conversion instead of being invented.
- Catalogue identity uses database and external IDs. Labels can be renamed without replacing a SKU. Public metadata cannot grant migration exceptions.
- Native Woo inventory is owned by Hesabix. Orders reserve centrally; stock publication uses a transactional outbox and a connection/variant version. Legacy mappings remain supported and are never silently converted.
- Keep team Woo-to-Hesabix import and opening-inventory entry points; add Hesabix-to-Woo publication through the same validated mapping contract.
- Existing production/bundle/integration paths must reject unsupported native operations before changing inventory or reservations.
Work and review checklist
- Extend team models and add the frozen
20261101_000004_variants_unifiedmigration. - Integrate exact allocations, posting/cancellation and partial fulfilment.
- Separate physical COGS, analytical policies and purchase-price snapshots.
- Integrate migration preview/apply and derived-projection reconciliation.
- Integrate reservations, order/refund inbox and durable stock outbox.
- Integrate both catalogue directions and per-variant opening quantities/costs.
- Integrate normal/quick-sales UI, barcode and stable option editing.
- Add correct-behavior regressions for the reproduced team defects.
- Run available Python/Dart checks; record unavailable PHP/runtime checks.
- Record remaining review/deployment gates in
PRODUCT_VARIANTS_UNIFICATION.fa.md.
Existing team Native data is deliberately not automatically adopted. Posted
Native products become reconciliation_required; legacy secondary-unit
allocations require explicit historical conversion reconciliation before schema
upgrade. Existing external Native maps require a reviewed adoption operation,
which is not implemented in this branch. Unknown historical attributes/costs
are never reconstructed from today's catalogue and presented as frozen facts.
Future warehouse documents remain drafts. A backdated native post is accepted only when no later posted native product movement exists; effective-date cost chain replay is not implemented. Production/bundle paths remain explicitly unsupported for native inventory. This is a consolidated review branch, not a declaration of production deployment readiness.
The source audit is recorded outside the repository in
variant-team-review-2026-11-01/REPORT.fa.md. Acceptance checks must cover all
T01–T29 findings and the known limitations of the previous implementation.
Operational verification
No application database is selected or modified by this source integration. PostgreSQL migration/concurrency and WordPress end-to-end verification require an explicitly selected disposable environment. Do not interpret an isolated domain test as proof of production deployment readiness.