Figma multiplayer edits may depend on earlier edits, such as creating a frame before adding a child layer. Implement commit_batch to divide edits into ordered commit batches while ensuring every edit is committed strictly after all of its dependencies.
Each batch may contain at most max_batch_size edits. Among edits that are currently eligible, preserve their original input order. Edits that become eligible while constructing a batch must wait until the next batch. Assume the dependency graph is valid and acyclic.
Given a list operations, where each operation is a dictionary with:
id: a unique string identifying the editdepends_on: a list of operation IDs that must be committed earlierReturn a list of batches. Each batch is a list of operation IDs. Every dependency must appear in an earlier batch, and no batch may exceed max_batch_size.
operations.def commit_batch(operations, max_batch_size):