Design a Versioned Laboratory Notebook
Model notebook entries, immutable revisions, concurrent edits, history, and extensible scientific content.
For this exercise, assume a collaborative laboratory notebook used by scientists. The core journey is to create notebook entries, edit them through immutable revisions, inspect history, and restore a prior revision as a new head.
The following practice constraints complete the reported seed: an entry belongs to one notebook and every edit supplies the expected head revision; revisions are immutable and keep author plus time; content must contain at least one supported, nonempty block and reject malformed block payloads; restore creates a new revision rather than deleting history; unknown-entry and unauthorized-entry outcomes reveal no entry content, revision metadata, or notebook membership detail; store revision bodies durably while metadata remains queryable; binary attachment storage and real-time text merging are outside scope.
Design the object model, responsibilities, focused contracts, state transitions, and important errors. Protect this invariant: a published revision is immutable and the entry head advances only from the expected prior head.
Explain how the design reports stale expected head, unknown entry or revision, invalid content, and unauthorized edit. Do not implement code; produce a coherent design that can be tested and extended.