The complete reconciliation workflow, including its identifier rules and output contract. It ends with a review file; it does not change live records.
SKU UPC Exact Reconciliation
When joining operational datasets, freeze grain and source clocks as well as IDs. Product, variant, warehouse, order line and immutable snapshot are not interchangeable. Unknown, absent, stale, inactive and verified zero remain separate. A current barcode match does not prove package-size equivalence or historical inventory coverage. Route stock/history interpretation to cloud-inventory-snapshot-reconciliation; do not import one company's warehouse/STR policy as a generic identifier rule.
Objective
Determine which identifier relationships are proven, missing, duplicated, or conflicting before any product-data update. Keep this Skill read-only.
Use its outputs as evidence for a separately approved update workflow such as shopify-product-data-safe-update. Never convert an audit result directly into an online write.
Establish The Contract
Before comparing files, state:
- Authoritative source for SKU, UPC/barcode, and product grouping.
- Target system being audited.
- Exact population in scope.
- File/sheet and row-count controls.
- Column mappings and data types.
- Whether leading zeros, prefixes, or literal punctuation are meaningful.
- Explicit exclusions.
Do not assume ERP is authoritative unless the user or project rules say so. When ERP is declared authoritative, preserve its literal SKU and UPC values.
Read identity-rules.md before matching. Read output-contract.md before delivering results.
Prepare The Inputs
- Preserve untouched source files.
- Convert only the relevant sheet to UTF-8 CSV when using the bundled script.
- Import SKU and UPC columns as text.
- Preserve leading zeros.
- Retain raw value, normalized comparison value, source row, title, variant, group ID, and platform object ID when available.
- Record duplicate source rows instead of silently deduplicating them.
Excel display, scientific notation, and formula errors are not identity truth. Inspect the underlying cell value and source system.
Exact Matching Hierarchy
Use only deterministic identity:
- Exact platform object or variant ID when reconciling the same platform.
- Exact unique UPC/barcode.
- Exact unique SKU.
- Exact UPC and SKU pointing to the same row.
- Explicit parent/group identifier for SPU or variant-group reporting.
Product title, shade name, image, vendor, size, and neighboring rows are review evidence only. Never create an identity link from similarity.
If exact UPC and exact SKU point to different target rows, classify CROSS_IDENTIFIER_CONFLICT. Do not choose one silently.
Keep SPU Grouping Separate
SKU/UPC matching is row identity. SPU grouping is a separate relationship.
Group variants only with an explicit source such as:
- ERP parent/product ID.
- Shopify Product ID or handle from a verified export.
- Mirakl Variant Group Code.
- Approved supplier parent code.
Do not strip shade names from titles and infer that rows belong to one SPU. When no explicit group key exists, keep rows ungrouped and mark the SPU result unknown.
Run The Local Reconciler
The bundled script compares one authoritative CSV with one target CSV:
python scripts/reconcile_identifiers.py `
--truth authoritative.csv `
--target target.csv `
--truth-sku "SKU" `
--truth-upc "UPC" `
--target-sku "Variant SKU" `
--target-upc "Variant Barcode" `
--truth-title "Product Name" `
--target-title "Title" `
--truth-group "Parent ID" `
--target-group "Product ID" `
--output-dir reconciliation-output
Optional title and group columns are retained for review but never used for matching.
Outputs:
REVIEW_FIRST_identifier_reconciliation.csvREVIEW_FIRST_identifier_conflicts_and_gaps.csvAUDIT_identifier_reconciliation_summary.json
The script makes zero network calls and zero online writes.
Interpret Results
Use these primary states:
EXACT_BOTH: unique UPC and SKU agree.MATCH_BY_UPC_SKU_MISSING_TARGET: exact unique UPC; target SKU blank.MATCH_BY_UPC_SKU_CONFLICT: exact unique UPC; SKU values disagree.MATCH_BY_SKU_UPC_MISSING_TARGET: exact unique SKU; target UPC blank.MATCH_BY_SKU_UPC_CONFLICT: exact unique SKU; UPC values disagree.EXACT_UPC_ONLY: UPC proves the row; no authoritative SKU comparison.EXACT_SKU_ONLY: SKU proves the row; no authoritative UPC comparison.CROSS_IDENTIFIER_CONFLICT: UPC and SKU point to different target rows.DUPLICATE_CONFLICT: an identifier is not unique in truth or target.TARGET_REUSED_CONFLICT: multiple truth rows would consume one target row.MISSING_IDENTIFIERS: truth row has neither usable SKU nor UPC.TRUTH_ONLY: no exact target match.TARGET_ONLY: target row was not consumed by any exact match.
Only EXACT_BOTH is fully reconciled without qualification. Missing or conflicting fields require human review and a separate update approval.
Identifier Quality
For UPC/EAN/GTIN:
- Preserve the raw string.
- Normalize only Unicode width, surrounding whitespace, spaces, and hyphens.
- Require remaining characters to be digits.
- Preserve leading zeros.
- Record length.
- Validate standard GTIN lengths 8, 12, 13, or 14 and check digit.
An invalid GTIN check digit is a data-quality flag. It does not authorize changing the value or matching by product name.
For SKU:
- Normalize Unicode width and surrounding whitespace for comparison.
- Preserve case and punctuation by default.
- Preserve unusual prefixes and literal formats.
- Do not generate or shorten SKU values.
Close The Counts
Report:
- Truth rows and unique truth identifiers.
- Target rows and unique target identifiers.
- Duplicate values and affected row counts.
- Exact matched pairs.
- Each conflict/missing state.
- Truth-only and target-only rows.
- Invalid-format and invalid-check-digit counts.
Required controls:
- Every truth row appears once in the truth-side matrix.
- Every target row is either used by one final exact pair or emitted once as
TARGET_ONLY. - Final exact pairs do not reuse a target row.
- Output row counts match the summary JSON.
Do not call an audit complete when controls do not close.
Prepare A Correction Handoff
When the user later approves changes:
- Re-read current target records.
- Keep only rows with exact platform object IDs and authoritative source evidence.
- Separate fields by owning system.
- Create a
REVIEW_FIRST field-level plan. - Route it to the correct specialist.
- Use a safe-update Skill or platform-specific workflow.
Do not label reconciliation output UPLOAD_THIS. Do not include inventory, price, MSRP, images, descriptions, or taxonomy unless those fields were separately sourced and approved.
Failure Rules
- Name looks identical but identifiers differ: keep separate.
- One UPC appears multiple times: classify duplicate; investigate pack, bundle, typo, or source duplication.
- SKU and UPC point to different rows: stop with cross-identifier conflict.
- Leading zero disappeared: return to the original cell/source and import as text.
- SPU variants split into separate products: require an explicit parent key before regrouping.
- A product exists without SKU but has exact UPC: report missing target SKU; do not invent it.
- A source file is filtered or deduplicated without audit: restore the raw population and rebuild controls.
- Source systems disagree: preserve both raw values and ask which is authoritative.
Closeout
Record source files, sheet names, column mappings, authority decision, raw and unique counts, duplicate lists, output paths, validation, limitations, and systems not touched. Use canonical-task-closeout before reporting completion.
Identifier Rules
Authority
Authority is field-specific and must be declared.
| Field | Possible authority | Never infer from |
|---|
| SKU | ERP, approved supplier master | Title, UPC sequence, neighboring row |
| UPC/EAN/GTIN | ERP, GS1-backed supplier master | Image, shade name, marketplace row |
| SPU/parent | ERP parent ID, Shopify Product ID, Mirakl VGC | Removing shade words from title |
| Platform ID | Current platform export/API | Old workbook without fresh verification |
| MSRP | ERP or approved brand pricing source | Current sale price |
One system may be authoritative for SKU/UPC while another owns customer-facing copy or images.
Raw And Normalized Values
Always retain:
- Raw source value.
- Normalized comparison value.
- Source filename, sheet, and row.
- Column name.
- Record title and variant for human review.
Normalization may remove surrounding whitespace and standard barcode spaces or hyphens. It must not:
- Drop leading zeros.
- Convert scientific notation into a guessed integer.
- Uppercase or rewrite literal SKU by default.
- Remove meaningful prefixes.
- Change check digits.
Duplicate Meaning
A duplicate identifier is not automatically an error in the source, but it is unsafe for automatic matching.
Investigate:
- Duplicate export rows.
- Same barcode reused for a multipack or bundle.
- Parent and child rows sharing a code.
- Incorrect variant entry.
- Marketplace shadow/catalog records.
Keep every affected row visible until the business meaning is proven.
Match Strength
| Match | Meaning |
|---|
| Exact platform object ID | Strongest within the same platform snapshot |
| Exact unique UPC | Strong cross-system variant identity |
| Exact unique SKU | Strong when both systems preserve the same seller SKU |
| UPC and SKU agree | Fully reconciled identity pair |
| Title/variant similarity | Review clue only |
| Image similarity | Review clue only |
SPU Rules
An SPU contains variants only when an explicit parent relationship proves it. Mixed status, missing images, or variant titles do not change identity.
Keep product grouping and variant identifier reconciliation in separate columns so a grouping correction cannot silently rewrite SKU or UPC.
Reconciliation Output Contract
Matrix Columns
The reconciliation matrix should include:
- Status and match mode.
- Truth and target row numbers.
- Raw and normalized SKU/UPC values.
- Truth and target titles.
- Truth and target explicit group IDs.
- Truth and target platform IDs.
- UPC quality flags.
- Human-readable reason.
safe_for_automatic_write = false.
Required Files
REVIEW_FIRST_identifier_reconciliation.csv: all truth rows plus target-only rows.REVIEW_FIRST_identifier_conflicts_and_gaps.csv: every state other than EXACT_BOTH.AUDIT_identifier_reconciliation_summary.json: mappings, counts, duplicate values, quality checks, controls, and zero-write declaration.
Do not create UPLOAD_THIS during reconciliation.
Handoff Boundary
A later correction handoff must add:
- Fresh target object ID.
- Current target value.
- Proposed value.
- Authoritative source reference.
- User approval status.
- Protected fields.
- Rollback value.
That handoff belongs to a platform-specific safe-update workflow, not this Skill.
Status Interpretation
| State | Automatic write |
|---|
EXACT_BOTH | No update needed |
| Missing target identifier | Never; review then approve |
| Identifier conflict | Never |
| Duplicate | Never |
| Truth-only | Never; investigate scope/listing |
| Target-only | Never; investigate archive/deletion/scope |
| Invalid GTIN | Never |