Skip to content

Commit d0fe43b

Browse files
committed
add wont fix feature
Signed-off-by: Jefferson <jefferson.rios.caro@gmail.com>
1 parent 14919fc commit d0fe43b

1 file changed

Lines changed: 19 additions & 17 deletions

File tree

dep_checker/reconcile_issues.py

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -216,27 +216,29 @@ def list_open_issues(self, stream: str, limit: int = 1000) -> List[Dict[str, Any
216216
eprint(f"WARNING: open-issue list hit the limit of {limit}; results may be truncated")
217217
return issues
218218

219-
def list_closed_issues(self, stream: str, limit: int = 1000) -> List[Dict[str, Any]]:
220-
"""Closed issues for the stream, used to detect won't-fix suppressions.
219+
def list_closed_issues(self, stream: str) -> List[Dict[str, Any]]:
220+
"""Closed issues for the stream, fully paginated via ``gh api --paginate``.
221221
222-
Fails closed: if the result hits ``limit`` it is likely truncated, which
223-
would make the suppression set incomplete and allow a won't-fix vuln to be
224-
re-opened. Abort rather than proceed with partial data.
222+
Uses the REST issues endpoint with ``--paginate`` so every matching closed
223+
issue is retrieved regardless of count — necessary because the won't-fix
224+
suppression set must be complete to avoid re-opening a suppressed vuln.
225+
Pull requests are filtered out.
225226
"""
226227
out = self._run([
227-
"issue", "list",
228-
"--state", "closed",
229-
"--label", stream,
230-
"--limit", str(limit),
231-
"--json", "number,title,body,labels",
228+
"api",
229+
"--paginate",
230+
"--method", "GET",
231+
"repos/{owner}/{repo}/issues",
232+
"-f", "state=closed",
233+
"-f", f"labels={stream}",
234+
"-f", "per_page=100",
235+
"--jq", '.[] | select(.pull_request == null) | {number, title, body, labels: [.labels[] | {name: .name}]}',
232236
])
233-
issues = json.loads(out) if out.strip() else []
234-
if len(issues) >= limit:
235-
raise RuntimeError(
236-
f"closed-issue list for stream '{stream}' hit the limit of {limit}; "
237-
f"results may be truncated — refusing to reconcile with an incomplete "
238-
f"won't-fix suppression set"
239-
)
237+
issues: List[Dict[str, Any]] = []
238+
for line in out.splitlines():
239+
line = line.strip()
240+
if line:
241+
issues.append(json.loads(line))
240242
return issues
241243

242244
def create_issue(self, title: str, body: str) -> Optional[int]:

0 commit comments

Comments
 (0)