-
Notifications
You must be signed in to change notification settings - Fork 15
spec(federation): Admin APIのupdate-instanceでInstance cacheをクリアできるように #1387
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
spec(federation): Admin APIのupdate-instanceでInstance cacheをクリアできるように #1387
Conversation
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
Walkthroughフェデレーテッドインスタンスサービスに新しい Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Comment |
|
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR enhances the admin/federation/update-instance endpoint to support cache-only invalidation without requiring a database lookup, refactors the suspension state computation for better clarity, and removes a unit test as requested.
- Adds a new
invalidatemethod toFederatedInstanceServicefor host-based cache invalidation - Enables the endpoint to skip database operations when only cache invalidation is needed
- Refactors suspension state logic into a single, more concise expression
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| packages/backend/src/core/FederatedInstanceService.ts | Adds invalidate method to support cache invalidation by host |
| packages/backend/src/server/api/endpoints/admin/federation/update-instance.ts | Implements early-return for cache-only invalidation and refactors suspension state calculation |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.



Motivation
admin/federation/update-instanceto act as a host-only cache-invalidation endpoint without doing a DB lookup.suspensionStatevalue more clearly and concisely in a single expression.Description
invalidate(host: string)toFederatedInstanceServicewhich normalizes the host withUtilityServiceand deletes the cached entry viafederatedInstanceCache.delete.server/api/endpoints/admin/federation/update-instance.tsto normalize the host up-front and early-return to callfederatedInstanceService.invalidate(normalizedHost)when bothisSuspendedandmoderationNotearenull.const suspensionState = (ps.isSuspended != null && isSuspendedBefore !== ps.isSuspended) ? (ps.isSuspended ? 'manuallySuspended' : 'none') : undefined;.packages/backend/test/unit/server/api/admin/federation/update-instance.tsas requested.Testing
packages/backend/test/unit/server/api/admin/federation/update-instance.tswas deleted and therefore not executed here.Codex Task
Summary by CodeRabbit
リリースノート
新機能
改善
✏️ Tip: You can customize this high-level summary in your review settings.