Keep detection and result parsers separate
Accept coordinate arrays only at the detection stage. Persist them with the original image and use them for review.
Validate the completed output type
Inspect whether the result contains the expected URL and successful state from the swap. Fetch only the authorized returned asset.
Example
Using one parser for both stages can mistake the numeric corner array for a downloadable link.
Pass condition
A detection fixture produces overlays and a completed swap fixture produces one correctly verified asset.