# ADR-010 — چرا event ID با کلید ترتیب فرق دارد؟

Why distinguish event IDs and ordering keys?

Status: proposed · Date: 2026-10-15

## مسئله / Context

replay، reorder و delete باید بدون resurrect شدن سند کار کنند.

Replay, reordering, and deletion must not resurrect documents.

## گزینه‌ها / Alternatives

key=event_id؛ key=entity با delta؛ key=entity با full after-image.

Event-ID keys, entity-keyed deltas, or entity-keyed full after-images.

## انتخاب فعلی / Choice

پیشنهاد context: entity-key، revision و full after-image؛ event_id جدا برای dedup؛ deletion guard پایدار.

For context, propose entity keys, revisions/full after-images, separate dedup IDs, and durable deletion guards.

## چرایی و trade-off / Rationale and trade-off

eventهای یک entity ترتیب مرتبط می‌خواهند؛ full image وابستگی به delta گم‌شده را کم می‌کند ولی بایت بیشتری دارد.

Entity events need related ordering; full images reduce missing-delta dependencies at higher byte cost.

## فرض‌ها / Assumptions

E07 اندازهٔ event فرضی ۲KB است؛ سندهای بزرگ pointer/hash می‌خواهند و اندازه باید اندازه‌گیری شود.

E07 assumes 2KB/event; large documents need pointers/hashes and size measurements.

## روش آزمون / Validation

v3 پس از v4 و delete پس از embed؛ repeat/compaction/retention-expired consumer.

v3 after v4, deletion during embedding, repeats, compaction, and expired consumers.

## بازنگری / Revisit

اگر حجم full image bottleneck شد delta را با gap detection و repair اثبات‌شده بررسی کن.

If full images bottleneck, consider deltas with proven gap detection and repair.

DDIA: 5, 6, 7, 12, 13
