(
profile: Dict[str, Any],
*,
strategy_mode: str = STRATEGY_SIMULATION,
drift_probability: float = 0.5,
)
| 232 | |
| 233 | def initialize_hidden_anchor( |
| 234 | profile: Dict[str, Any], |
| 235 | *, |
| 236 | strategy_mode: str = STRATEGY_SIMULATION, |
| 237 | drift_probability: float = 0.5, |
| 238 | ) -> Dict[str, Any]: |
| 239 | updated = copy.deepcopy(profile) |
| 240 | drift_state = _ensure_anchor_state(updated) |
| 241 | settings = _strategy_settings(strategy_mode) |
| 242 | drift_state["strategy_mode"] = settings["mode"] |
| 243 | |
| 244 | if settings["mode"] == STRATEGY_REAL_USER and not drift_state.get("hidden_anchor"): |
| 245 | shift_topics = _candidate_shift_topics(updated) |
| 246 | drift_state["drift_enabled"] = bool(shift_topics) |
| 247 | if shift_topics: |
| 248 | drift_state["hidden_anchor"] = random.choice(shift_topics) |
| 249 | drift_state["hidden_anchor_source"] = "drift_plan_once" |
| 250 | else: |
| 251 | drift_state["hidden_anchor"] = None |
| 252 | drift_state["hidden_anchor_source"] = None |
| 253 | |
| 254 | updated["drift_state"] = drift_state |
| 255 | return updated |
| 256 | |
| 257 | |
| 258 | def load_default_checkfiles() -> List[Dict[str, Any]]: |
| 259 | return load_checkfiles(str(DEFAULT_CHECKFILES_DIR)) |
no test coverage detected