394d5dae3f
- report_generate.py: REPORT-final.md + VALIDATION.md from findings + raw capture; per-surface status from summary.surfaces_ok; Data Limitations - report_gate.py: §6 gate scripted (count/evidence/identity/material support); non-zero exit blocks delivery - audit_diff.py: before/after capture comparison -> DELTA.md - audit_pipeline.sh: 2 steps -> 4; collision-safe capture copy (re-runs preserve baseline); relative output dir resolved to absolute - beta-audit-process.md: locked v1.0 -> v1.1 (+ dated decision record) - all 9 runs of the 2026-08-15 batch regenerated + gated (9/9 PASS) - live end-to-end proof: Gilmore re-run, DELTA.md 0 changes (same day)
66 lines
2.7 KiB
Bash
Executable File
66 lines
2.7 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
# VeriPath Audit Pipeline
|
|
# Usage: ./audit_pipeline.sh "Business Name" "City, ST" [output-dir]
|
|
# Sequence: multi_scraper.py → audit_engine.py → findings + raw capture in target folder
|
|
|
|
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
|
BUSINESS="${1:?Usage: ./audit_pipeline.sh \"Business Name\" \"City, ST\" [output-dir]}"
|
|
LOCATION="${2:?Usage: ./audit_pipeline.sh \"Business Name\" \"City, ST\" [output-dir]}"
|
|
OUTPUT_DIR="${3:-}"
|
|
# cwd-proof: resolve to absolute once, so relative output dirs can't break capture copy
|
|
if [ -n "$OUTPUT_DIR" ]; then
|
|
mkdir -p "$OUTPUT_DIR"
|
|
OUTPUT_DIR="$(cd "$OUTPUT_DIR" && pwd)"
|
|
fi
|
|
|
|
# Temporary working dir for this run
|
|
WORK_DIR=$(mktemp -d /tmp/veripath.XXXXXX)
|
|
trap 'rm -rf "$WORK_DIR"' EXIT
|
|
|
|
ENGINE_ARGS=("--md")
|
|
|
|
echo "[$(date +%T)] Scraping: $BUSINESS @ $LOCATION"
|
|
|
|
# Step 1: Multi-surface extraction (3rd arg = output DIR; scraper writes <dir>/multi_surface.json/<file>.json)
|
|
uv run python3 "$SCRIPT_DIR/multi_scraper.py" "$BUSINESS" "$LOCATION" "$WORK_DIR"
|
|
SCRAPER_OUT=$(find "$WORK_DIR" -name "*multi_surface*.json" | head -1)
|
|
if [ ! -s "$SCRAPER_OUT" ]; then
|
|
echo "[FAIL] multi_scraper.py produced no output" >&2
|
|
exit 1
|
|
fi
|
|
echo "[OK] Extraction complete: $SCRAPER_OUT"
|
|
|
|
# Step 2: Audit engine
|
|
if [ -n "$OUTPUT_DIR" ]; then
|
|
mkdir -p "$OUTPUT_DIR"
|
|
# Required artifact set (locked beta process v1.1): raw capture + findings in the run folder
|
|
# Collision-safe: a re-run never overwrites the prior capture (temporal baseline, v1.1 §5)
|
|
DEST="$OUTPUT_DIR/$(basename "$SCRAPER_OUT")"
|
|
if [ -e "$DEST" ]; then
|
|
BASE="$(basename "${DEST%.*}")"; EXT="${DEST##*.}"
|
|
DEST="$OUTPUT_DIR/${BASE}__$(date +%Y%m%d-%H%M%S).$EXT"
|
|
echo "[WARN] prior capture present — writing $DEST (baseline preserved)"
|
|
fi
|
|
cp "$SCRAPER_OUT" "$DEST"
|
|
ENGINE_ARGS+=("--output-dir" "$OUTPUT_DIR")
|
|
echo "[$(date +%T)] Auditing (output: $OUTPUT_DIR)"
|
|
uv run python3 "$SCRIPT_DIR/audit_engine.py" "$SCRAPER_OUT" "${ENGINE_ARGS[@]}"
|
|
|
|
# Step 3: Report + validation (locked process v1.1 §3)
|
|
echo "[$(date +%T)] Generating report + validation"
|
|
uv run python3 "$SCRIPT_DIR/report_generate.py" "$OUTPUT_DIR"
|
|
|
|
# Step 4: Pre-delivery consistency gate (v1.1 §6) — FAIL blocks delivery
|
|
echo "[$(date +%T)] Consistency gate"
|
|
if ! uv run python3 "$SCRIPT_DIR/report_gate.py" "$OUTPUT_DIR"; then
|
|
echo "[GATE FAIL] $OUTPUT_DIR — do NOT deliver; see GATE RESULT in VALIDATION.md" >&2
|
|
exit 1
|
|
fi
|
|
echo "[DONE] Findings + raw capture + report + gate written to $OUTPUT_DIR/"
|
|
else
|
|
echo "[$(date +%T)] Auditing (stdout)"
|
|
uv run python3 "$SCRIPT_DIR/audit_engine.py" "$SCRAPER_OUT" "${ENGINE_ARGS[@]}"
|
|
fi
|