Files
Aura/docs/design/contracts/c02-causality.md
T
claude 8688a60ded docs(ledger): split the design ledger into an INDEX map, per-contract live files, and history sidecars
The single-file ledger had grown to 2968 lines / ~42k tokens, mixing
current design law with accreted history: 59 cycle-stamped realization
blocks, 18 [HISTORY] passages, 22 supersession markers, and the C10 /
C22 / C24 reframe sagas layered several supersessions deep. A
code-grounding audit (31 agents, adversarially verified) confirmed 11
defects stated as current truth: stale crate homes from the C28 #288
roster split (cost nodes, PositionManagement, PositionEvent, Session),
the renamed InputSpec->PortSpec, the pre-#241 project model in C16 and
the open-threads section, a stale HarnessKind retirement deferral in
C24, and three C28-internal inconsistencies.

New shape, per the ailang precedent:

- INDEX.md stays the sole addressable entry point: foundation, external
  components, a C-id-keyed contract map (one line per contract), and
  only the genuinely open architectural threads.
- contracts/cNN-<slug>.md carries each contract's current truth only:
  Guarantee / Forbids / Why with ratified refinements integrated, plus
  a code-anchored Current state. All confirmed defects are fixed here;
  crate anchors were re-verified against the tree.
- contracts/cNN-<slug>.history.md (18 sidecars) and INDEX.history.md
  preserve every superseded block verbatim, stamps and issue refs
  intact, under a frozen-record banner. Nothing was deleted: superseded
  design intent remains an addressable working-tree artifact, off the
  per-cycle audit walk.
- Ledger discipline is now stated in INDEX.md: live files are edited in
  place at cycle close, superseded text moves verbatim to the sidecar,
  and a supersession marker in a live file is itself an audit finding.

Every contract file was verified against its old text by an independent
zero-loss pass (statement-by-statement) plus a code-accuracy spot check;
C-ids and contract titles are unchanged, so existing C-id citations in
code, tests, and issues resolve as before.
2026-07-21 16:40:36 +02:00

37 lines
1.6 KiB
Markdown

# C2 — Causality / no look-ahead
**Guarantee.** A node sees only the past. Input history is a read-only window
that ends at the current cursor; a resampler emits a bar only once it is
complete.
**Forbids.** Any node access to data with `timestamp > now`; emitting a partial
/ still-forming bar.
**Why.** Look-ahead is the cardinal backtester bug — a fast backtester that
leaks the future is worse than none. Making the future *physically absent* from
what a node receives beats merely discouraging it.
## Current state
A node's `eval` receives `Ctx::new(&inputs, ts)` (`crates/aura-engine/src/harness.rs`):
the input windows are read-only slices whose head (`window[0]`) is the value
pushed at or before the current `cycle_id`. The engine forwards exactly one
merged record per cycle in ascending timestamp order, so a node structurally
cannot reach a record with `timestamp > now` — the future is absent from what it
receives, not merely off-limits.
The resampler (`crates/aura-market/src/resample.rs`) emits a completed coarse bar
only on bucket rollover; a still-forming bar is never emitted, and an incomplete
final bucket with no following rollover tick simply never emits. The completed
bar carries no timestamp of its own — it takes the rollover instant, the close
instant of the bar just emitted (C4).
## See also
- [C3](c03-single-merge.md) — the single ingestion merge is what makes a
read-only, monotone cursor possible.
- [C4](c04-cycle-granularity.md) — the data-driven cycle clock the cursor
advances along.
- [C5](c05-freshness-gating.md) — held (stale) values are real past values, not
a look-ahead escape hatch.