Compute Which Monorepo Tasks Miss the Content-Hash Build Cache

Last updated: November 29, 2026

Quick Overview

Given a task graph for a monorepo (each task has input files and dependency tasks), current file content hashes and a set of hashes already in a remote cache, compute every task's hash and return the tasks that must actually run, in dependency order.

Vercel
Software Engineering Fundamentals
Software Engineer
Vercel
November 29, 2026
Software Engineer
Onsite
Software Engineering Fundamentals
Medium

0

0

0 solved


Given a task graph for a monorepo (each task has input files and dependency tasks), current file content hashes and a set of hashes already in a remote cache, compute every task's hash and return the tasks that must actually run, in dependency order.

Turborepo and Vercel's remote cache skip work by hashing a task's inputs together with the hashes of its dependencies, so a change in one package only rebuilds what depends on it. Onsite interviewers use this to test graph traversal, deterministic hashing and reasoning about cache correctness.

What the Interviewer Expects
  • Topologically order tasks and detect cycles with a clear error
  • Make the hash deterministic by sorting inputs and dependencies
  • Include dependency hashes so changes propagate downstream
  • Return cache misses in an order that is safe to execute
  • Discuss what else belongs in the hash (env vars, lockfile, task command)
Key Topics to Cover
Topological sort
Content hashing
Build caching
Cycle detection
Incremental builds
How to Approach This
  1. Apply SOLID principles. Single Responsibility makes code testable, Open/Closed makes it extensible.
  2. Choose data structures based on access patterns, not familiarity.
  3. Prefer immutable data and message passing over shared mutable state for concurrency.
  4. Design APIs with RESTful conventions, versioning, meaningful errors, and pagination from day one.
Possible Follow-up Questions
  • Which environment variables should be part of the hash, and what goes wrong if you miss one?
  • How would you run independent misses in parallel with a worker limit?
  • How do you protect the remote cache from a poisoned artifact uploaded by a compromised branch?
  • What changes if a task's outputs, not inputs, should drive downstream hashes?
Sharpen Your Skills on Codemia

Practice similar problems with our interactive workspace, get AI feedback, and track your progress.

Practice System Design Problems
Sample Answer
Requirements

Tasks look like web#build with inputs (files) and deps (other tasks). A task's hash must change whenever any input file changes or any dependency's hash changes, and must be identical across mac...

High-Level Design
  1. DFS topological sort with three states (unvisited, active, done); hitting an active node means a cycle.
  2. Walk tasks in topological order so every dependency hash exists before its dependent is ha...

Submit Your Answer
Markdown supported

Related Questions