You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
O7: ledger supplies last_heartbeat from previous committed record #13
When session inputs carry no last_heartbeat, build_fuse_validated_inputs() defaults it to as_of and sets heartbeat_source="adapter_self". That is the job's own self-attested heartbeat, not independent liveness evidence, so a stalled chain cannot trip O7.
Today no caller (ledger.pybuild_record_body, scheduler, cloudrun_job, demo) supplies last_heartbeat or scheduled_interval.
Required change (part 4)
The ledger passes the previous committed record's decision_timestamp_utc as last_heartbeat (heartbeat_source="previous_committed_record").
scheduled_interval is the expected spacing between consecutive trading-session decisions, derived from the pinned calendar rather than a fixed 60s.
Bootstrap rule: a first-ever run with no previous committed record (genesis, sequence == 0) follows an explicit, documented rule with heartbeat_source="genesis_bootstrap". It must not fall back silently to as_of.
Replay reproduces the same heartbeat inputs from the chain.
Tests
A stale previous record, more than 2 scheduled intervals old, trips O7.
Genesis with no previous record is handled by the documented bootstrap rule and is labelled as such.
A normal next-session run with a fresh previous record leaves O7 NORMAL.
The full suite and python -m shadow.sh2_acceptance stay green.
Scope addition, decided in the #9 review: L0 two-pass in part 4.
The ledger currently evaluates FUSE rows first (evaluate_non_stub_tiers) and sizes afterwards (compute_session_sizing). As a result, L0 sees only the pre-sizing exposure as proposed_exposure.
Part 4 should:
Size the targets.
Re-evaluate L0 against the actual proposed exposure from those targets.
Block the session if the proposal exceeds max_loss_cap.
Tests:
A flat book with a large proposed buy above the cap must trip L0.
Activity
fix(fuse): label adapter self-heartbeat with heartbeat_source
Pigbibi commentedon Nov 26, 2026
Scope addition, decided in the #9 review: L0 two-pass in part 4.
The ledger currently evaluates FUSE rows first (
evaluate_non_stub_tiers) and sizes afterwards (compute_session_sizing). As a result, L0 sees only the pre-sizing exposure asproposed_exposure.Part 4 should:
max_loss_cap.Tests:
Generated by Claude Code
feat(fuse): add vendored FUSE-1 adapter and sizing isolation (SH-2 2/…
feat(close): add US 23/5 close isolation, feeder limits, and OTS (SH-…
feat(ledger): add SH-2 ledger integrity, scheduler, replay, and Cloud…
feat(sh2): add Cloud Run deployment spec and SH-2 acceptance pack (SH…