Skip to content

Improve CVE metrics report format#464

Merged
lbarcziova merged 3 commits into
packit:mainfrom
lbarcziova:improve-metrics-report-format
May 12, 2026
Merged

Improve CVE metrics report format#464
lbarcziova merged 3 commits into
packit:mainfrom
lbarcziova:improve-metrics-report-format

Conversation

@lbarcziova
Copy link
Copy Markdown
Member

Example output:

Ymir CVE Activity Report: 2026-05-04 → 2026-05-11

Solved Jiras

  • Resolved by MRs: 4 Jiras (2 MRs)
  • Not-affected (closed): 2
  • Total solved: 6

In Progress Jiras


Follow-up:

  • storing these here or in internal Gitlab in a dedicated repo (potentially automate)

Assisted-by: Claude Opus 4.6
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request enhances the ymir_cve_metrics.py script by replacing the text-based summary with a Markdown report that includes clickable links to GitLab merge requests and Jira issues. It also refines the GitLab MR pagination logic to handle date drift for merged items by relying on in-code filtering for the upper bound. Feedback focuses on improving the accuracy and robustness of the generated URLs, specifically by supporting multiple authors in GitLab search links, ensuring date filters are applied to open MR links to match the reported counts, and addressing potential URL length limitations when linking large sets of Jira keys.

Comment on lines +287 to +289
# GitLab web UI only supports a single author_username filter.
base = "https://gitlab.com/groups/redhat/-/merge_requests"
params = f"?state={state}&author_username={authors[0]}&first_page_size=20"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The comment states that the GitLab web UI only supports a single author filter, but it actually supports multiple authors using the author_username[] array syntax (e.g., ?author_username[]=user1&author_username[]=user2). Since the script allows multiple authors via the --gitlab-author CLI argument, the generated links should include all of them to accurately reflect the data in the report.

    # GitLab web UI supports multiple author_username filters using array syntax.
    base = "https://gitlab.com/groups/redhat/-/merge_requests"
    author_params = "&".join(f"author_username[]={quote(a)}" for a in authors)
    params = f"?state={state}&{author_params}&first_page_size=20"

Comment thread scripts/ymir_cve_metrics.py Outdated
Comment on lines +296 to +297
elif state == "opened":
params += "&sort=updated_desc"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The "Open MRs" link in the report does not include date filters, whereas the count reported (non_merged_mrs) is filtered by the created_at date range in main(). This leads to a discrepancy where the link shows all open MRs by the author, but the text indicates a specific count for the period. Adding created_after and created_before parameters to the URL would ensure consistency.

Suggested change
elif state == "opened":
params += "&sort=updated_desc"
elif state == "opened":
params += "&sort=updated_desc"
if date_from and date_to:
params += (
f"&created_after={date_from.strftime('%Y-%m-%d')}"
f"&created_before={date_to.strftime('%Y-%m-%d')}"
)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these parameters dont work with web UI

Comment on lines +304 to +306
keys_csv = ",".join(sorted(jira_keys))
jql = quote(f"issuekey in ({keys_csv})", safe="")
return f"{jira_url.rstrip('/')}/issues/?jql={jql}"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Generating a Jira search URL by joining a large number of issue keys in a JQL in (...) clause can result in extremely long URLs. Most browsers and servers have limits on URL length (typically around 2,000 to 8,000 characters). If the report covers a very active period with hundreds of Jiras, these links might be truncated or rejected by the server. Consider adding a check or a warning if the number of keys is exceptionally high.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gemini, chill out

TomasTomecek
TomasTomecek previously approved these changes May 11, 2026
Copy link
Copy Markdown
Member

@TomasTomecek TomasTomecek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thank you, very nice improvement!

Comment on lines +304 to +306
keys_csv = ",".join(sorted(jira_keys))
jql = quote(f"issuekey in ({keys_csv})", safe="")
return f"{jira_url.rstrip('/')}/issues/?jql={jql}"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gemini, chill out

- Report numbers now link to Jira JQL searches (resolved, closed,
  pending) and GitLab MR searches (merged with date range, open)
- Extract Jira keys from open MRs to link pending issues
- Fix merged MR undercounting by dropping updated_at upper bound
  constraint that excluded MRs with post-merge activity

Assisted-by: Claude Opus 4.6
Categorise MRs by ymir_backport, ymir_rebuild, ymir_rebase labels
and show inline summary, e.g. "3 MRs — 2 backport, 1 rebuild".

Assisted-by: Claude Opus 4.6
Comment on lines +84 to +86
# GitLab API filter params are created_after/updated_after (no _at),
# but order_by uses created_at/updated_at.
filter_prefix = date_field.removesuffix("_at")
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lol gitlab, why not make things easy right

@lbarcziova lbarcziova merged commit 3e5b749 into packit:main May 12, 2026
9 checks passed
@lbarcziova lbarcziova deleted the improve-metrics-report-format branch May 12, 2026 12:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants