1. No automatic removal of bad tags
I'm not a huge fan of embedding knowledge of particular tags directly in the code, as things like *_sample tags are subject to change. There are also tags like jpeg_artifacts that would still need to be handled manually.
In general, replacement can be used for other things besides replacing samples. Think of things like replacing scans, or forcing old thumbnails to regenerate.
2 Concurrency concerns
Well, I think it's safe, but it's pretty difficult to test to know for certain. Danbooru suffers from concurrency bugs practically everywhere, so to an extent it's par for the course. I don't think it's necessarily riskier than the normal upload process though. Duplicates will be detected if two people try to replace something with the same file.
3 Cooldown period
As it stands, there's no real way to track the history to see when something was last replaced beyond the mod actions log, which is not suitable for this. Albert brought up having a new model that would allow for tracking replacements.
4 Replacement of source
If using an image link, it replaces the source with that link, even if the source was the post source and therefore the correct source to use. This will lead to manual fixing of the source every time, or people will forget and leave the substandard source in place.
It should set the source to the same thing that it would be set to as if it were uploaded normally. We don't have a referer url in this context though, so it could be getting messed up by that.
I wasn't able to confirm with the above since you don't have the archive service running, but does replacing an image create a new post version when the source is changed?
It should create a version if the tags change (which can happen due to filetype/dimensions autotagging) or if the source changes. I suppose if the source didn't change (say the source is the html page which is the same for the sample and the full size) it won't create a post version.
5 No confirmation stage
The fact that the replacement is a one-stage step is a bit leery. There should be a confirmation step where the site will pull in the source from the supplied URL, and show the standard image information, to include thumbnail, dimensions, MD5 hash, and exact filesize. No kb or mb please though, as images can differ by only a few bytes which can get lost in the conversion to kb and mb.
The upload page can do some of this re: getting the filesize and thumbnail, but it's intertwined heavily with the upload page. Basically it needs to be factored out and moved into /source.json?url=...
so that it will be available in this context. I was thinking that a preview/comparison could either be included in the dialog box, or perhaps in the "Fetch source data" box.
6 No batch upload selection
It does the same thing that the regular upload page does, which is to take the first image in the gallery when you give it a gallery source. This should perhaps raise an error instead, as this is error-prone in normal uploading too. The "Fetch source data" warns you when something is a gallery, but I think people don't always pay attention to that.
7 No upload file
Certain sources like Tinami do not allow for image retrieval without a few modifications to the HTTP request, like Referrer or a Cookie. For these sources, I've always had to download the file to disk, then upload the file and set the source when uploading.
I avoided dealing with file uploading for now to keep the first pass at this simple. The problem with Tinami specifically is that I think we only spoof the Referer for Pixiv as a special case, but really we should spoof it by default for everything. I haven't tried that but I think that would solve hotlinking problems for all sites.
8 No IQDB confirmation
There is no check to see if the image being uploaded is similar at all to the the image being replaced.
Are we talking about preventing mistakes or preventing malicious use? If it's the former, then I think showing the IQDB hits should be sufficient. If it's the latter, and a replacement has to have some minimum similarity score, then you get into problems with things being rejected when they shouldn't. Think of replacing a scan that was flipped horizontally for some reason. I don't think this would detected by IQDB.
9 Delay Job deletion
What about events where an image is mistakenly replaced? In these cases, the original file under Mod Actions can be used to change the file back. However, what about the delay job created? Will it still delete the original file? Will the replaced file also be deleted. This could lead to posts that have broken images.
Also, the information given by the delay job page isn't very informational. I can't tell what they're going to do... only that they are going to "delete old files", plus the post # they are going to delete from.
Hmm, it would still delete the original file. The delayed job would need to be canceled, which would be possible to do but not yet implemented.
Jobs have more info that could be displayed on the /delayed_jobs page, but currently that info is only shown to admins. I think albert wanted to be careful not to display too much in case something is sensitive. So would need to look through all the job types and decide what's safe to expose.
10 [Feature Request] Order mechanism to find these posts
This is mostly related to mine and RaisingK's scripts, but it would be helpful if it were possible to order these posts where an image is replaced by most recent replacement. The reason being is that I currently perform three checks when an image is uploaded: at the five min mark, one week mark, and one month mark. Without a way to easily find these posts, they may have to wait until I do the full gamut which I only do once every several months.
Albert brought up having a model for tracking purposes, which should allow for this. As it currently stands, you would have to check /uploads.json or /mod_actions.json to monitor replacements.