test: stabilize E2E coverage and GOAP fallback logic

- Refactored 'test_navigation_resilience.py' to produce structurally valid mock XML dynamically responding to app_start resets.
- Patched 'bot_flow.py' interaction lifecycle to handle cognitively deficient test scenarios gracefully.
- Migrated 'device_facade_full.py' assertions to shell-first interaction schemas (adb shell input).
- Stabilized legacy unit tests against structurally strict 'TelepathicEngine' dimension checks.
This commit is contained in:
2026-04-20 00:33:27 +02:00
parent ba4d7ffda2
commit fc3209bdc1
12 changed files with 183 additions and 62 deletions

View File

@@ -493,11 +493,14 @@ def _interact_with_carousel(device, configs, sleep_mod, logger):
sleep(random.uniform(1.0, 2.0) * sleep_mod)
def _interact_with_profile(device, configs, username, session_state, sleep_mod, logger, cognitive_stack):
growth = cognitive_stack.get("growth_brain")
def _interact_with_profile(device, configs, username, session_state, sleep_mod, logger, cognitive_stack=None):
"""Deep interaction on a profile: Stories, Grid Likes, Follows"""
import random
if cognitive_stack is None:
cognitive_stack = {}
growth = cognitive_stack.get("growth_brain")
if hasattr(session_state, 'my_username') and username == session_state.my_username:
logger.info(f"🤝 [Deep Interaction] Skipping own profile @{username} to prevent self-interactions.")
return
@@ -625,7 +628,7 @@ def _interact_with_profile(device, configs, username, session_state, sleep_mod,
is_liked = "gefällt mir nicht mehr" in xml_dump_lower or "unlike" in xml_dump_lower or 'content-desc="liked"' in xml_dump_lower
# Uset Double-Tap ~40% of the time, only on standard images
use_double_tap = growth.wants_to_double_tap(is_reel=is_reel)
use_double_tap = growth.wants_to_double_tap(is_reel=is_reel) if growth else False
if use_double_tap:
if is_liked:

View File

@@ -173,6 +173,23 @@ class ResonanceEngine:
return current_score
def judge_interaction(self, score: float) -> bool:
"""
Binary engagement gate.
Returns True if the resonance score is high enough to warrant any
interaction (like, comment, profile visit). The threshold mirrors
the like-gate used in the feed loop (bot_flow.py, res_score >= 0.35).
Args:
score: Resonance score in [0.0, 1.0] as returned by calculate_resonance().
Returns:
True → score qualifies for engagement.
False → score is too low; skip this post.
"""
return score >= 0.35
def get_suggested_action(self, username: str, base_resonance: float) -> str:
"""
[Phase 2] High-fidelity relationship escalation.