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

Companions Before the Record

~11 min · ordering, artifacts, atomicity, landing

Level 0Cold Vessel
0 XP0/36 lessons0/12 achievements
0/100 XP to next level100 XP to go0% complete

Companions Before the Record

A landing event often references companion artifacts: the materialized brief, reviewer requests and outputs, reconciliation, and perhaps a destination receipt. The event should become canonical only after those targets are durable. Otherwise one successful append can point forever at a file that never saved.

The safe order is prepare, validate, persist companions, then append or commit the landing record under one serialized operation. If companion persistence fails, no landed event is emitted. If the final event fails, the unreferenced companions can be retried or garbage-collected according to explicit policy.

File and database atomicity cannot always share one transaction. Design a staging protocol: write companions to final immutable names or a temporary area, verify digests, then move or mark them ready before the canonical append. The trail records identifiers rather than fragile process-local paths.

Idempotency matters during retry. A repeated landing request should resolve the same companion identities and avoid duplicate events. Stable content-derived or delegation-derived keys make recovery predictable.

No Dangling Proof

Inject failure after each landing step. After every failure, inspect whether canonical history can reference a missing target or whether a retry creates duplicates. Fault injection reveals ordering promises a happy path hides.

Serialize the final transition through one writer. Companion preparation may happen earlier, but the moment status becomes landed and references become visible must have one owner.

Land companion artifacts before claiming the record is complete. Push the code, save the document, or deliver the message at its real destination first, then cite that result from Crucible. Otherwise the workshop can report success while the only usable artifact still lives in a temporary session.

Code

Publish references only after companions are durable·python
durable = {}
events = []

def land(key: str, brief: str, review: str) -> None:
    durable[f"{key}:brief"] = brief
    durable[f"{key}:review"] = review
    assert all(k in durable for k in (f"{key}:brief", f"{key}:review"))
    if not any(e["key"] == key for e in events):
        events.append({"key": key, "status": "landed"})

land("task-a", "brief-v1", "review-ok")
land("task-a", "brief-v1", "review-ok")
assert len(events) == 1

External links

Exercise

Draw a landing sequence with two file companions and one database event. Inject failure at every boundary and specify the safe retry.
Hint
Make the canonical event the final visible step.

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.