fix: clear alt text when the upload dialog is handed a different file

The file input's `onChange` reset `state` to `IDLE` and left `altText`
untouched. On success that is harmless -- the dialog unmounts. But
REJECTED, QUARANTINED and TRANSPORT_FAILED all leave it mounted with the
file input re-enabled, and that is precisely the retry path: upload
`db-schema.png` described as "DB 스키마", have it quarantined, pick
`sequence.png`, upload -- and `sequence.png` shipped described as
"DB 스키마", passing EVIDENCE_ALT_REQUIRED and publishing with a caption
about a different image.

Cleared on every file selection rather than only after a failure: alt
text describes one image, and "which file is this describing" has one
honest answer per selection. `submit()`'s existing ALT_REQUIRED refusal
turns the emptied field into a stop rather than a silent omission.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
DongHyeonka
2026-08-18 13:17:33 +09:00
co-authored by Claude Opus 5
parent f69edb633d
commit 1f2cba79e9
2 changed files with 86 additions and 1 deletions
@@ -188,8 +188,20 @@ export function AssetUploadDialog(props: Readonly<{
setState({ kind: "SELECTION_FAILED", message: MESSAGES.SELECTION_FAILED });
return;
}
// A new file clears whatever the previous attempt reported.
// A new file clears whatever the previous attempt reported --
// and its description with it. Alt text describes *this image*,
// and every terminal failure state (REJECTED, QUARANTINED,
// TRANSPORT_FAILED) leaves this dialog mounted with the file
// input re-enabled, so the retry path is exactly where a stale
// description survives: upload `db-schema.png` as "DB 스키마",
// get it quarantined, pick `sequence.png`, upload -- and
// `sequence.png` ships described as "DB 스키마" and validates as
// publishable. Cleared unconditionally rather than only after a
// failure: "which file is this text describing" has one honest
// answer per selection, and `submit()`'s ALT_REQUIRED refusal
// makes the emptied field impossible to ignore.
setState({ kind: "IDLE" });
setAltText("");
if (!decorative) altRef.current?.focus();
}}
/>