Skip to content

Commit 9aa98d1

Browse files
fix: fuzzer repeat issue tracking (#6577)
<!-- Thank you for submitting a pull request! We appreciate your time and effort. Please make sure to provide enough information so that we can review your pull request. The Summary and Testing sections below contain guidance on what to include. --> ## Summary <!-- If this PR is related to a tracked effort, please link to the relevant issue here (e.g., `Closes: #123`). Otherwise, feel free to ignore / delete this. In this section, please: 1. Explain the rationale for this change. 2. Summarize the changes included in this PR. A general rule of thumb is that larger PRs should have larger summaries. If there are a lot of changes, please help us review the code by explaining what was changed and why. If there is an issue or discussion attached, there is no need to duplicate all the details, but clarity is always preferred over brevity. --> Closes: #000 <!-- ## API Changes Uncomment this section if there are any user-facing changes. Consider whether the change affects users in one of the following ways: 1. Breaks public APIs in some way. 2. Changes the underlying behavior of one of the engine integrations. 3. Should some documentation be updated to reflect this change? If a public API is changed in a breaking manner, make sure to add the appropriate label. You can run `./scripts/public-api.sh` locally to see if there are any public API changes (and this also runs in our CI). --> ## Testing <!-- Please describe how this change was tested. Here are some common categories for testing in Vortex: 1. Verifying existing behavior is maintained. 2. Verifying new behavior and functionality works correctly. 3. Serialization compatibility (backwards and forwards) should be maintained or explicitly broken. --> --------- Signed-off-by: Joe Isaacs <[email protected]>
1 parent f0d2e31 commit 9aa98d1

1 file changed

Lines changed: 10 additions & 19 deletions

File tree

  • .github/scripts/fuzz_report

‎.github/scripts/fuzz_report/cli.py‎

Lines changed: 10 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,8 @@
1717

1818
TEMPLATES_DIR = Path(__file__).parent / "templates"
1919

20-
# Marker used to find/update the single recurrence-tracking comment.
21-
_RECURRENCE_MARKER = "<!-- fuzzer-recurrence-tracker -->"
22-
_RECURRENCE_COUNT_RE = r"<!-- fuzzer-recurrence-tracker count:(\d+) -->"
20+
# Stable marker to find and update the recurrence-tracking comment.
21+
_RECURRENCE_KEY = "<!-- fuzzer-recurrence-tracker -->"
2322
# Variables that must be set (non-empty) before creating or commenting on an issue.
2423
REQUIRED_REPORT_VARIABLES = ["FUZZ_TARGET", "CRASH_FILE", "ARTIFACT_URL"]
2524

@@ -171,10 +170,7 @@ def _determine_action(
171170

172171
def _render_recurrence_body(count: int) -> str:
173172
"""Render the minimal recurrence-tracking comment body."""
174-
return (
175-
f"Seen **{count}** time{'s' if count != 1 else ''}\n\n"
176-
f"<!-- fuzzer-recurrence-tracker count:{count} -->"
177-
)
173+
return f"Seen **{count}** time{'s' if count != 1 else ''}\n\n{_RECURRENCE_KEY}"
178174

179175

180176
def _update_recurrence_count(repo: str, issue_number: int | str) -> int:
@@ -192,25 +188,20 @@ def _update_recurrence_count(repo: str, issue_number: int | str) -> int:
192188
"api",
193189
f"repos/{repo}/issues/{issue_number}/comments",
194190
"--paginate",
195-
"--jq",
196-
f'.[] | select(.body | contains("{_RECURRENCE_MARKER}")) | {{id: .id, body: .body}}',
197191
],
198192
capture_output=True,
199193
text=True,
200194
)
201195

202196
existing_id = None
203197
current_count = 0
204-
205-
for line in result.stdout.strip().splitlines():
206-
if not line:
207-
continue
208-
comment = json.loads(line)
209-
existing_id = comment["id"]
210-
m = re.search(_RECURRENCE_COUNT_RE, comment["body"])
211-
if m:
212-
current_count = int(m.group(1))
213-
break
198+
for comment in json.loads(result.stdout or "[]"):
199+
if _RECURRENCE_KEY in comment["body"]:
200+
existing_id = comment["id"]
201+
m = re.search(r"Seen \*\*(\d+)\*\*", comment["body"])
202+
if m:
203+
current_count = int(m.group(1))
204+
break
214205

215206
new_count = current_count + 1
216207
body = _render_recurrence_body(new_count)

0 commit comments

Comments
 (0)