Files
foxhunt/docs/superpowers/specs
jgrusewski 1ecce0d826 spec(ml-backtesting): critical-review pass on ISV stop controller — 9 fixes
Issues caught in self-review and fixed:

1. Encoding ambiguity: stop-fire writing (2, 0) would have silently
   collapsed weak-alpha no-op semantics with force-flat. Introduced
   distinct side=3 = force-flat; preserved side=2 = no-op for entry
   path. Updated §3 + §5 + §7 truth table.

2. trail_hwm reset on close was implied in §4 but missing from §8's
   touched-files list. Added pnl_track.cu modification (§7.1) +
   added to §8 Added list.

3. __device__ helper enforcement: §3 now mandates stop_check_isv()
   as a shared __device__ function called from both decision kernels,
   not duplicated code.

4. Kernel arg additions enumerated explicitly in new §4.1 table —
   every kernel-launch site gets named, no "thread through every kernel"
   hand-wave.

5. seed_inflight_limits_batched (resting_orders.cu:439–475) named
   explicitly in §1 + §7 — the actual kernel that needs the position-
   target-semantics fix.

6. In-flight order summation: naive delta = target_signed - pos was
   strictly worse than the original additive bug under non-zero
   latency (would produce pos = pre + K·delta after fills). Fixed
   §7 algorithm to compute effective_position by scanning all
   active∈{1, 2} slots and summing their signed sizes. Added
   position_target_not_additive_with_latency test.

7. ATR α=0.4 honest justification in §10: not strictly derived from
   pearl_wiener_alpha_floor_for_nonstationary (which is about co-
   adapting control loops, not passive observation); chosen as a
   pragmatic project-wide constant matching isv_kelly_update_on_close.

8. CUDA Graph host-branch-free affirmation added to §3 — explicit
   compatibility with P5 graph capture.

9. Cold-start symmetry caveat (§5): at n_trades_seen=0 both EMAs are
   0 so sl_distance == trail_distance == atr — asymmetry only
   emerges post-bootstrap. Acknowledged honestly.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-19 23:20:04 +02:00
..