refactor(organization): drop refunds_blocked column (Phase B)#11187
Merged
psincraian merged 1 commit intomainfrom Apr 24, 2026
Merged
refactor(organization): drop refunds_blocked column (Phase B)#11187psincraian merged 1 commit intomainfrom
psincraian merged 1 commit intomainfrom
Conversation
Removes the deferred `refunds_blocked` column now that all code paths read from `capabilities["refunds"]` (Phase A, #11163). Makes `capabilities` NOT NULL and removes the `get_effective_capabilities` fallback. Migration uses `SET lock_timeout = '2s'` to fail fast on contention. Requires `backfill_org_capabilities.py --execute` to have run first. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
|
Contributor
OpenAPI ChangesNo changes detected in the OpenAPI schema. |
frankie567
approved these changes
Apr 23, 2026
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
Phase B of the
refunds_blocked→capabilities["refunds"]migration. Drops the deferred column now that all app code reads fromcapabilities, and makescapabilitiesNOT NULL.Follow-up to #11163 (Phase A, which deferred the column and removed all reads/writes).
What
d3f5e1a7b2c4—SET NOT NULLoncapabilities,DROP COLUMN refunds_blocked. UsesSET lock_timeout = '2s'to fail fast on contention.refunds_blockedcolumn,capabilitiesbecomes non-nullable, removeget_effective_capabilities()fallback..capabilitiesaccess:organization/service.py(set_capability)backoffice/organizations_v2/endpoints.py(set_capabilityendpoint)backoffice/organizations_v2/views/sections/settings_section.pybackoffice/organizations_v2/views/modals/set_capability_modal.pytests/refund/test_service.pyWhy
Phase A made
capabilities["refunds"]the sole source of truth but left the column in place to avoid a CD race. That has now shipped and soaked — this PR cleans up the deprecated column and eliminates the nullable-capabilities fallback.How
Migration safety on the hot
organizationstable (77k rows / 177MB in prod):SET lock_timeout = '2s'prevents pileup behind long-running DDL on a table heavily joined from checkouts/orders/subscriptions.ALTER COLUMN SET NOT NULLwill fail loudly if any NULL rows remain, which is a better signal than silent heal.refunds_blockedfromNOT (capabilities->>'refunds')::booleanand revertscapabilitiesto nullable.Deploy order:
uv run python -m scripts.backfill_org_capabilities --executeagainst prod (confirm zero NULLs with--verify).How to verify
uv run alembic upgrade head && uv run alembic downgrade -1 && uv run alembic upgrade head— cleanuv run pytest tests/organization tests/refund tests/backoffice— 327 passeduv run pytest tests/checkout tests/order tests/subscription tests/payment tests/customer— 883 passedChecklist
uv run task lint && uv run task lint_types)