Extend market grandfathering into the app-tree backfill

FeatureInitializerService
Shipped
August 24, 2026 at 10:12 PM UTC
Author
Kamo
Commit
1d45edf

grandfatherExistingGatedMarkets already walked each org's active markets, resolved getRequiredService() and enabled the missing app — it was just restricted to isGated() verticals, i.e. MORTGAGE and PERSONAL_LOANS. Now that every CommerceType names its own child app the restriction is gone, so the same loop seeds RETAIL / RENTAL / SERVICE / SUBSCRIPTION / PROCUREMENT rows. No new migration was needed. Also seeds RETAIL for orgs that hold POS with no markets at all, which had working commerce before the tree because retail needed no app of its own. Top-level orgs are no longer skipped, and that is the fix that matters. The exemption was right when this only granted the two lending apps — a platform-operator org should not silently acquire MLOS — but it is wrong for the app tree, because isAppEffectivelyEnabled requires an OrgFeature ROW and has no top-level exemption. The first run reported success while leaving KamoCRM, which runs active RETAIL and SUBSCRIPTION markets, with no rows for either; it would have lost both from /commerce on the next SecurityService deploy. Caught by querying the database, not by reading the log. enableFeature now cascades a child to its parent, so seeding a child also guarantees the POS row. RUN against prod 2026-08-24. Verified: every active commerce_markets row now has an active child OrgFeature row, zero missing.

All changes

Like what you see shipping?

Every one of these updates lands in your workspace automatically. Start free and watch it grow week after week.

Start Free ForeverView Pricing