KatInterview

Build a Sync Engine for Multi-Scope IDE Configuration

System DesignModel answer
HardModel answerSystem Designdistributed-systemsconflict-resolutionversioning

Last updated

Design a configuration service that merges settings from org, team, workspace, user, and local scopes, syncs across devices, and handles offline edits with conflict resolution.

Context

You're architecting a configuration synchronization service for a cloud-connected development environment. Developers define preferences—keyboard shortcuts, editor behavior, extensions, linter rules—at multiple levels of granularity. An engineer might inherit their company's Python formatting standard, overlay their team's shared keybindings, then add personal customizations that follow them across every machine they use.

Your system must store, version, and merge these layered configurations while supporting offline work and ensuring every client converges to the same resolved state.

Requirements

Functional

Layered precedence with overrides
Configuration sources form a hierarchy: default → organization → team → repository → user account → local device. Each layer can override keys from lower layers, or an administrative layer can lock specific keys to prevent user modification.

Offline-first operation with merge on reconnect
Engineers edit settings without network access. When connectivity returns, local changes must reconcile with remote updates without data loss. Conflicts between concurrent edits need deterministic resolution.

Immutable history and point-in-time recovery
Every configuration layer maintains an audit trail. Administrators roll back to earlier revisions, compare snapshots across time, and understand who changed what.

Permission enforcement
Only authorized users modify team or organization settings. Membership updates—adding someone to a team or changing their role—immediately affect which configurations they inherit.

Schema compatibility across client versions
Not every user upgrades simultaneously. The backend gracefully handles clients that send deprecated keys, renamed fields, or type mismatches, migrating data transparently.

Non-Functional

Sub-50 ms resolution on startup
The editor computes the final merged configuration fast enough that it never blocks the application launch, even on slower hardware.

Near-real-time propagation
When an admin publishes a new organization policy, all connected clients receive a notification and refresh within two seconds.

Graceful degradation
If the sync service is unreachable, the client continues using its last-known state. No connectivity failures prevent the editor from opening or functioning.

Scale Expectations

  • 5 million daily active users, each running the editor on two devices on average
  • 500,000 teams and organizations
  • Each configuration scope is roughly 50 KB of JSON
  • Peak read load: 15,000 queries per second (read-heavy, cacheable)
  • Peak write load: 200 updates per second

What to Cover

  1. Schema and storage model: How you represent scopes, revisions, locks, and membership. What goes in a relational store versus a blob store, and how you handle immutability.

  2. Synchronization mechanics: Client-server protocol for fetching deltas, submitting changes, and detecting conflicts. How offline edits reconcile when multiple devices modify the same key.

  3. Merge and evaluation logic: Where hierarchical resolution happens (client, server, or both) and how you implement deterministic precedence with locking.

  4. Failure and edge-case handling: Strategies for partition tolerance, disaster recovery, duplicate event delivery, and schema validation breakage.

Provide concrete architectural choices, data flow diagrams where helpful, and reasoning about trade-offs.

Hints

Hint 1

The 50 ms startup constraint means hierarchical resolution must happen fully offline from cached state.

Hint 2

Storing full snapshots for every revision wastes space; key-level deltas and content-addressed blobs deduplicate effectively.

Hint 3

A monotonic revision number per scope is simpler than vector clocks when the server serializes all writes to that scope.