---
title: "顺序由可观察状态表达，事件 trace 留在运行时"
---

> Documentation Index
> Fetch the complete documentation index at: https://koine.systems/llms.txt
> Use this file to discover all available pages before exploring further.

# 顺序由可观察状态表达，事件 trace 留在运行时

## 背景

业务需要“某些转变必须按顺序发生”，但不能依赖时间戳：同一 `time` 可以有多个 step。需要决定逻辑时钟、状态依赖和事件 trace 的边界。

## 选项

- 世界级 `clock` 或显式 `before`/`after`。
- 状态痕迹/阶段，`require` 依赖痕迹。
- 每实体 `seq` 或模型级事件日志。
- 运行时 trace/OCEL。

## 决定

分层：

- **默认**：状态痕迹/阶段表达顺序；`require` 依赖可观察状态。继续 ADR-0012。
- **重复事件**：按需使用每实体 `seq` / per-entity event log。
- **跨对象、拒绝/重试、因果**：使用运行时事件 trace。
- **不引入**世界级 `clock`、`before`/`after`。
- path step index 是查询级逻辑时钟，不是模型级约束。

## 理由

- 状态痕迹对大多数业务顺序足够，且与 ADR-0012 一致。
- 全局时钟会过度串行、不能标识事件、分支共享时钟，拒绝事件也没有世界。
- `before`/`after` 会引入第二套顺序语义。
- 当前语言没有实体创建/ID 生成，模型级事件日志不能直接落地。

## 后果

- 普通顺序不需要时钟。
- 重复事件需要 seq/event log；跨对象顺序需要运行时 trace，直到模型级事件能力出现。
- 拒绝/重试必须由 trace 记录，不能只靠 world。
- path/trace 的 step index 要成为可查询的历史元数据。

## 相关

- [ADR-0012：不引入显式顺序](https://koine.systems/notes/decisions/0012-no-explicit-order/)
- [逻辑时钟与顺序原型](https://koine.systems/notes/logical-clock-prototype/)
- [语言决策清单](https://koine.systems/notes/pending-decisions/)

Source: https://koine.systems/notes/decisions/0017-order-from-observable-state/index.mdx
