fix(physics): disable playful biomechanics during aggressive ad skips

- Fixed a bug where `humanized_scroll(is_skip=True)` could trigger random 'Doomscroll Corrections' (scrolling backwards) or 'reading pauses'.
- This caused the Anti-Stuck loop for ads to fail because the aggressive skip would occasionally just pause or scroll back into the ad.
- Added strict TDD coverage in `test_physics_humanized.py` to verify `is_skip` generates strictly forward gestures without pauses.
This commit is contained in:
2026-04-24 14:59:35 +02:00
parent f1590631a1
commit 2b0d0840a8
2 changed files with 43 additions and 13 deletions

View File

@@ -48,19 +48,12 @@ def humanized_scroll(device, is_skip=False, resonance_score=None):
start_x, start_y = body.get_scroll_start()
end_x = start_x + random.gauss(0, w * 0.008) # Slight horizontal drift
do_correction = random.random() < correction_prob
if is_skip:
# Aggressive fast fling to skip quickly
if do_correction:
logger.debug(f"🪀 [Doomscroll] Correction (Prob: {correction_prob:.2f}) — Wait, what was that?")
distance = int(h * random.uniform(0.3, 0.5))
duration = random.uniform(100, 150)
end_y = min(start_y + distance, h - 10) # Move down to pull UI up
else:
distance = int(h * random.uniform(0.6, 0.75))
duration = random.uniform(100, 150)
end_y = start_y - distance
# Aggressive fast fling to skip quickly. NO CORRECTIONS.
distance = int(h * random.uniform(0.6, 0.75))
duration = random.uniform(150, 250) # slightly longer to ensure smooth fling registration
end_y = start_y - distance
do_correction = False # Force false
else:
# Playful, organic human scrolling
play_choice = random.random()
@@ -97,7 +90,7 @@ def humanized_scroll(device, is_skip=False, resonance_score=None):
end_y = start_y - distance
# --- Behavioral Micro-Patterns (new human behaviors) ---
behavior = _select_scroll_behavior()
behavior = None if is_skip else _select_scroll_behavior()
if behavior == "pre_touch_dwell":
# Finger lands on glass before swiping (50-200ms dwell)