diff --git a/static/boot.js b/static/boot.js index 5c230dd9..1781f973 100644 --- a/static/boot.js +++ b/static/boot.js @@ -2319,6 +2319,7 @@ window._applyTitlebarProfileVisibility=_applyTitlebarProfileVisibility; if (activeProfileState.status === 'recovery-redirect') return; S.activeProfile = activeProfileState.profile; S.activeProfileIsDefault = activeProfileState.isDefault; + applyBotName(); // Update profile chip label immediately const profileLabel=$('profileChipLabel'); if(profileLabel) profileLabel.textContent=S.activeProfile||'default'; diff --git a/tests/test_5001_active_profile_recovery.py b/tests/test_5001_active_profile_recovery.py index 5447aecb..036054b0 100644 --- a/tests/test_5001_active_profile_recovery.py +++ b/tests/test_5001_active_profile_recovery.py @@ -93,13 +93,7 @@ eval(extractFunction(bootSrc, '_resolveActiveProfileBootstrapState')); for (const attempt of attempts) { const state = await _resolveActiveProfileBootstrapState({ - loadActiveProfile: makeAttempt( - attempt, - storage, - markerKey, - redirectUrls, - attempt.nextUrl || '/' - ), + loadActiveProfile: makeAttempt(attempt), markerStorage: storage, markerKey, getNextUrl: () => attempt.nextUrl || '/', @@ -160,8 +154,8 @@ def test_active_profile_boot_recovery_is_one_shot_and_bounded(driver_path): { "markerKey": "test-5001-active-profile-recovery", "attempts": [ - {"type": "error", "status": 401, "nextUrl": "/"}, - {"type": "error", "status": 401, "nextUrl": "/"}, + {"type": "undefined", "nextUrl": "/"}, + {"type": "undefined", "nextUrl": "/"}, ], }, ) @@ -177,6 +171,28 @@ def test_active_profile_boot_recovery_is_one_shot_and_bounded(driver_path): assert payload["storageSnapshot"] == {} +def test_active_profile_boot_recovery_handles_loader_thrown_401s(driver_path): + payload = _run_boot_profile_scenario( + driver_path, + { + "markerKey": "test-5001-active-profile-recovery-throws", + "attempts": [ + {"type": "error", "status": 401, "nextUrl": "/"}, + {"type": "error", "status": 401, "nextUrl": "/"}, + ], + }, + ) + + assert payload["attempts"][0]["status"] == "recovery-redirect" + assert payload["attempts"][1]["status"] == "fallback" + assert payload["attempts"][1]["profile"] == "default" + assert payload["attempts"][1]["isDefault"] is True + assert payload["redirects"] == ["login?next=%2F"] + assert payload["storageHistory"][0].get("test-5001-active-profile-recovery-throws") == "1" + assert payload["storageHistory"][1].get("test-5001-active-profile-recovery-throws") is None + assert payload["storageSnapshot"] == {} + + def test_active_profile_success_path_applies_boot_state_and_continues(driver_path): payload = _run_boot_profile_scenario( driver_path, diff --git a/tests/test_webui_external_refresh_frontend.py b/tests/test_webui_external_refresh_frontend.py index 92b47e86..b424907a 100644 --- a/tests/test_webui_external_refresh_frontend.py +++ b/tests/test_webui_external_refresh_frontend.py @@ -78,7 +78,8 @@ def test_session_event_profile_filter_tolerates_default_root_aliases(): assert "function _sessionEventProfilesMatch(eventProfile, activeProfile)" in SESSIONS_JS assert "if (!_profileMatchesActiveProfile(sessionProfile, activeProfile)) return false;" in SESSIONS_JS assert "activeProfileIsDefault:true" in UI_JS - assert "S.activeProfileIsDefault=!!p.is_default;" in BOOT_JS + assert "const activeProfileState = await _resolveActiveProfileBootstrapState();" in BOOT_JS + assert "S.activeProfileIsDefault = activeProfileState.isDefault;" in BOOT_JS assert "S.activeProfileIsDefault = !!data.is_default;" in PANELS_JS