This question evaluates a candidate's proficiency in Python object-oriented design, file I/O and JSON serialization, concurrency control via locking, context manager protocols, custom exception handling, and adherence to Liskov substitution when implementing a rotating file sink.
You are given an existing Python 3.10 codebase with an abstract base class RecordSink (from abc import ABC, abstractmethod) that defines open() -> None, write(record: dict) -> None, and close() -> None. A Pipeline class instantiates a sink, calls sink.open() once, then for each record calls sink.write(record), and finally calls sink.close(); Pipeline must not be modified. Implement a new concrete RotatingFileSink that: (