Skip to content

ci: resolve queue PR branches in lane-proof miss diagnostics - #3982

Merged
zackees merged 2 commits into
masterfrom
fix/queue-proof-diagnostic
Nov 8, 2026
Merged

zackees merged 2 commits into
masterfrom
fix/queue-proof-diagnostic

Conversation

@zackees

@zackees zackees commented Nov 8, 2026

Copy link
Copy Markdown
Member

What and why

Root cause: the diagnostic spent its two calls on repository-wide run/artifact pages instead of resolving the queue PR's head branch, so PR #3843 was absent from the run candidates (the runs API returned {"count":100,"prs":[],"total_count":551}) and the incomplete artifact history forced nearest=none ... verdict=unknown.

Evidence collected before editing:

Resolve /pulls/{N} first, then inspect the newest artifact page for that PR's real head branch and same-repository IDs, selecting the newest unexpired lane proof within the age window. Two API calls and the existing 30-second timeouts remain. A positive observation populates nearest even when unrelated history is truncated; absence yields no-pr-proof only for a complete artifact listing. Missing credentials, errors, fork PRs and incomplete negative history remain unknown. Matching-key cases retain the existing unknown verdict with populated nearest.

This is descriptive artifact evidence, not workflow authentication: only the unchanged lookup() can authorize reuse. pr_base is now the PR endpoint's reported base, not a historical run base. No workflows changed; no native-coverage labels apply to this Python-only change.

RED → GREEN

  • RED commit: dc5e51b; uv run --no-project python ci/test_lane_proof.py MissDiagnostic.test_queue_ref_finds_pr_branch_proof_in_partial_history failed (1 test): expected populated nearest/stale-base, got nearest=none/unknown.
  • GREEN commit: 693a3df; uv run --no-project python ci/test_lane_proof.py — 39 tests, OK.
  • New regressions: test_queue_ref_finds_pr_branch_proof_in_partial_history and test_newest_pr_branch_proof_ignores_other_branches_and_forks. Existing test_stale_base, test_no_pr_proof, test_api_error_unknown, test_diagnostic_never_changes_hit pass, as do matching-key and incomplete-history cases.
  • uvx ruff format ci/lane_proof.py ci/test_lane_proof.py — 2 files left unchanged on final run; uvx ruff check ci/lane_proof.py ci/test_lane_proof.py — All checks passed. git diff --check passed.
  • Direct live call of the patched diagnostic for queue PR obs-output: port public mixer getters (#3963) #3966, using an intentionally different key, returned nearest=66814db9d2d2 run=42449710500 pr_base=153bfa56deb727782cfe0c9a323bf8f3a538127f queue_base=8b36d61ba04dc900252f5eea704c2326f19e7ef1 verdict=stale-base.
  • Rust/C tiers and app execution are not applicable to this Python CI diagnostic. Full local gate not run; hosted PR validation remains pending. No claim that PR obs-graphics: Port the effect parser compile step #3843's older proof is in the current bounded artifact page.

Decision-preservation evidence

AST comparison against origin/master reports Changed functions: ['miss_diagnostic']. The complete production diff hunks below show no edits to hit/key/reason computation, lookup, main, output, summarize_miss, or API timeouts:

diff --git a/ci/lane_proof.py b/ci/lane_proof.py
index 6cd3b08dc..ecaf6e8d1 100755
--- a/ci/lane_proof.py
+++ b/ci/lane_proof.py
@@ -53 +53 @@ import urllib.request
-from datetime import datetime, timezone
+from datetime import datetime
@@ -223,14 +223,8 @@ def miss_diagnostic(
-        since = datetime.fromtimestamp(
-            now - MAX_AGE_HOURS * 3600, timezone.utc
-        ).strftime("%Y-%m-%dT%H:%M:%SZ")
-        runs = fetch(
-            f"/repos/{repo}/actions/workflows/ci.yml/runs?event=pull_request&per_page=100&created=%3E%3D{since}",
-            token,
-        )
-        candidates = {
-            run["id"]: (run, pr["base"]["sha"])
-            for run in runs["workflow_runs"]
-            if trusted(run, repo, now) is None
-            for pr in run["pull_requests"]
-            if pr["number"] == number and pr["head"]["ref"] == run["head_branch"]
-        }
+        pr = fetch(f"/repos/{repo}/pulls/{number}", token)
+        branch = pr["head"]["ref"]
+        repository_id = pr["base"]["repo"]["id"]
+        if pr["head"]["repo"]["id"] != repository_id:
+            raise ValueError("fork PR cannot publish a repository proof")
+        # The artifacts API ignores head_branch; filter its run metadata locally.
+        # This is diagnostic evidence only: lookup() still authenticates the
+        # workflow/event/age before a proof can ever change hit.
@@ -246 +240,8 @@ def miss_diagnostic(
-                and art["workflow_run"]["id"] in candidates
+                and art["workflow_run"]["head_branch"] == branch
+                and art["workflow_run"]["repository_id"] == repository_id
+                and art["workflow_run"]["head_repository_id"] == repository_id
+                and now
+                - datetime.fromisoformat(
+                    art["created_at"].replace("Z", "+00:00")
+                ).timestamp()
+                <= MAX_AGE_HOURS * 3600
@@ -254 +255 @@ def miss_diagnostic(
-            pr_base = candidates[int(run_id)][1]
+            pr_base = pr["base"]["sha"]
@@ -257,6 +258 @@ def miss_diagnostic(
-            # The newest artifact must be in the returned run window as well.
-            if runs["total_count"] > len(runs["workflow_runs"]):
-                verdict = "unknown"
-        elif runs["total_count"] <= len(runs["workflow_runs"]) and listing[
-            "total_count"
-        ] <= len(listing["artifacts"]):
+        elif listing["total_count"] <= len(listing["artifacts"]):

Chaperone verification after merge

Select the CI Mode job ID of a new merge_group run executing the merged code, then run exactly:

gh api repos/obs-rust/obs-studio/actions/jobs/<id>/logs --allow-escape-sequences | grep -aE "nearest=|verdict="

Confirm a populated nearest for a queue PR with a proof on the returned artifact page, and stale-base for differing inputs. This post-merge CI Mode observation remains unverified; the historical job cannot rerun with changed code. Keep this PR unmerged for the requested handoff.

Checklist

  • Base is master; only ci/lane_proof.py and ci/test_lane_proof.py changed.
  • Checked open PRs for overlap; focused user-assigned bug fix, no issue supplied.
  • Separate local RED and GREEN commits.
  • No user-visible app change; features ledger does not apply.
  • Optional full local gate/stamp (hosted CI will validate).

@zackees
zackees marked this pull request as ready for review November 8, 2026 05:43
@zackees
zackees added this pull request to the merge queue Nov 8, 2026
Merged via the queue into master with commit 22d9284 Nov 8, 2026
39 checks passed
@zackees
zackees deleted the fix/queue-proof-diagnostic branch November 8, 2026 05:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant