recon_gen.common.spine.semantic_lock

recon_gen.common.spine.semantic_lock(conn, invariants)[source]

Run detect(conn) for every invariant; return the lock dict.

Returned dict is {invariant.name: frozenset(detected_violations)}. frozenset makes the value byte-stable: two runs that produce the same set in different insertion orders compare equal.

The DICT itself is not frozen, but its keys + values are immutable; equality (lock_a == lock_b) is the gate. The caller decides whether to lock against a literal Python value, a JSON-serialized snapshot, or a tests/data/_semantic_locks/<scenario>.json file (the eventual successor to _locked_seeds).

Return type:

dict[str, frozenset[Violation]]

Parameters:
  • conn (SyncConnection)

  • invariants (Iterable[Invariant])