|
@@ -1954,20 +1954,11 @@ def collect_analysis_inputs(
|
|
|
or ""
|
|
or ""
|
|
|
).strip()
|
|
).strip()
|
|
|
td_bound = str(report_artifact or artifact).strip()
|
|
td_bound = str(report_artifact or artifact).strip()
|
|
|
- release_identity = {
|
|
|
|
|
- "schema": "prod2u-release-set-identity-v1",
|
|
|
|
|
- "algorithm_version": "prod2u-release-set-id-v1",
|
|
|
|
|
- "package_stage": stage_n,
|
|
|
|
|
- "non_final": stage_n != "final-review",
|
|
|
|
|
- "release_set_id": release_set_id,
|
|
|
|
|
- "base_dev_commit": pkg_prov.BASE_DEV_COMMIT_DEFAULT,
|
|
|
|
|
- "matrix_verification_tip": matrix_tip or None,
|
|
|
|
|
- "software_verification_run_id": matrix_run or None,
|
|
|
|
|
- "verification_tip": matrix_tip or None,
|
|
|
|
|
- "verification_run_id": matrix_run or td_verification_run_id or td_run,
|
|
|
|
|
- "td_bound_commit": td_bound,
|
|
|
|
|
|
|
+ td_fields_live: dict[str, Any] = {
|
|
|
"artifact_source_commit": artifact,
|
|
"artifact_source_commit": artifact,
|
|
|
- "delivery_commit": delivery,
|
|
|
|
|
|
|
+ "td_bound_commit": td_bound,
|
|
|
|
|
+ "td_artifact_run_id": td_artifact_run_id,
|
|
|
|
|
+ "td_verification_run_id": td_verification_run_id or None,
|
|
|
"bitstream_sha256": bit_sha,
|
|
"bitstream_sha256": bit_sha,
|
|
|
"td_binding_status": "pass",
|
|
"td_binding_status": "pass",
|
|
|
"td_policy": (
|
|
"td_policy": (
|
|
@@ -1975,77 +1966,87 @@ def collect_analysis_inputs(
|
|
|
if bit_sha == pkg_prov.CANONICAL_TD_A1_BITSTREAM
|
|
if bit_sha == pkg_prov.CANONICAL_TD_A1_BITSTREAM
|
|
|
else "fresh_td"
|
|
else "fresh_td"
|
|
|
),
|
|
),
|
|
|
- "production_binding": None,
|
|
|
|
|
- "production_polarity_config": {
|
|
|
|
|
- "limit_active_high": polarity.get("limit_active_high"),
|
|
|
|
|
- "dir_close_level": polarity.get("dir_close_level"),
|
|
|
|
|
- "close_limit_is_ls": polarity.get("close_limit_is_ls"),
|
|
|
|
|
- "generated_masks": polarity.get("generated_masks")
|
|
|
|
|
- or polarity.get("masks"),
|
|
|
|
|
- "config_fingerprint": config_fp,
|
|
|
|
|
- },
|
|
|
|
|
- "td_verification_run_id": td_verification_run_id or td_run,
|
|
|
|
|
- "td_artifact_run_id": td_artifact_run_id,
|
|
|
|
|
- "td_receipt_sha256": None,
|
|
|
|
|
- "reference_fingerprint_schema": ref_fp.get("schema"),
|
|
|
|
|
- "reference_set_fingerprint": ref_fp["sha256"],
|
|
|
|
|
- "polarity_fingerprint": config_fp,
|
|
|
|
|
- "hardware_validation": "not_run",
|
|
|
|
|
- "lut": None,
|
|
|
|
|
- "mslice": None,
|
|
|
|
|
- "dsp": None,
|
|
|
|
|
- "note": (
|
|
|
|
|
- "release_set_id is independently recomputable from these fields; "
|
|
|
|
|
- "td_artifact_run_id (TD receipt run_id) feeds release_set_id; "
|
|
|
|
|
- "verification_run_id is the software matrix run id when set. "
|
|
|
|
|
- "Sibling ZIP SHAs live only in the external release-set JSON."
|
|
|
|
|
- ),
|
|
|
|
|
}
|
|
}
|
|
|
try:
|
|
try:
|
|
|
live_parsed = pkg_prov.parse_td_resource_fields(td_report_payload)
|
|
live_parsed = pkg_prov.parse_td_resource_fields(td_report_payload)
|
|
|
- if live_parsed.get("lut") is not None:
|
|
|
|
|
- release_identity["lut"] = live_parsed.get("lut")
|
|
|
|
|
- if live_parsed.get("mslice") is not None:
|
|
|
|
|
- release_identity["mslice"] = live_parsed.get("mslice")
|
|
|
|
|
- if live_parsed.get("dsp") is not None:
|
|
|
|
|
- release_identity["dsp"] = live_parsed.get("dsp")
|
|
|
|
|
|
|
+ for key in ("lut", "mslice", "dsp"):
|
|
|
|
|
+ if live_parsed.get(key) is not None:
|
|
|
|
|
+ td_fields_live[key] = live_parsed.get(key)
|
|
|
except Exception: # noqa: BLE001
|
|
except Exception: # noqa: BLE001
|
|
|
live_parsed = {}
|
|
live_parsed = {}
|
|
|
|
|
+ for report_meta in binding.get("td_reports") or []:
|
|
|
|
|
+ if isinstance(report_meta, dict) and report_meta.get("sha256"):
|
|
|
|
|
+ td_fields_live["td_receipt_sha256"] = report_meta.get("sha256")
|
|
|
|
|
+ break
|
|
|
n_inputs = len(art_to_del.get("inputs") or [])
|
|
n_inputs = len(art_to_del.get("inputs") or [])
|
|
|
changed_n = len(art_to_del.get("production_changed_paths") or [])
|
|
changed_n = len(art_to_del.get("production_changed_paths") or [])
|
|
|
if n_inputs:
|
|
if n_inputs:
|
|
|
matched = n_inputs - changed_n
|
|
matched = n_inputs - changed_n
|
|
|
if matched < 0:
|
|
if matched < 0:
|
|
|
matched = 0
|
|
matched = 0
|
|
|
- release_identity["production_binding"] = pkg_prov.format_production_binding(
|
|
|
|
|
|
|
+ td_fields_live["production_binding"] = pkg_prov.format_production_binding(
|
|
|
expected=n_inputs,
|
|
expected=n_inputs,
|
|
|
matched=matched,
|
|
matched=matched,
|
|
|
missing=0,
|
|
missing=0,
|
|
|
hash_mismatch=changed_n,
|
|
hash_mismatch=changed_n,
|
|
|
)
|
|
)
|
|
|
if (
|
|
if (
|
|
|
- release_identity.get("lut") is None
|
|
|
|
|
- or release_identity.get("mslice") is None
|
|
|
|
|
- or release_identity.get("dsp") is None
|
|
|
|
|
|
|
+ td_fields_live.get("lut") is None
|
|
|
|
|
+ or td_fields_live.get("mslice") is None
|
|
|
|
|
+ or td_fields_live.get("dsp") is None
|
|
|
|
|
+ or not td_fields_live.get("td_receipt_sha256")
|
|
|
) and bit_sha == pkg_prov.CANONICAL_TD_A1_BITSTREAM:
|
|
) and bit_sha == pkg_prov.CANONICAL_TD_A1_BITSTREAM:
|
|
|
try:
|
|
try:
|
|
|
- td_fields = pkg_prov.load_canonical_td_a1_fields(root)
|
|
|
|
|
- if release_identity.get("lut") is None:
|
|
|
|
|
- release_identity["lut"] = td_fields.get("lut")
|
|
|
|
|
- if release_identity.get("mslice") is None:
|
|
|
|
|
- release_identity["mslice"] = td_fields.get("mslice")
|
|
|
|
|
- if release_identity.get("dsp") is None:
|
|
|
|
|
- release_identity["dsp"] = td_fields.get("dsp")
|
|
|
|
|
- if not release_identity.get("td_receipt_sha256"):
|
|
|
|
|
- release_identity["td_receipt_sha256"] = td_fields.get(
|
|
|
|
|
- "td_receipt_sha256"
|
|
|
|
|
- )
|
|
|
|
|
|
|
+ canon_td = pkg_prov.load_canonical_td_a1_fields(root)
|
|
|
|
|
+ for key in (
|
|
|
|
|
+ "lut",
|
|
|
|
|
+ "mslice",
|
|
|
|
|
+ "dsp",
|
|
|
|
|
+ "td_receipt_sha256",
|
|
|
|
|
+ "td_verification_run_id",
|
|
|
|
|
+ "production_binding",
|
|
|
|
|
+ ):
|
|
|
|
|
+ if not td_fields_live.get(key) and canon_td.get(key) is not None:
|
|
|
|
|
+ td_fields_live[key] = canon_td.get(key)
|
|
|
except Exception: # noqa: BLE001
|
|
except Exception: # noqa: BLE001
|
|
|
pass
|
|
pass
|
|
|
- for report_meta in binding.get("td_reports") or []:
|
|
|
|
|
- if isinstance(report_meta, dict) and report_meta.get("sha256"):
|
|
|
|
|
- release_identity["td_receipt_sha256"] = report_meta.get("sha256")
|
|
|
|
|
- break
|
|
|
|
|
|
|
+ release_identity = pkg_prov.build_shared_release_identity(
|
|
|
|
|
+ delivery_commit=delivery,
|
|
|
|
|
+ package_stage=stage_n,
|
|
|
|
|
+ matrix_verification_tip=matrix_tip or None,
|
|
|
|
|
+ software_verification_run_id=matrix_run or None,
|
|
|
|
|
+ config_fingerprint=config_fp,
|
|
|
|
|
+ reference_set_fingerprint=ref_fp["sha256"],
|
|
|
|
|
+ repo_root=root,
|
|
|
|
|
+ claim_bound_bitstream=True,
|
|
|
|
|
+ td_fields=td_fields_live,
|
|
|
|
|
+ extra={
|
|
|
|
|
+ "production_polarity_config": {
|
|
|
|
|
+ "limit_active_high": polarity.get("limit_active_high"),
|
|
|
|
|
+ "dir_close_level": polarity.get("dir_close_level"),
|
|
|
|
|
+ "close_limit_is_ls": polarity.get("close_limit_is_ls"),
|
|
|
|
|
+ "generated_masks": polarity.get("generated_masks")
|
|
|
|
|
+ or polarity.get("masks"),
|
|
|
|
|
+ "config_fingerprint": config_fp,
|
|
|
|
|
+ },
|
|
|
|
|
+ "dir_close_level": polarity.get("dir_close_level"),
|
|
|
|
|
+ "reference_fingerprint_schema": ref_fp.get("schema"),
|
|
|
|
|
+ "note": (
|
|
|
|
|
+ "release_set_id is independently recomputable from these fields; "
|
|
|
|
|
+ "td_artifact_run_id (TD receipt run_id) feeds release_set_id; "
|
|
|
|
|
+ "software_verification_run_id is the software matrix run id when set. "
|
|
|
|
|
+ "Sibling ZIP SHAs live only in the external release-set JSON."
|
|
|
|
|
+ ),
|
|
|
|
|
+ },
|
|
|
|
|
+ )
|
|
|
|
|
+ release_set_id = str(release_identity["release_set_id"])
|
|
|
|
|
+ sibling["release_set_id"] = release_set_id
|
|
|
|
|
+ provenance_artifacts["meta/release-set-sibling.json"] = handoff.json_bytes(
|
|
|
|
|
+ sibling
|
|
|
|
|
+ )
|
|
|
|
|
+ provenance_artifacts["meta/release-set-id.txt"] = (
|
|
|
|
|
+ release_set_id + "\n"
|
|
|
|
|
+ ).encode("ascii")
|
|
|
provenance_artifacts["meta/release-set-identity.json"] = handoff.json_bytes(
|
|
provenance_artifacts["meta/release-set-identity.json"] = handoff.json_bytes(
|
|
|
release_identity
|
|
release_identity
|
|
|
)
|
|
)
|