Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion spec/audit.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,23 @@ def audit_repo(entry, spec):
if branch_main["commit"]["commit"]["tree"]["sha"] != branch_dev["commit"]["commit"]["tree"]["sha"]:
cmp = gh(f"repos/{slug}/compare/develop...main", ok404=True)
if cmp and cmp.get("files"):
findings.append(("DRIFT", f"branch: main carries {len(cmp['files'])}+ changed file(s) develop lacks (forward-sync needed)"))
# The three-dot compare lists files changed on main since the merge-base and is blind
# to cherry-picked promotions: develop may already hold identical content under
# different commit SHAs (patch-equivalent commits, e.g. promote/* branches). Post-
# filter by blob equality at the two heads - content develop already has is not
# "content develop lacks" (#336). One recursive trees call per head; if either tree
# is truncated the filter is skipped and the unfiltered finding kept (conservative).
dev_tree = gh(f"repos/{slug}/git/trees/{branch_dev['commit']['commit']['tree']['sha']}?recursive=1")
main_tree = gh(f"repos/{slug}/git/trees/{branch_main['commit']['commit']['tree']['sha']}?recursive=1")
if dev_tree.get("truncated") or main_tree.get("truncated"):
findings.append(("DRIFT", f"branch: main carries {len(cmp['files'])}+ changed file(s) develop lacks (forward-sync needed; tree too large to blob-filter cherry-pick noise)"))
else:
dev_blobs = {e["path"]: e["sha"] for e in dev_tree["tree"] if e["type"] == "blob"}
main_blobs = {e["path"]: e["sha"] for e in main_tree["tree"] if e["type"] == "blob"}
lacking = sorted(f["filename"] for f in cmp["files"] if main_blobs.get(f["filename"]) != dev_blobs.get(f["filename"]))
if lacking:
shown = ", ".join(lacking[:8]) + (" ..." if len(lacking) > 8 else "")
findings.append(("DRIFT", f"branch: main carries {len(lacking)} file(s) develop lacks (forward-sync needed): {shown}"))
Comment thread
ptr727 marked this conversation as resolved.
Outdated
Comment thread
ptr727 marked this conversation as resolved.
Outdated

# --- General settings ---
expected = dict(spec["settings"])
Expand Down