fix(backend): Fix chart generation non-matching blockedHosts #14441
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What
NOT ILIKE ANY(ARRAY[:...blocked])
というのは、blockedリストのいずれかのホスト名やサブドメインに一致しないものを抽出するので、たとえばblockedリストに複数のホスト名があった場合、そのうちの一つにでも一致しなければ結果に含まれてしまいます。目的は「blockedリストのすべてのホスト名やサブドメインに一致しない場合ものを抽出する」ことでした。これを達成するには、いずれかではなくすべての条件が満たされるようにする必要があります。
たとえばblockedHostsにexample.comが登録されていた場合に
instance.hostにexample.comが存在する場合は、blockedリストの[example.com, %.example.com]のいずれかとマッチしないものを抽出するので、%.example.comにはマッチせずに、結果に含まれます。
instance.hostにa.example.comが存在する場合は、[example.com, %.example.com]のいずれかとマッチしないものを抽出するので、example.comにはマッチせずに、結果に含まれます。
結果的にblockedHostsに含まれるホストはFederationChartの対象から除外できていません。
NOT ILIKE ANY(ARRAY[:...blocked])
extracts hostnames that do not match any hostname or subdomain in the blocked list, so for example, if there are multiple hostnames in the blocked list, if one of them does not match, it will be included in the result.The goal was to extract those that did not match all hostnames or subdomains in the blocked list. To achieve this, we need to make sure that all conditions are met, not just one.
Why
Fix: #9263
Checklist