Drop the resolution warning log and fake createRecord via config

Remove the final Log::warning (and the lastError/lastEndpoint tracking that only
fed it) — the per-endpoint debug log already covers diagnosis. Fake the
createRecord endpoint from config('trypost.platforms.bluesky.default_service')
in the new tests instead of hardcoding the host.
This commit is contained in:
Paulo Castellano 2026-06-13 18:19:04 -03:00
parent 5d80caffef
commit 409c6f0139
2 changed files with 2 additions and 15 deletions

View file

@ -284,8 +284,6 @@ private function resolveHandleToDid(string $handle, ?string $service = null, ?So
config('trypost.platforms.bluesky.default_service'),
])));
$lastError = null;
$lastEndpoint = null;
foreach ($endpoints as $endpoint) {
try {
$request = $this->socialHttp();
@ -303,11 +301,6 @@ private function resolveHandleToDid(string $handle, ?string $service = null, ?So
return $did;
}
} catch (Throwable $e) {
// Per-endpoint failures are expected during transient outages;
// keep them at debug to avoid noisy logs and surface a single
// warning below only when every endpoint has been exhausted.
$lastError = $e->getMessage();
$lastEndpoint = $endpoint;
Log::debug('Bluesky handle resolution attempt failed', [
'handle' => $handle,
'endpoint' => $endpoint,
@ -316,12 +309,6 @@ private function resolveHandleToDid(string $handle, ?string $service = null, ?So
}
}
Log::warning('Bluesky handle resolution failed; mention will be sent as plain text', [
'handle' => $handle,
'endpoint' => $lastEndpoint,
'error' => $lastError,
]);
return null;
}

View file

@ -111,7 +111,7 @@
'*/xrpc/com.atproto.identity.resolveHandle*' => Http::response([
'did' => 'did:plc:friend456',
], 200),
'https://bsky.social/xrpc/com.atproto.repo.createRecord' => Http::response([
config('trypost.platforms.bluesky.default_service').'/xrpc/com.atproto.repo.createRecord' => Http::response([
'uri' => 'at://did:plc:testuser123/app.bsky.feed.post/3abc123xyz',
'cid' => 'bafyreiabc123',
], 200),
@ -143,7 +143,7 @@
Http::fake([
'*/xrpc/com.atproto.identity.resolveHandle*' => Http::response(['error' => 'InvalidRequest'], 400),
'https://bsky.social/xrpc/com.atproto.repo.createRecord' => Http::response([
config('trypost.platforms.bluesky.default_service').'/xrpc/com.atproto.repo.createRecord' => Http::response([
'uri' => 'at://did:plc:testuser123/app.bsky.feed.post/3abc123xyz',
'cid' => 'bafyreiabc123',
], 200),