Design a Service That Determines Required Pull Request Approvers Across Many Repositories

Quick Overview

A system design question: build the service that decides who must approve a pull request, resolving owners from the changed files, showing required approvers and gating the merge. It tests ownership-rule semantics, pseudocode for the resolution logic, and keeping it fast for a busy monorepo and many repositories of different sizes.

Design a Service That Determines Required Pull Request Approvers Across Many Repositories

Company: LinkedIn

Role: Software Engineer

Category: System Design

Difficulty: medium

Interview Round: Onsite

Design a system that determines who must approve ("stamp") a pull request before it can be merged. When a pull request is opened or updated, the system works out from the files it changes which owners must sign off, shows the required approvers on the pull request, and tells the merge check whether the approvals collected so far are enough. Draw the architecture, and write pseudocode for the key logic that resolves the required approvers. Unless the interviewer says otherwise, assume ownership is declared in owners files committed to the repository's directories, and that a directory's owners also own everything below it. ### Clarifying Questions - Is there one monorepo, many repositories, or both? How large are the biggest repositories in files and in owners files? - How are ownership rules expressed: files in directories, per-file patterns, team aliases? Can a directory stop inheriting its parent's owners? - Is one approval from any owner of each changed file enough, or do some paths need several approvers or more than one team? - Can the author's own approval count, and do earlier approvals survive when new commits are pushed? - How many pull request updates per second arrive at peak, and how quickly must the required approvers appear? ### Part 1 — Resolve the required approvers Given the changed files of a pull request and the ownership rules, compute which owner groups must approve, and decide whether a given set of approvals satisfies them. Write pseudocode for this logic. ```hint Walk the path For one changed file, list every directory from the repository root down to the file, and ask which of their rules apply and how a nearer rule interacts with a farther one. ``` #### What This Part Should Cover - Rule semantics: nearest owners, inheritance, file patterns and team expansion - Grouping changed files by the owner set that governs them, and the satisfaction check - Which version of the rules is authoritative when the pull request edits an owners file, and how renamed and deleted files are handled ### Part 2 — Architecture Show how events from the code host reach the resolver, where rules and results are stored, and how the result is published as a merge check and a reviewer list. ```hint What changes when Separate what changes rarely, the ownership rules at a given commit, from what changes on every push or review: the changed files and the approvals so far. ``` #### What This Part Should Cover - The event flow from pull request and review events to the merge check - Storage for the rule index and for per-pull-request results - Idempotent, ordered processing when updates race each other ### Part 3 — Scale to a high commit rate and many repositories The interviewer pushes back: the commit rate is very high, and instead of one monorepo there are many repositories of very different sizes. Explain how you keep the system fast for both the largest and the smallest repositories. ```hint Repeated work Ask which work is repeated for every pull request in a big repository, and whether it depends on the pull request or only on the commit it is based on. ``` #### What This Part Should Cover - Reusing the rule index across pull requests and commits, with a cache key that unrelated commits do not invalidate - Keeping repository data local to workers and preparing large repositories before they are needed - Different handling for small repositories and very large ones ### What a Strong Answer Covers - Asks about the repository landscape and the approval policy before committing to a design - Gives correct, deterministic resolution pseudocode with sensible rule semantics - Separates rule indexing from per-pull-request evaluation and drives both from code-host events - Explains the caching, pre-warming and partitioning that keep latency low under a high commit rate - Covers the merge check's behaviour on failure, auditability and monitoring ### Follow-up Questions - A pull request edits an owners file. Whose approval should that change need? - A large refactor touches files owned by dozens of teams. How do you keep resolution fast and suggest a small set of reviewers? - The approver service is unavailable. Should merges be blocked, and how would an urgent fix get through? - How would you detect that cached rule indexes have drifted from the repositories?

Overview: A system design question: build the service that decides who must approve a pull request, resolving owners from the changed files, showing required approvers and gating the merge. It tests ownership-rule semantics, pseudocode for the resolution logic, and keeping it fast for a busy monorepo and many repositories of different sizes.

Read the full LinkedIn Software Engineer interview experience this question came from

LinkedIn logo
LinkedIn
Nov 15, 2026
mediumSoftware EngineerOnsiteSystem Design
0
0

Design a system that determines who must approve ("stamp") a pull request before it can be merged. When a pull request is opened or updated, the system works out from the files it changes which owners must sign off, shows the required approvers on the pull request, and tells the merge check whether the approvals collected so far are enough. Draw the architecture, and write pseudocode for the key logic that resolves the required approvers.

Unless the interviewer says otherwise, assume ownership is declared in owners files committed to the repository's directories, and that a directory's owners also own everything below it.

Clarifying Questions Guidance

  • Is there one monorepo, many repositories, or both? How large are the biggest repositories in files and in owners files?
  • How are ownership rules expressed: files in directories, per-file patterns, team aliases? Can a directory stop inheriting its parent's owners?
  • Is one approval from any owner of each changed file enough, or do some paths need several approvers or more than one team?
  • Can the author's own approval count, and do earlier approvals survive when new commits are pushed?
  • How many pull request updates per second arrive at peak, and how quickly must the required approvers appear?

Part 1 — Resolve the required approvers

Given the changed files of a pull request and the ownership rules, compute which owner groups must approve, and decide whether a given set of approvals satisfies them. Write pseudocode for this logic.

What This Part Should Cover Guidance

  • Rule semantics: nearest owners, inheritance, file patterns and team expansion
  • Grouping changed files by the owner set that governs them, and the satisfaction check
  • Which version of the rules is authoritative when the pull request edits an owners file, and how renamed and deleted files are handled

Part 2 — Architecture

Show how events from the code host reach the resolver, where rules and results are stored, and how the result is published as a merge check and a reviewer list.

What This Part Should Cover Guidance

  • The event flow from pull request and review events to the merge check
  • Storage for the rule index and for per-pull-request results
  • Idempotent, ordered processing when updates race each other

Part 3 — Scale to a high commit rate and many repositories

The interviewer pushes back: the commit rate is very high, and instead of one monorepo there are many repositories of very different sizes. Explain how you keep the system fast for both the largest and the smallest repositories.

What This Part Should Cover Guidance

  • Reusing the rule index across pull requests and commits, with a cache key that unrelated commits do not invalidate
  • Keeping repository data local to workers and preparing large repositories before they are needed
  • Different handling for small repositories and very large ones

What a Strong Answer Covers Guidance

  • Asks about the repository landscape and the approval policy before committing to a design
  • Gives correct, deterministic resolution pseudocode with sensible rule semantics
  • Separates rule indexing from per-pull-request evaluation and drives both from code-host events
  • Explains the caching, pre-warming and partitioning that keep latency low under a high commit rate
  • Covers the merge check's behaviour on failure, auditability and monitoring

Follow-up Questions Guidance

  • A pull request edits an owners file. Whose approval should that change need?
  • A large refactor touches files owned by dozens of teams. How do you keep resolution fast and suggest a small set of reviewers?
  • The approver service is unavailable. Should merges be blocked, and how would an urgent fix get through?
  • How would you detect that cached rule indexes have drifted from the repositories?