feat: add BLIF Flow v2 shadow compare cutover layer
This commit is contained in:
@@ -102,14 +102,15 @@ def rebuild_blif_flow_v2_projection(
|
||||
) -> dict[str, Any]:
|
||||
"""Idempotently rebuild projection rows and state-change transitions.
|
||||
|
||||
``off`` is a no-op. ``shadow`` writes only additive projection tables.
|
||||
Compare/authoritative behavior is deliberately not implemented.
|
||||
``off`` is a no-op. ``shadow`` and ``compare`` write only the same additive
|
||||
projection tables. Compare affects observation at the read boundary, never
|
||||
the persisted business rows. Authoritative remains deliberately disabled.
|
||||
"""
|
||||
selected_mode = str(mode or settings.blif_flow_v2_mode or "off").strip().lower()
|
||||
if selected_mode == "off":
|
||||
return {"mode": "off", "projection_count": 0, "transitions_written": 0, "disabled": True}
|
||||
if selected_mode != "shadow":
|
||||
raise RuntimeError(f"BLIF Flow v2 mode {selected_mode!r} is not implemented; only off/shadow are safe")
|
||||
if selected_mode not in {"shadow", "compare"}:
|
||||
raise RuntimeError(f"BLIF Flow v2 mode {selected_mode!r} is disabled; only off/shadow/compare are safe")
|
||||
if not re.fullmatch(r"[a-z_][a-z0-9_]*", target_schema):
|
||||
raise ValueError("invalid target_schema")
|
||||
|
||||
@@ -208,7 +209,7 @@ def rebuild_blif_flow_v2_projection(
|
||||
conn.close()
|
||||
|
||||
return {
|
||||
"mode": "shadow", "projection_count": len(values),
|
||||
"mode": selected_mode, "projection_count": len(values),
|
||||
"canonical_count": sum(not value["is_duplicate_representation"] for value in values),
|
||||
"duplicate_count": sum(value["is_duplicate_representation"] for value in values),
|
||||
"transitions_written": transitions_written, "disabled": False,
|
||||
|
||||
Reference in New Issue
Block a user