Design Enterprise Background-Check Rule Storage
Model, validate, store, and retrieve tenant-owned background-check rules as reproducible versions.
For this exercise, assume enterprise administrators enter background-check rules through a structured form. A rule is a finite tree of ALL or ANY groups and typed comparisons against a permitted field catalog.
Comparisons may use equality, membership in a nonempty list, or an ordered numeric comparison; the field catalog defines the type and allowed operators for each field. Administrators create and edit a draft, publish a valid draft, and retrieve one exact published version.
Publication makes that version immutable, while later editing starts a new draft. Reject unknown fields, wrong value types, invalid operators, empty groups, and trees deeper than ten levels; store data rather than executable user expressions. Keep every rule and version isolated to its enterprise tenant.
An edit or publication based on a stale draft revision must fail without overwriting newer work.
The exception is a retry of a successful publication: it may return the same stored version only when the tenant, rule and requested draft revision identify that exact prior result; it must never publish a different latest draft or create another version.
Design the domain objects, validation and serialization boundaries, storage contracts, and interactions. For the follow-up, explain how a new comparison operator or field-catalog revision can be added without changing the meaning of stored published versions.
Evaluating candidate records, choosing legal screening policy, a graphical editor, distributed scaling, and implementation code are outside scope.