fix(astrolabe): delete stale tokens when refresh fails

- Delete stored token when refresh callback fails or returns null
- Delete stored token when expired with no refresh callback available
- Fix test namespaces (Service → OCA\Astrolabe\Tests\Unit\Service)
- Update tests to verify token deletion on refresh failure

Prevents repeated refresh attempts with stale tokens that will never
succeed, improving error handling and reducing unnecessary API calls.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Chris Coutinho
2026-01-17 14:21:53 +01:00
co-authored by Claude Opus 4.5
parent 303efeddf7
commit e48c5fa9a2
3 changed files with 24 additions and 6 deletions
@@ -2,7 +2,7 @@
declare(strict_types=1);
namespace Service;
namespace OCA\Astrolabe\Tests\Unit\Service;
use OCA\Astrolabe\Service\IdpTokenRefresher;
use OCA\Astrolabe\Service\McpServerClient;