阅读文本 / Reading text
This paper uses synthetic samples to demonstrate the processing method. The code has been verified using examples in an isolated environment; this does not guarantee effectiveness for all real files or products. Before processing important files, please retain the original copies and verify them against the boundaries and acceptance criteria outlined in this document.
The button says “Complete,” but clicking download returns an empty file. Typically, this isn’t a matter of textual feedback; rather, the backend only logs that the algorithm has finished executing, without recording whether delivery was actually completed. Only by breaking down the status into discrete components can the frontend provide accurate feedback.
at least distinguishes between processing, product, and acceptance
completion indicates the computation has stopped; product readiness signifies that a locatable file is available; acceptance completion means the file meets the delivery agreement. These three events do not necessarily occur at the same time. Failures should also be accompanied by clear status indicators and must not be concealed behind a perpetually spinning icon.
explicitly rejects jump-style success
from enum import Enum
class State(Enum):
PROCESSING = "processing"
ARTIFACT_READY = "artifact_ready"
VERIFIED = "verified"
FAILED = "failed"
def transition(state, event):
allowed = {
(State.PROCESSING, "stored"): State.ARTIFACT_READY,
(State.PROCESSING, "error"): State.FAILED,
(State.ARTIFACT_READY, "checks_passed"): State.VERIFIED,
(State.ARTIFACT_READY, "error"): State.FAILED,
}
if (state, event) not in allowed:
raise ValueError("invalid state transition")
return allowed[(state, event)]
s = transition(State.PROCESSING, "stored")
assert s is State.ARTIFACT_READY
assert transition(s, "checks_passed") is State.VERIFIED
assert transition(s, "error") is State.FAILED
try:
transition(State.PROCESSING, "checks_passed")
except ValueError:
pass
else:
raise AssertionError("cannot skip artifact readiness")
This composite state machine does not include queue cancellation, re‑review, or expired deletion. The production implementation should scale with business needs, rather than forcing all events into a simple “success/failure” binary choice. Asynchronous messages may also be duplicated or out of order, requiring versioning, transactions, and idempotency handling to ensure correctness.
Front-end prompts should correspond to the facts
status
users can see
available actions
processing
is processing
view progress or cancel
artifact_ready
is checking the result
does not make a prior commitment to availability
verified
file is downloadable
Download and View Acceptance Instructions
failed
Failure Stage and Causes
repair by cause or retry
download succeeded, but the content is not correct
HTTP 200 may return a login page, an error JSON, or a blank document. Acceptance testing should at least verify the type, size, parsing availability, and expected content. For translation, language integrity and terminology review constitute higher-level checks and should not be replaced by “the file can open.”
maintains state transparency when integrating translation capabilities
accesses
OmniDoc (Product Entry)
Afterward, the proprietary product should still maintain its own storage and delivery status. Mapping the completion of a platform task to “start receiving results” and displaying success only after confirming the file would provide a user experience that is more aligned with reality than simply broadcasting a raw status.
Reference:
Python enum
。
- 1 -
Updated 2026-10-08