Skip to content

Conversation

@jglick
Copy link
Member

@jglick jglick commented Jul 18, 2025

#2558 introduced AdministrativeMonitorsDecorator which #5063 elaborated with AdministrativeMonitorsApi. However #10245 completely redesigned how this information is shown in all cases except for the actual /manage/ page, which continues to display the HTML blurbs of all active admin monitors. Now other pages (as viewed by an admin) merely need to show a badge if there are any admin monitors active. It did include a count, but counting them forces the isActivated method of all applicable monitors to be run on every page load, when really what we mainly care about is whether or not a badge needs to be shown (and whether it should be marked a security issue or not). So we can now actually just check whether there is at least one security monitor active; if not, whether there is at least one non-security monitor active. While isActivated was documented to need to run “fast”, this was a burden, and we may as well try to avoid checking any more monitors than we really have to, if there is already at least one monitor active.

This also cleans up a bunch of dead code left behind by #10245.

Testing done

New test coverage for laziness (failed as expected prior to change). Also various interactive tests causing three categories of monitor to be activated or not:

  • security
  • non-security
  • reverse proxy & URI encoding, which should be ignored for purposes of the badge (they either display a chunk in /manage/ or they do not)

Proposed changelog entries

  • Minor performance optimization for display of the badge for administrative monitors.

Proposed changelog category

/label rfe

Proposed upgrade guidelines

N/A

Submitter checklist

  • The Jira 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.
  • 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

@daniel-beck @janfaracik

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, a Jira issue must exist, be a Bug or Improvement, and be labeled as lts-candidate to be considered (see query).

@comment-ops-bot comment-ops-bot bot added the rfe For changelog: Minor enhancement. use `major-rfe` for changes to be highlighted label Jul 18, 2025
@jglick jglick requested review from daniel-beck and janfaracik July 18, 2025 19:26
Copy link

@A1exKH A1exKH left a comment

Choose a reason for hiding this comment

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

LGTM.

@jglick jglick requested a review from a team August 1, 2025 18:41
Copy link
Member

@timja timja left a comment

Choose a reason for hiding this comment

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

Tested locally, looks reasonable, no need for this to be precise

public abstract boolean isActivated();

@Restricted(NoExternalUse.class)
public boolean isActivationFake() {
Copy link
Member

Choose a reason for hiding this comment

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

should there be some javadoc to explain when to use this / why its here?

Copy link
Member Author

Choose a reason for hiding this comment

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

Well, it is for now only exposed internally, so I figure anyone curious can easily follow the overrides & reference. The prior code was not particularly illuminating either. I guess the more interesting comments would be on the implementations.

@timja timja requested a review from a team August 4, 2025 13:21
@timja
Copy link
Member

timja commented Aug 14, 2025

/label ready-for-merge


This PR is now ready for merge, after ~24 hours, we will merge it if there's no negative feedback.

Thanks!

@comment-ops-bot comment-ops-bot bot added the ready-for-merge The PR is ready to go, and it will be merged soon if there is no negative feedback label Aug 14, 2025
@timja timja merged commit 00c6707 into jenkinsci:master Aug 15, 2025
18 checks passed
@jglick jglick deleted the AdministrativeMonitorsDecorator branch August 15, 2025 21:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-for-merge The PR is ready to go, and it will be merged soon if there is no negative feedback 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.

4 participants