github-community-projects / github-community-projects/safe-settings
Branches plugin duplicates every dry-run entry once per configured branch
- Dominant language
- JavaScript
- Stars
- 921
- Forks
- 226
- Avg merge
- 18h 3m
- Merged PRs (30d)
- 14
Description
In nop mode, the branches plugin reports each planned change N times, where N is the number of configured branches with a `protection` key.
`sync()` in `lib/plugins/branches.js` declares a single `resArray` outside the per-branch `.map()`, pushes each branch's NopCommands into it, and each callback returns that same array. `Promise.all` then yields N references to one array, and the final `res.flat(2)` inlines its full contents N times. A config with `branches: [master, develop]`, both with protection changes, produces 8 NopCommands instead of 4 (each one twice).
Downstream, `handleResults` mostly masks this in check-run output because its duplicate filter compares only `type`/`repo`/`plugin` — but that same filter also throws away legitimately different rows with matching keys, so the dry-run report for a repo with two protected branches shows only the first branch's diff. One bug hiding another.
Contributor guide
Research direction
Start in lib/plugins/branches.js at sync(), then trace how its results reach handleResults and the duplicate filter. Reproduce the nop-mode case with two configured branches that have protection changes. Done means each planned change is reported once and distinct protected-branch diffs are retained in the dry-run output.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- devops
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 74/100