audit pipeline v1.2: canonical business record as diff baseline (owner-verified truth), website JSON-LD hours, single-command e2e with gate

This commit is contained in:
2026-08-16 19:08:45 +00:00
parent aa41ac5f6f
commit e2465fe159
+17 -7
View File
@@ -140,14 +140,24 @@ def check(run_dir, strict=False):
if addr_core(g.get("address")) == addr_core(a.get("address")): if addr_core(g.get("address")) == addr_core(a.get("address")):
fails.append(f"support: address claim not re-derived from raw (cores equal)") fails.append(f"support: address claim not re-derived from raw (cores equal)")
elif t.startswith("Hours"): elif t.startswith("Hours"):
days = [] # re-derive against the SAME shared baseline the engine used (canonical if present)
from canonical_baseline import fetch_canonical_record, resolve_reference, normalize_hours_dict, parse_hours_value
try:
rec = fetch_canonical_record(name)
except Exception:
rec = None
_label, ref_hours, _prov = resolve_reference({"name": name, "sources": src}, rec)
ref_norm = normalize_hours_dict(ref_hours or {})
dev = []
for day in ("monday", "tuesday", "wednesday", "thursday", "friday", "saturday", "sunday"): for day in ("monday", "tuesday", "wednesday", "thursday", "friday", "saturday", "sunday"):
gh = (g.get("hours") or {}).get(day) rv = ref_norm.get(day)
ah = (a.get("hours") or {}).get(day) if rv is None:
if gh and ah and day_eq(gh, ah) == "diff": continue
days.append(day) if any(parse_hours_value((s.get("hours") or {}).get(day)) not in (None, rv)
if not days: for s in src.values() if isinstance(s, dict) and s.get("hours")):
fails.append(f"support: hours claim not re-derived from raw (no differing day)") dev.append(day)
if not dev:
fails.append(f"support: hours claim not re-derived from raw (no surface deviates from reference)")
elif "UTM" in t: elif "UTM" in t:
gu, au = g.get("website"), a.get("website") gu, au = g.get("website"), a.get("website")
if not (( "?" in (gu or "")) != ("?" in (au or ""))): if not (( "?" in (gu or "")) != ("?" in (au or ""))):