</> MAANG.io
system design · 301

Advanced

Master system design interviews with scalable architecture patterns, distributed systems, and real-world design challenges.

0/480 solved 0% complete

Section 12: The Roadmap Lands on Old Decisions - Follow-up Feature Evolution

Executive Summary: The interviewer's last move is a product roadmap: seven features, one year. None forces a rebuild, and the reason is specific. Subscriptions are the entitlement row from Section 5 learning to expire. Alternative distribution separates two steps the publishing workflow already ran apart: scanning and signing. Instant experiences are a size-capped split. Recommendations are the per-user fragment that Section 7's pushback deferred. Private enterprise apps are one more targeting predicate in the release index. Pre-registration is a release flip with a timestamp on it. Listing experiments are document variants with a deterministic cohort.

Sixty-five minutes in, the interviewer slides a list across the table. "Product wants subscriptions, the EU wants third-party stores, marketing wants instant apps, launch-day pre-registration and listing A/B tests, sales wants private apps for enterprises, and someone wants recommendations. Which of these make you redraw the architecture?"

You: None of them redraw it. Each plugs into a component we already justified.

Seven roadmap features mapped onto existing components: subscriptions add expiresAt and renewal events to the entitlements and purchase tables, private enterprise apps add an org audience rule to the release index and org-granted licences to entitlements, pre-registration adds a scheduled availableAt to the release index, alternative distribution scans without signing in the publishing workflow, instant experiences use a size-capped split in the split generator and CDN, and recommendations and listing experiments become a per-user rail fragment and variant documents in the storefront documents

Subscriptions: The Entitlement Learns to Expire

What changes: the entitlement row gains expiresAt and a richer state, and the append-only purchase_events history gains one row per renewal. Renewals arrive as billing-provider events, each carrying the provider's order ID, which becomes the idempotency key. A redelivered "renewed" event is a no-op, exactly like Priya's retried tap on the ₹399 Offline Maps Pack.

State diagram of a subscription entitlement: purchase verified enters ACTIVE, renewal charged keeps it ACTIVE, a failed renewal payment moves it to GRACE, payment recovered returns GRACE or ON_HOLD to ACTIVE, the grace window ending moves it to ON_HOLD and the hold window ending to EXPIRED, cancellation at period end also leads to EXPIRED, resubscribe brings EXPIRED back to ACTIVE, and a refund moves ACTIVE to REFUNDED

ACTIVE and GRACE grant access; ON_HOLD, EXPIRED and REFUNDED do not. That mirrors Google Play's grace period and account hold: a failed card shouldn't cut a paying user off at midnight, nor grant access forever.

Interviewer: "Who expires the subscriptions? A nightly job?"

You: No job. The entitlements table is 250 billion rows, and a sweep over it to find expirations would be the most expensive query in the company. Expiry is a comparison at read time: an entitlement check asks whether the state grants access and now < expiresAt. A renewal event that goes missing becomes a timely expiry, not free access forever. If provider events prove unreliable in practice, that's the flip trigger: add a reconciliation pull against the provider for entitlements expiring in the next day, which is a small slice, not the whole table.

What did not change: the purchase tables (current-state purchases, append-only purchase_events) and the one-transaction entitlement write, the outbox that notifies Trailhead's server, and Section 10's refund path, which is now just one more edge into REFUNDED.

Quick check before moving on:


Sign in to continue reading

The rest of this lesson is available with a free account. Signing in with Google or Microsoft is free.

Sign in to read the full lesson

Sign in to MAANG.io

Use your Google or Microsoft account — no password to remember.

Continue with Google Continue with Microsoft

Please accept the terms above to continue.