Skip to content

Add Sharkey (Misskey-family) interoperability smoke tests#659

Draft
sij411 wants to merge 1 commit intofedify-dev:mainfrom
sij411:smoke-misskey
Draft

Add Sharkey (Misskey-family) interoperability smoke tests#659
sij411 wants to merge 1 commit intofedify-dev:mainfrom
sij411:smoke-misskey

Conversation

@sij411
Copy link
Copy Markdown
Contributor

@sij411 sij411 commented Apr 3, 2026

Background

Fedify currently has smoke tests for Mastodon, but lacks coverage for Misskey-family servers which use different API conventions and URL patterns. Sharkey is a popular Misskey fork that represents this server family well.

A key challenge is that Sharkey requires HTTPS for all ActivityPub federation lookups — checkHttps() in ApPersonService rejects http:// URIs outright, and WebFingerService.genUrl() hardcodes https:// (see misskey-dev/misskey#10716). This means the test infrastructure needs TLS termination, unlike the plain HTTP setup used for Mastodon non-strict tests.

Additionally, Sharkey's Mastodon-compatible API layer has gaps (e.g. /api/v1/accounts/search returns 404 for remote users, /api/v1/accounts/lookup throws TypeError), so the orchestrator needs Misskey-native API fallbacks to work reliably.

Related: #654

Summary

  • New GitHub Actions workflow (smoke-sharkey) that boots a Sharkey stack with Caddy TLS proxies and self-signed certificates, provisions users, and runs E2E scenarios via the shared orchestrator
  • Caddy proxy architecture: backend services are renamed (e.g. sharkey-web-backend) to avoid DNS collision with the TLS proxy aliases (sharkey, fedify-harness)
  • Test harness backdoor now resolves recipients via WebFinger + actor document fetch instead of hardcoding Mastodon URL patterns, with a cache cleared on /_test/reset
  • Orchestrator account lookup falls back through Mastodon-compat search → lookup → Misskey-native /api/users/show endpoints
  • res.ok checks before JSON parsing in inbox poll helpers
  • Undo Follow assertion moved after relationship check to accommodate Sharkey's async delivery queue

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 4.6 noreply@anthropic.com
Co-Authored-By: Claude Sonnet 4.6 noreply@anthropic.com

Adds interoperability smoke tests for Sharkey, a Misskey fork.  Sharkey
requires HTTPS for all ActivityPub federation lookups (hard-coded in
checkHttps() and WebFingerService), so the setup uses Caddy TLS proxies
with self-signed certificates.

Key changes:

 -  New GitHub Actions workflow (smoke-sharkey) that boots a Sharkey
    stack with Caddy TLS proxies, provisions users, and runs E2E
    scenarios via the shared orchestrator
 -  Test harness backdoor now resolves recipients via WebFinger + actor
    document fetch instead of hardcoding Mastodon URL patterns, with a
    cache that is cleared on /_test/reset
 -  Orchestrator account lookup falls back through Mastodon-compat
    search, lookup, and Misskey-native /api/users/show endpoints
 -  res.ok checks before JSON parsing in inbox poll helpers
 -  poll() catches transient errors from callbacks and retries until
    timeout

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 3, 2026

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: a7f817dc-8f3c-4255-9328-9456efca25e7

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces smoke tests for Sharkey, including a Docker Compose environment with Caddy for TLS termination, provisioning scripts, and configuration files. The test harness has been updated to support WebFinger resolution with caching and improved account lookup logic that falls back to Sharkey-specific endpoints. Additionally, error handling was added to harness inbox fetches, and the unfollow test assertion order was refined. Feedback was provided regarding the lack of timeouts in the new fetch calls within the WebFinger resolution logic, which could cause tests to hang.

Comment on lines +28 to +60
try {
const wfUrl = `${scheme}://${domain}/.well-known/webfinger?resource=${
encodeURIComponent(`acct:${handle}`)
}`;
const wfRes = await fetch(wfUrl, {
headers: { Accept: "application/jrd+json" },
});
if (wfRes.ok) {
const wf = await wfRes.json() as {
links?: { rel: string; type?: string; href?: string }[];
};
const self = wf.links?.find(
(l) => l.rel === "self" && l.type === "application/activity+json",
);
if (self?.href) {
const actorId = new URL(self.href);
// Fetch the actor document to discover the inbox URL
const actorRes = await fetch(self.href, {
headers: { Accept: "application/activity+json" },
});
if (actorRes.ok) {
const actor = await actorRes.json() as { inbox?: string };
if (actor.inbox) {
const result = { inboxId: new URL(actor.inbox), actorId };
recipientCache.set(handle, result);
return result;
}
}
}
}
} catch {
// WebFinger failed; fall back to Mastodon convention
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The fetch calls within this try block for WebFinger and actor document retrieval lack timeouts. If the remote server becomes unresponsive, these requests could hang, causing the test to time out with a generic error message. To make the test harness more robust, consider adding a timeout to these fetch calls using an AbortSignal.

@codecov
Copy link
Copy Markdown

codecov bot commented Apr 3, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ All tests successful. No failed tests found.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant