Back to Feed
article 3m read

A cleanup queue with a delete button that says no

Abandoned drafts were piling up in a stock system I do not own, so I built a cleanup queue whose safety check expires in minutes and whose delete button, for now, logs the attempt and refuses.

Article DepthPractice

Flow

What each check result does to a row

  1. 1My records look wrong

    Row is blocked with the reasons written down. Their system is never asked.

  2. 2Their system has no such draft

    The check records it as missing on their side. Later, a recent missing result lets the delete mark the row cleaned.

  3. 3Wrong ID, wrong status, or counted as stock

    Row is blocked, with each reason recorded.

  4. 4Stock flag missing

    Row is blocked. A missing answer never passes.

  5. 5Everything checks out

    Row passes, but only for a few minutes.

The delete button I added today won't delete. I built it that way.

The ordering system can create a receiving draft inside the stores' inventory system, which belongs to a third party. If the draft is wrong, my side can abandon it, but abandoning only changes my records. The draft stays in their system, and over time it fills up with drafts I made and left behind.

I want to clean those up. But my note says "abandoned", and the delete would hit their system, not mine. My note could point at the wrong thing. The draft could have been turned into real stock since I last looked. Or their side might not answer, and no answer can look like a yes.

The list reads only my side

The cleanup page lists my abandoned drafts and asks their system nothing. Each row starts as "needs a check". Asking their system about every row on load would put load on them just for looking.

One click, one draft

You click to check one row. First it checks my own records: did I create this draft, is it abandoned, do I have its ID and the ID of the original record it was meant to replace, are those different, and did I originally ask for a draft instead of real stock? If any answer is no, it stops before calling their system and records the reason.

Then it asks their system about that one draft. It passes only if the ID matches, the status is still the saved-draft status, and the "counted as stock" flag explicitly says false. If the flag is missing, it fails. That's the rule to copy.

The draft can be removed only if the flag explicitly says it was not counted.

Don't write !draft.counted. A missing flag would pass.

For now the check only works on test data. It refuses the live stores.

A pass goes stale in minutes

The second change made a pass expire after a few minutes. Someone could receive the draft into stock a minute after I look. The delete only accepts a recent pass, and the server calculates the age itself instead of trusting the page.

Typing the ID, then a no

It needs its own permission, and you have to type the draft's ID by hand. Then it reruns the checks on my own records. If a recent check found the draft already gone, it marks my row as cleaned. If it holds a fresh pass instead, it logs the try and says no. I have no way to delete a draft on their side yet, so the route says so.

Checking every row at once

The first change said one row at a time. The second added a button to check every row on screen. It's capped and still needs a click. But each row's clock starts when its own check ends, so the first rows get older while the rest run.

No audit line, no last look

When a check finds a draft gone, it doesn't write an audit entry, even though that's the result that lets me mark the row cleaned. And the delete doesn't look at the draft one last time, so a small gap is left between the check and the delete.

Keep reading

Pick up a connected idea or branch into a nearby one.

5 paths forward