docs: add batch176 Krea and ControlNet offline mapping evidence
Co-authored-by: multica-agent <github@multica.ai>
This commit is contained in:
@@ -0,0 +1,67 @@
|
||||
"""Evidence consistency, recursive types, CSV round trip and exact replay comparison."""
|
||||
|
||||
import ast
|
||||
import csv
|
||||
import json
|
||||
|
||||
from audit import HERE, ROOT, at, read, same, sha, typed, write
|
||||
|
||||
|
||||
def main():
|
||||
summary = []
|
||||
replay = ROOT / ".local-evidence/batch176-offline-mapping/replay"
|
||||
for key in ("krea", "controlnet"):
|
||||
matrix = read(f"{key}-matrix.json")
|
||||
for suffix in ("matrix.json", "matrix.csv"):
|
||||
name = f"{key}-{suffix}"
|
||||
assert (HERE / name).read_bytes() == (replay / name).read_bytes()
|
||||
with (HERE / f"{key}-matrix.csv").open(newline="") as stream:
|
||||
rows = [
|
||||
{k: json.loads(v) for k, v in row.items() if v != ""}
|
||||
for row in csv.DictReader(stream)
|
||||
]
|
||||
assert sum(r["kind"] == "node" for r in rows) == matrix["original_node_count"]
|
||||
assert sum(r["kind"] == "api_reference" for r in rows) == matrix["api_reference_count"]
|
||||
assert sum(r["kind"] == "original_saved_value" for r in rows) == (
|
||||
42 if key == "krea" else 34
|
||||
)
|
||||
for row in matrix["saved_values"] + matrix["api_inputs"]:
|
||||
source = json.loads((ROOT / row["original_document"]).read_text())
|
||||
assert same(at(source, row["original_pointer"]), row["value"])
|
||||
assert same(typed(row["value"]), row["recursive_type"])
|
||||
assert matrix["execution_release"] is False
|
||||
assert all(r["target_identity_verified"] is False for r in matrix["identity_records"])
|
||||
report = (HERE / f"{key}-说明.md").read_text()
|
||||
assert all(r["original_pointer"] in report for r in matrix["saved_values"])
|
||||
assert all(
|
||||
r["original_pointer"] in report
|
||||
for r in matrix["api_inputs"]
|
||||
if r["kind"] == "api_reference"
|
||||
)
|
||||
assert len(matrix["source_evidence"]) == (25 if key == "controlnet" else 0)
|
||||
summary.append(
|
||||
dict(
|
||||
case=key,
|
||||
csv_rows=len(rows),
|
||||
recursive_values_checked=True,
|
||||
replay_sha256=sha((HERE / f"{key}-matrix.json").read_bytes()),
|
||||
)
|
||||
)
|
||||
for path in HERE.glob("*.py"):
|
||||
ast.parse(path.read_text())
|
||||
write(
|
||||
"verification.json",
|
||||
dict(
|
||||
cases=summary,
|
||||
csv_roundtrip=True,
|
||||
exact_replay=True,
|
||||
tools_ast=True,
|
||||
no_new_import=True,
|
||||
no_product_tests=True,
|
||||
),
|
||||
)
|
||||
print(json.dumps(summary))
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Reference in New Issue
Block a user