A tool keeps a marketplace seller's inventory in sync with the marketplace's seller API. It downloads listing reports, stores one row per SKU, and shows the seller how much stock each listing has. One day the seller wrote in and said the numbers were wrong. They were. The cause was one line of reasoning about what it means when a SKU is missing from a report.

Key facts

  • The sync's reconcile step left a row alone when its SKU was missing from the active listings report, on the idea that missing meant inactive.
  • The active listings report had 1,958 rows. The all listings report had 1,963. The "active" report already held the inactive listings.
  • So missing meant deleted. 923 of the 1,830 stored rows with stock were for listings that no longer existed.
  • A read-only dry run settled it: the old rule fixed 107 rows, the new rule would fix 923.
  • The fix zeroes stock only on strong evidence and keeps the row on weak evidence.

What did the seller see?

The app said the seller had over 3,000 merchant-fulfilled listings, and that 1,830 of them were in stock. The marketplace's own seller screens said something else: 902 in stock and 950 inactive.

That is a gap of about 900 listings with stock. Stock on a listing decides what the seller thinks they can sell, and it can cost listing fees. The seller trusted the marketplace, and the marketplace was right.

The rule that kept dead stock

Two weeks earlier, the sync had gained a reconcile step. For each stored row, it looked up the SKU in the marketplace's active listings report. If the SKU was there, the row got the report's quantity. If the SKU was missing, the row was left alone.

The comment above that branch explained why: a SKU missing from the active report is inactive or suppressed, it might still carry stock, so do not touch it. That sounds careful. The problem is where it came from. The rule was written from the API docs, and nobody had looked at a real report before it shipped.

What the two reports said

The marketplace offers more than one listings report. Besides the active listings report there is an all listings report, which should hold every listing the seller has, in any status.

For this seller, the active report had 1,958 rows and the all listings report had 1,963. Only 5 apart. If the active report really held only active listings, it should have been about 950 rows shorter, because the marketplace showed 950 inactive listings. It was not. Despite its name, the active report already carried the inactive listings.

That turns the old rule upside down. A SKU missing from the active report was not inactive. It was missing from both reports, because the marketplace had removed the listing. Of the 1,830 stored rows that showed stock, 923 pointed at listings that existed nowhere. The rule kept their stock forever.

The dry run settled it

There were two theories on the table. One said the reconcile step was fine and the counts would settle after a refresh. The other said the rule for missing SKUs was wrong.

A refresh had run that morning. It fixed 107 marketplace-fulfilled (FBA) rows and 0 merchant-fulfilled rows. A read-only dry run of the old rule, which counts what a rule would change without writing anything, predicted exactly that: 107 and 0. So the refresh worked as written, and the rule as written could never fix the merchant rows.

Then the same dry run for the new rule: 923 rows would go to 0, and nothing else would change. 107 against 923 settled the argument in one line.

The new rule

The fix, merged the same evening, downloads the all listings report as well, and uses it as the evidence for what a missing SKU means:

SKUAll listings reportWhat the sync does
In the active reportNot neededUse the active report's quantity
Not in the active reportHas the SKUUse its quantity
Not in the active reportUsable, but lacks the SKUSet quantity to 0
Not in the active reportMissing, empty, or smaller than the active reportLeave the row alone

The last line is the safety catch. If the all listings report failed to download, came back empty, or is somehow smaller than the active report, it is not good evidence of anything. In that case the sync does what it did before and keeps the row. The old safeguards stay too: the sync never deletes a row, and never touches archived flags, prices or costs. It only changes a quantity.

Two counts called listings

There was a second, smaller bug in the same report. The listings tab counted every row ever saved: 3,179, with no filter on quantity. The home card counted rows with stock: 1,830. Both were called "listings", on the same screen, with no label saying what each one counted.

Neither number was a bug on its own. Together they look like the app cannot count. Two numbers with the same name and different meanings are a bug report waiting to happen. Label every count with what it counts: "all saved", "in stock", "active".

Four rules

  • Test a reconcile rule against one real report before it ships. A rule written from the docs is a guess. Report names lie: here, "active" included inactive.
  • When two sources disagree, write the dry run first. Count how many rows each rule would change. A number like 107 against 923 ends the argument faster than any reading of the docs.
  • Absence is a fact about the source's scope. A row missing from a report only tells you what that report leaves out. Know which report it is and which statuses it holds before you decide what missing means.
  • Fail safe in the direction that costs least. Keeping phantom stock cost this seller real listing fees and two weeks of confusing counts. So the new rule zeroes on strong evidence and keeps on weak evidence.

Common questions

Why not just delete rows missing from the active report?

Because missing from one report is not proof by itself. The all listings report is the evidence: a SKU that is in neither report is gone. Even then, the sync does not delete the row. It sets the quantity to 0 and keeps the history.

Why keep the row when the all listings report is missing or small?

A failed or short download would look like thousands of deleted listings, and zeroing them would wipe real stock. A report that is missing, empty or smaller than the active report is weak evidence, so the sync keeps the row.

How do you know what a report contains?

Download one real report for one real account. Count its rows by status, and compare the total with a second report that should be larger. If the two counts are almost the same, the names do not mean what you thought.

Melta is free; get it on the App Store or Google Play.