feat(composer-update): refresh open vuln PR in place (unblock remediation, stop daily comments)#37
Merged
Merged
Conversation
…ust commenting
Before: dedup was label-only — if any vuln-update PR was open, the action
skipped both the update and PR-create steps and (when findings differed)
posted a comment. Consequences:
- a single un-merged PR froze ALL future auto-remediation: new vulns
were never composed into any branch, only mentioned in a comment;
- the diff comparison was against the PR *body* marker, which never
updated, so a drifted finding set re-posted the same comment every
day until the PR was dealt with.
Now: one rolling PR per label with create / skip / update modes.
- create: no open PR -> open one (unchanged).
- skip: open PR already records this exact set -> do nothing.
- update: set changed -> refresh the existing PR in place: force-push
base+current-fix to its head branch, rewrite the body (so the marker
tracks the latest findings), and drop one timeline comment.
Rewriting the body marker is what makes a subsequently-unchanged set hit
'skip' next run — killing the daily-duplicate-comment loop. Unfixable new
findings (no lock change) still refresh the body/comment so they surface,
without a force-push.
Decision logic (extract_pr_set, decide_pr_action) extracted to lib.sh and
unit-tested (tests/lib-functions.test.sh) — previously the dedup path had
no coverage.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Addresses two operational problems with the vuln auto-update flow, plus test coverage.
Problem
Dedup was label-only: if any
vuln-updatePR was open, the action setskip=trueand skipped both the update and PR-create steps, only posting a comment when findings differed. That meant:A→A,B), every nightly run saw "differs" and re-posted the same comment — every day until resolved.Change
One rolling PR per label with three modes (decided in
lib.sh, unit-tested):createskipupdateupdateforce-pushesbase + current fixto the existing PR's head branch, rewrites the body (so the set marker tracks the latest findings), and drops one timeline comment. Rewriting the marker is what makes a subsequently-unchanged set hitskipnext run — which kills the daily-comment loop (#3). Unfixable new findings (no lock change) still refresh body/comment so they surface, without a force-push.Net: the open PR always reflects the current full fix set; remediation no longer stalls behind an un-merged PR.
Tests (#6)
Extracted the decision logic to
lib.sh—extract_pr_set()anddecide_pr_action()— and added unit tests inlib-functions.test.sh(create / skip / update / set-grew / set-shrank / no-marker / marker extraction). The dedup path previously had zero coverage. Full suite: 5 files, 0 failures.Notes
gh/gitcalls (force-push,pr edit,pr comment) stay integration-level as before; the extracted decision logic is the unit-tested core.Takes effect downstream once
v2is moved to the merge commit.🤖 Generated with Claude Code