Skip to content

Limit rssChangeLog feed to 20 entries by default#26422

Open
Divya07-22 wants to merge 2 commits intojenkinsci:masterfrom
Divya07-22:rss-changelog-limit-fix
Open

Limit rssChangeLog feed to 20 entries by default#26422
Divya07-22 wants to merge 2 commits intojenkinsci:masterfrom
Divya07-22:rss-changelog-limit-fix

Conversation

@Divya07-22
Copy link

@Divya07-22 Divya07-22 commented Mar 7, 2026

Limit the rssChangeLog feed to 20 entries by default. Addresses performance issue reported in JENKINS-18992.
Fixes #14784

Testing done

Screenshots (UI changes only)

Before

After

Proposed changelog entries

  • human-readable text

Proposed changelog category

/label

  • Limit RSS changelog feed to 20 entries by default to improve performance.

Proposed upgrade guidelines

N/A

Submitter checklist

  • The issue, if it exists, is well-described.
  • The changelog entries and upgrade guidelines are appropriate for the audience affected by the change (users or developers, depending on the change) and are in the imperative mood (see examples). Fill in the Proposed upgrade guidelines section only if there are breaking changes or changes that may require extra steps from users during upgrade.
  • There is automated testing or an explanation as to why this change has no tests.
  • New public classes, fields, and methods are annotated with @Restricted or have @since TODO Javadocs, as appropriate.
  • New deprecations are annotated with @Deprecated(since = "TODO") or @Deprecated(forRemoval = true, since = "TODO"), if applicable.
  • UI changes do not introduce regressions when enforcing the current default rules of Content Security Policy Plugin. In particular, new or substantially changed JavaScript is not defined inline and does not call eval to ease future introduction of Content Security Policy (CSP) directives (see documentation).
  • For dependency updates, there are links to external changelogs and, if possible, full differentials.
  • For new APIs and extension points, there is a link to at least one consumer.

Desired reviewers

@mention

Before the changes are marked as ready-for-merge:

Maintainer checklist

  • There are at least two (2) approvals for the pull request and no outstanding requests for change.
  • Conversations in the pull request are over, or it is explicit that a reviewer is not blocking the change.
  • Changelog entries in the pull request title and/or Proposed changelog entries are accurate, human-readable, and in the imperative mood.
  • Proper changelog labels are set so that the changelog can be generated automatically.
  • If the change needs additional upgrade steps from users, the upgrade-guide-needed label is set and there is a Proposed upgrade guidelines section in the pull request title (see example).
  • If it would make sense to backport the change to LTS, be a Bug or Improvement, and either the issue or pull request must be labeled as lts-candidate to be considered.

@Divya07-22
Copy link
Author

/label rfe

@comment-ops-bot comment-ops-bot bot added the rfe For changelog: Minor enhancement. use `major-rfe` for changes to be highlighted label Mar 7, 2026
@Divya07-22
Copy link
Author

The build failures are due to the yarn lockfile update check and not related to my Java changes. Please advise if further action is needed.

@MarkEWaite MarkEWaite changed the title Limit rssChangeLog feed to 20 entries by default (fixes JENKINS-18992 #14784) Limit rssChangeLog feed to 20 entries by default Mar 7, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Updates Jenkins core’s rssChangeLog endpoint to cap the number of changelog entries returned by default, addressing the performance concerns described in JENKINS-18992 / #14784.

Changes:

  • Add a default limit (intended: 20) to the RSS changelog feed generation loop.
  • Stop iterating builds/change sets once the feed item cap is reached.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +1170 to +1174
for (RunT r = getLastBuild(); r != null && totalFeedItems < MAX_ENTRIES; r = r.getPreviousBuild()) {
int idx = 0;
if (r instanceof RunWithSCM) {
for (ChangeLogSet<? extends ChangeLogSet.Entry> c : ((RunWithSCM<?, ?>) r).getChangeSets()) {
for (ChangeLogSet.Entry e : c) {
Copy link

Copilot AI Mar 7, 2026

Choose a reason for hiding this comment

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

The loop/if block structure here is broken (missing braces/indentation), which changes scoping and makes r referenced outside the for initializer scope. As written, this will not compile and also won’t iterate builds/entries as intended. Add braces so idx, the instanceof RunWithSCM check, and the nested change set loops are inside the for (RunT r = ...) body, and ensure the method braces close after the forwardToRss call (not before it).

Copilot uses AI. Check for mistakes.
RSS.forwardToRss(
}
}
S.forwardToRss(
Copy link

Copilot AI Mar 7, 2026

Choose a reason for hiding this comment

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

S.forwardToRss looks like a typo; the class used elsewhere in core is hudson.model.RSS.forwardToRss(...). As-is this will not compile unless there is an in-scope S alias/variable, and it also changes the API being called unexpectedly.

Suggested change
S.forwardToRss(
RSS.forwardToRss(

Copilot uses AI. Check for mistakes.
Comment on lines +1168 to +1170
final int MAX_ENTRIES = 20;
int totalFeedItems = 0;
for (RunT r = getLastBuild(); r != null && totalFeedItems < MAX_ENTRIES; r = r.getPreviousBuild()) {
Copy link

Copilot AI Mar 7, 2026

Choose a reason for hiding this comment

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

Hard-coding MAX_ENTRIES = 20 inside the handler makes it difficult to tune for larger/smaller instances and doesn’t satisfy the “clients can ask for full-length explicitly” requirement from the linked issue. Consider using a system property default (pattern used widely in core via jenkins.util.SystemProperties.getInteger) and allowing an optional request parameter (e.g., max) to override the default with a reasonable upper bound.

Copilot uses AI. Check for mistakes.
Comment on lines +1179 to +1183
if (totalFeedItems >= MAX_ENTRIES) break;
}
RSS.forwardToRss(
}
}
S.forwardToRss(
Copy link

Copilot AI Mar 7, 2026

Choose a reason for hiding this comment

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

There are unmatched closing braces here (} / }) which appear to terminate the for loop and even the doRssChangelog method before the feed is rendered. This will either fail compilation or change control flow so no RSS output is produced. Please re-balance braces so forwardToRss(...) remains inside doRssChangelog.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

rfe For changelog: Minor enhancement. use `major-rfe` for changes to be highlighted

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[JENKINS-18992] rssChangeLog should be limited

3 participants