Skip to content
C.W.K.
Stream
Lesson 03 of 05 · published

Source Text Is a Version

~11 min · source-snapshot, staleness, hashing, editing

Level 0Dry Nib
0 XP0/36 lessons0/12 achievements
0/100 XP to next level100 XP to go0% complete
"A job belongs to bytes and options, not merely to a row id."

Name the protected result

An entry identifier is not enough to identify the input. The same entry may keep its id while the original is edited. A job born from yesterday's wording must not decorate today's wording merely because the foreign key still matches.

Put the promise in state

Capture the exact source text and target language when the worker begins. Before writing, load the entry again and compare the current original with that birth snapshot. The text itself is the version boundary, not a parallel column.

The quiet failure

Using only updated_at is fragile because unrelated metadata can change it. Comparing the exact text states the claim directly, and it preserves whitespace that may matter to a passage intended for copying.

Invariant. A job belongs to bytes and options, not merely to a row id.

Trace five moments

To test “Source Text Is a Version,” inspect the moment before creation, after commit, when a worker claims the job, when output returns, and on the next-day reload. At each point record entry state, job state, captured source text, and visible copy. A promise that survives only the successful request is conditional sovereignty.

Do the work

Choose exactly which fields belong in a translation worker's birth snapshot and defend every inclusion. Add source editing, entry deletion, worker restart, and external-service failure to the same table. Mark when dropping an output is integrity preservation rather than data loss.

The final question

Does the screen keep the original visible while telling the truth about work around it? Then adornment serves. If a spinner hides failure or a late result overwrites current text, the adornment has stolen the throne.

Landing condition

Current Inkwell captures the exact source text a worker read and compares it with the freshly loaded entry before writing. The bytes themselves are the version boundary; unrelated theme or view changes cannot make them stale, and meaningful whitespace is not normalized away.

Speed and correctness are not opposites here. Commit the original first, then make later work re-read current state before it lands.

Code

Capture the job's birth world·python
def capture_birth_world(entry, job):
    return {
        "entry_id": entry["id"],
        "job_id": job["id"],
        "kind": job["kind"],
        "lang": job["lang"],
        "original_text": entry["original_text"],
    }

snapshot = capture_birth_world(
    {"id": "entry-7", "original_text": "Ink keeps its own time."},
    {"id": "job-9", "kind": "translate", "lang": "ko"},
)

External links

Exercise

Choose exactly which fields belong in a translation worker's birth snapshot and defend every inclusion.
Hint
Distrust any completion path that never re-reads current state.

Progress

Progress is local-only — sign in to sync across devices.
Spotted a bug or have feedback on this page?Report an Issue

Comments 0

🔔 Reply notifications (sign in)
Sign inPlease sign in to comment.

No comments yet — be the first.