Avoid backfilling remote quote policies#460
Merged
dahlia merged 1 commit intofedify-dev:mainfrom Apr 29, 2026
Merged
Conversation
Member
Author
|
@codex review |
345f3af to
00406cd
Compare
|
Codex Review: Didn't find any major issues. 👍 ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Create the quote approval policy column nullable from the start so old cached remote posts remain NULL without a later table-wide rewrite. Only local posts are backfilled because Hollo owns their quote policy and can derive it from visibility. Leave the follow-up migration as an explicit no-op with context about the tradeoff and the prior expensive backfill approach. Assisted-by: Codex:gpt-5.5
00406cd to
5852320
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
This PR updates the unreleased quote-control migrations so existing remote posts are not mass-updated when introducing nullable quote approval policies.
The previous migration sequence first added
quote_approval_policyasDEFAULT 'public' NOT NULL, then used the follow-up migration to dropNOT NULLand rewrite cached remote public rows toNULL. That worked functionally, but it was expensive on largepoststables and could take many minutes in production-like databases.This PR makes the migration create the final column shape directly: nullable from the start, with only local posts backfilled. Existing remote posts remain
NULL, which preserves the legacy remote-post behavior added by the previous PR without requiring a table-wide remote-row rewrite.Changes
quote_approval_policyas nullable and without an immediate default.quote_approval_policyonly for local posts, where Hollo owns the quote policy and can derive it from visibility.'public'only after the local backfill, so new local posts keep the expected default.DROP NOT NULLfor databases that already applied the earlier 0086 draft, while removing the expensive remote-row backfill.NULL.Why this is needed
On instances with many cached remote posts, the old follow-up migration spent too long rewriting remote rows from
'public'toNULL. That rewrite is unnecessary if the column is nullable from the beginning.It also avoids encoding misleading data: before this feature, cached remote posts did not have stored FEP-044f quote policy information, so defaulting every old remote row to
'public'made legacy remote posts indistinguishable from remote posts that truly advertised a public FEP-044f quote policy.By leaving existing remote rows
NULL, the database accurately represents “no quote policy was observed,” and the application can treat those posts as legacy quote targets.Testing
pnpm migrate:generatepnpm run migrate:testpnpm checkgit diff --check