Add safe Vcore wowdiag and wowsrc imports with original-data provenance
This commit is contained in:
1 parent
4543e7cd31
commit
741c1ca4a5
25 files changed
+1469
-9
No files matched your search
@@ -150,6 +150,13 @@ class CaseAssembler:
|
||||
add(path, role)
|
||||
reports = [(path, load(path, "report")) for path, role in roles if role == "report"]
|
||||
reproductions = [(path, load(path, "reproduction")) for path, role in roles if role == "reproduction"]
|
||||
for _, document in reports + reproductions:
|
||||
nodes = [document] + [node for field in ("observations", "expected_behavior", "comments", "tester_hypotheses", "facts", "entities", "data_quality_issues") for node in document.get(field, [])]
|
||||
for node in nodes:
|
||||
if "origin" in node:
|
||||
for field in ("source_ref", "archive_ref"):
|
||||
if node["origin"].get(field) is not None:
|
||||
require_file(reader, node["origin"][field])
|
||||
for _, document in reproductions:
|
||||
for path in document.get("attachments", []):
|
||||
add(path, "attachment")
|
||||
@@ -174,11 +181,15 @@ class CaseAssembler:
|
||||
identity = (entity["type"], entity_id)
|
||||
record = entities.setdefault(identity, {"type": identity[0], "id": identity[1], "roles": [], "provenance": []})
|
||||
record["roles"] = sorted(set(record["roles"]) | set(entity.get("roles", [])))
|
||||
record["provenance"].append(provenance(path, f"/entities/{index}", "report" if document["format"] == "viano-bug-report" else "reproduction_record"))
|
||||
record["provenance"].append(provenance(path, f"/entities/{index}", "report" if document["format"] == "viano-bug-report" else "reproduction_record", entity))
|
||||
issues = []
|
||||
|
||||
def issue(code, message, refs=None):
|
||||
issues.append({"code": code, "message": message, "refs": refs or []})
|
||||
for path, report in reports:
|
||||
for index, item in enumerate(report.get("data_quality_issues", [])):
|
||||
source = item.get("origin", {"source_ref": path, "json_pointer": f"/data_quality_issues/{index}"})
|
||||
issue(item["code"], item["message"], [{"source_ref": source["source_ref"], "json_pointer": source["json_pointer"]}])
|
||||
|
||||
if not index_ref:
|
||||
issue("MISSING_INPUT_INDEX", "No explicit case input index was supplied")
|
||||
@@ -215,7 +226,8 @@ class CaseAssembler:
|
||||
"format": "viano-case", "format_version": 1, "builder_version": "1",
|
||||
"case": {"case_id": manifest["case_id"], "package_id": manifest["package_id"], "analysis_revision": int(manifest["analysis_revision"]),
|
||||
"source_generation": int(manifest["package_generation"]), "project": copy.deepcopy(manifest["project"])},
|
||||
"bug": {"reports": [{"source_ref": path, "title": document.get("title"), "summary": document.get("summary")} for path, document in reports]},
|
||||
"bug": {"reports": [{"source_ref": path, "title": document.get("title"), "summary": document.get("summary"),
|
||||
**({"origin": copy.deepcopy(document["origin"])} if "origin" in document else {})} for path, document in reports]},
|
||||
"human_observations": {"observations": observations, "comments": comments, "tester_hypotheses": hypotheses},
|
||||
"expected_behavior": expected,
|
||||
"reproduction": {"records": reproduction_records},
|
||||
|
||||
Reference in new issue
Block a user