From e2465fe159dbe8cd3c4a5e008328e3b5a417cbf7 Mon Sep 17 00:00:00 2001 From: Tony Balascio Date: Sun, 16 Aug 2026 19:08:45 +0000 Subject: [PATCH] audit pipeline v1.2: canonical business record as diff baseline (owner-verified truth), website JSON-LD hours, single-command e2e with gate --- implementation/auditing/report_gate.py | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/implementation/auditing/report_gate.py b/implementation/auditing/report_gate.py index d29b0e6..0ada75c 100644 --- a/implementation/auditing/report_gate.py +++ b/implementation/auditing/report_gate.py @@ -140,14 +140,24 @@ def check(run_dir, strict=False): if addr_core(g.get("address")) == addr_core(a.get("address")): fails.append(f"support: address claim not re-derived from raw (cores equal)") 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"): - gh = (g.get("hours") or {}).get(day) - ah = (a.get("hours") or {}).get(day) - if gh and ah and day_eq(gh, ah) == "diff": - days.append(day) - if not days: - fails.append(f"support: hours claim not re-derived from raw (no differing day)") + rv = ref_norm.get(day) + if rv is None: + continue + if any(parse_hours_value((s.get("hours") or {}).get(day)) not in (None, rv) + for s in src.values() if isinstance(s, dict) and s.get("hours")): + 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: gu, au = g.get("website"), a.get("website") if not (( "?" in (gu or "")) != ("?" in (au or ""))):