You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tooling.apache.org by ak...@apache.org on 2026/06/29 21:36:57 UTC
(tooling-agents) 01/02: asvs_orchestrate: restore issue/PR cross-reference wiring dropped in 7833bff
This is an automated email from the ASF dual-hosted git repository.
andrewmusselman pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tooling-agents.git
commit 5c12e53503f970f1a75d59e78f0542a2a83b11a4
Author: Andrew Musselman <ak...@apache.org>
AuthorDate: Mon Jun 29 14:33:29 2026 -0700
asvs_orchestrate: restore issue/PR cross-reference wiring dropped in 7833bff
The scans-style path + metadata.yml change (7833bff) inadvertently deleted
both cross-reference wiring blocks. They sat immediately adjacent to the two
regions that commit rewrote: the issue/PR snapshot fetch was right before the
old repo_path_segment line that the new path layout replaced, and the
compare-and-push block was right after Consolidation done where the metadata.yml
writer was inserted. Each edit swallowed one block as collateral, so runs since
7833bff produced no snapshot and no issues_cross_reference.md (caught on the
groovy run: no Issue/PR snapshot line in the log, grep -c asvs_fetch_issues_prs
returned 0).
Restores both blocks to their pre-7833bff form, keeping all of 7833bff's
path/metadata work:
- Fetch (after commit-hash resolution): snapshot open issues + PRs pinned to
commit_hash into issues_prs:{repo}@{sha}, with the issue/PR count logging.
- Compare (after consolidation, before the metadata writer): asvs_compare_open_issues_prs
returns report_md, which the orchestrator pushes as issues_cross_reference.md
via asvs_push_github, with the tracked/addressed/unaddressed summary logging.
Ordered before the metadata writer so the file exists when supporting_files
is enumerated, and sets cross_reference_done so that branch is no longer dead.
---
ASVS/agents/asvs_orchestrate.py | 81 +++++++++++++++++++++++++++++++++++++++++
1 file changed, 81 insertions(+)
diff --git a/ASVS/agents/asvs_orchestrate.py b/ASVS/agents/asvs_orchestrate.py
index ae6b31f..de791a3 100644
--- a/ASVS/agents/asvs_orchestrate.py
+++ b/ASVS/agents/asvs_orchestrate.py
@@ -369,6 +369,35 @@ async def run(input_dict, tools):
source_id_path += f"/{source_path_prefix}"
source_id = f"{source_id_path} @ {commit_hash}"
+ # ---- Cross-reference: snapshot open issues & PRs (best-effort) ----
+ # Pin a snapshot of the repo's open issues and open PRs (with changed
+ # files) to this exact commit, stored in issues_prs:{repo}@{sha}, so
+ # the post-consolidation cross-reference compares findings against a
+ # fixed point (what was open as of commit_hash) rather than a moving
+ # branch. Keyed on the GitHub repo (repo_owner_name, no sub-path),
+ # which is also what the compare step reads. Best-effort: a failure
+ # here must not abort the audit.
+ try:
+ snap_resp = await gofannon_client.call(
+ agent_name="asvs_fetch_issues_prs",
+ input_dict={"inputText": json.dumps({
+ "repo": repo_owner_name,
+ "sha": commit_hash,
+ "token": source_token,
+ })},
+ )
+ _snap = json.loads(snap_resp.get("outputText", "{}"))
+ if "error" in _snap:
+ print(f" WARNING: issue/PR snapshot failed: {_snap['error']}", flush=True)
+ else:
+ _c = _snap.get("counts", {})
+ _done = "complete" if _snap.get("complete", True) else "INCOMPLETE"
+ print(f" Issue/PR snapshot ({_done}): {_c.get('issues','?')} issues, "
+ f"{_c.get('prs','?')} PRs @ {commit_hash}", flush=True)
+ except Exception as e:
+ print(f" WARNING: issue/PR snapshot call failed ({e}); "
+ f"cross-reference will be skipped", flush=True)
+
# Per-section reports go into CouchDB instead of GitHub. The
# previous approach committed each per-section report to the
# private repo, which surfaced one entry on the public
@@ -1379,6 +1408,58 @@ async def run(input_dict, tools):
else:
print(f" Consolidation done", flush=True)
+ # ---- Cross-reference findings vs open issues/PRs ------
+ # Reads the commit-pinned snapshot written before
+ # discovery and the structured findings persisted by
+ # consolidate; the compare agent RETURNS report_md and
+ # this orchestrator pushes it as issues_cross_reference.md.
+ # Always runs after a successful consolidation.
+ # Best-effort: never fail the run on it. Sets
+ # cross_reference_done so the metadata writer lists the
+ # file authoritatively.
+ cross_reference_done = False
+ try:
+ cmp_resp = await gofannon_client.call(
+ agent_name="asvs_compare_open_issues_prs",
+ input_dict={"inputText": json.dumps({
+ "repo": repo_owner_name,
+ "sha": commit_hash,
+ "reports_namespace": filtered_reports_namespace,
+ })},
+ )
+ cmp_out = json.loads(cmp_resp.get("outputText", "{}"))
+ if "error" in cmp_out:
+ print(f" Cross-reference skipped: {cmp_out['error']}", flush=True)
+ else:
+ s = cmp_out.get("summary", {})
+ print(f" Cross-reference: {s.get('tracked',0)} tracked, "
+ f"{s.get('addressed',0)} addressed by open PR, "
+ f"{s.get('unaddressed',0)} unaddressed "
+ f"(of {s.get('findings',0)})", flush=True)
+ report_md = cmp_out.get("report_md") or ""
+ if report_md:
+ try:
+ await gofannon_client.call(
+ agent_name="asvs_push_github",
+ input_dict={
+ "inputText": json.dumps({
+ "token": output_token,
+ "repo": output_repo,
+ "directory": push_directory,
+ "fileName": "issues_cross_reference.md",
+ }),
+ "fileContents": report_md,
+ "commitMessage": f"Add issue/PR cross-reference [{source_id}]",
+ },
+ )
+ cross_reference_done = True
+ print(f" Cross-reference report pushed", flush=True)
+ except Exception as _pe:
+ print(f" WARNING: could not push cross-reference report: {_pe}", flush=True)
+ except Exception as e:
+ print(f" WARNING: cross-reference call failed ({e})", flush=True)
+
+
# ---- Write metadata.yml into the leaf dir -------------
# Mirrors the scans-style manifest: project/repo/sha/date,
# models, asvs level, threat-model URL, findings_total, and
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@tooling.apache.org
For additional commands, e-mail: commits-help@tooling.apache.org