Ping Qiu 2b6ce9b202 fix: same-observation events enter engine as atomic batch
OnProbeResult routes ProbeSucceeded + RecoveryFactsObserved
from the same probe through applyBatchAndExecute, so both
enter the engine under one lock hold — no unrelated event
can interleave between them.

Shared bookkeeping lives in applyEventLocked; both the batch
and single-event paths go through it, so the trace /
projection / command accumulators can't drift again. ApplyLog
returned from OnProbeResult is now complete (EventKind, full
Trace including session events, post-session Projection).

An ingress rule is pinned in code: multi-fact observations
MUST route through applyBatchAndExecute, and any new
multi-fact ingress needs its own contention test.

Tests:
- TestBatch_UsesBatchPath: EventKind prefix, both event markers
  in Trace, Projection reflects post-apply state
- TestBatch_LogIncludesSessionEvents: SessionPrepared/Started
  markers present in returned log.Trace
- TestBatch_AtomicUnderContention: 4 goroutines fire competing
  events while main fires 2000 probes; scans trace event
  markers to prove ProbeSucceeded is always immediately
  followed by RecoveryFactsObserved. Vacuity guard requires
  real contention.
2026-04-13 22:41:03 -07:00
Languages
Go 84.7%
Rust 7.7%
Shell 2.7%
templ 1.5%
Java 1%
Other 2.1%