Class HistorySection
- All Implemented Interfaces:
ModelObject,org.kohsuke.stapler.StaplerProxy
/batch-control/history/ (SPEC item 12): filtered listings of
run records, incidents, change records and run requests, a monthly aggregate JSON endpoint,
and CSV exports.
Blocked approval-marker re-use attempts (D-30) are an exception to the one-table-per-kind
layout: they are shown on every tab as an alert above the selected table, because they produce
no run record and so would otherwise be invisible on the default runs tab. See
getMarkerReuseItems().
URL space (fixed contract, asserted by tests):
/batch-control/history/— filter form + one selectable table (?kind=runs|incidents|changes|requests, filtersfrom, to, job, user, result, status, paging?page=N)GET /batch-control/history/summary?month=YYYY-MM— monthly aggregate JSON with exactly the keysruns, success, failure, unstable, incidentsOpen, incidentsResolved, requestsApproved, requestsRejectedGET /batch-control/history/runs.csv|incidents.csv|changes.csv|requests.csv— CSV exports honoring the same filter parameters (D-18 formula-injection sanitization viaCsvWriter)
Everything under this section requires ViewHistory; getTarget() rejects
the whole subtree with 403 otherwise (T-12-01, T-12-05). All URLs are read-only: PUT/DELETE/PATCH
get 405 everywhere, and the JSON and CSV exports refuse every verb except GET/HEAD. Query parsing and validation live in FilterParser.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intMost CSV exports that may run at the same time, instance-wide (S-05).static final intPage size for every table.static final intHow many blocked marker re-use attempts the always-visible alert lists at most. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoiddoDynamic(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp) Serves the four CSV export URLs (runs.csv,incidents.csv,changes.csv,requests.csv); anything else under this section is a 404.voiddoSummary(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp, String month) GETsummary?month=YYYY-MM— the monthly aggregate as JSON (T-12-04).duration(long durationMs) Human-readable duration.Human-readable timestamp.The filter as a query fragment (no kind, no page) for CSV links.The complete CSV export of what this screen lists (S-03), relative to this section.The validated filter for the current request (parsed once).getKind()The selected table, from?kind=;runson absence or garbage.getLinks()Link predicates: a link to another screen is rendered only if the user may open it.The re-use rows the alert actually lists: the newestREUSE_ALERT_LIMIT.intHow many blocked re-use attempts match the filter (a lower bound when truncated).The blocked approval-marker re-use records matching the filter, newest first, at mostREUSE_ALERT_LIMITof them (D-30).intHow many matching re-use records the alert does not list; 0 when it lists them all.The month of themonthlysummary screen (e2e-03 DEF-22, T-12-12), from?month=YYYY-MM; anything else (absent, malformed) falls back togetSummaryMonth(), so the query string never reaches the page unparsed.The rows of themonthlysummary screen forgetMonthlyMonth().intOver-long lines (over 1 MiB) skipped while reading this table (security-11 N-02); the CSV export skips the same lines, so the screen says so rather than look complete.intgetPage()Current 1-based page, from thepagequery parameter (Paging).List<?> The rows of the selected kind shown on the current page, newest first.The on-page monthly aggregate rows forgetSummaryMonth().The month shown in the on-page summary block and the JSON link: month of the filter end.intgetTotal()Matching records read (a lower bound whenisTruncated()).Permissions for this screen'sl:layout(the same set its section gate checks).incidentCreatedAt(Incident incident) Creation timestamp of an incident.incidentRunUrl(Incident incident) Root-relative build URL for an incident's originating run, or null for plain text (D-44).booleanbooleanbooleanWhether the per-request record cap stopped the read: ask to narrow the filter.An approver set for display (a1, a2).parameters(Map<String, String> parameters) One-line parameter rendering; values come from the record already masked.Full query fragment for a tab link of the given kind (filter preserved, page reset).Root-relative build URL for a run record, or null for plain text (D-44).summaryLabel(String key) The label of a monthly summary row; an unknown key is shown as it is.
-
Field Details
-
PAGE_SIZE
public static final int PAGE_SIZEPage size for every table.- See Also:
-
REUSE_ALERT_LIMIT
public static final int REUSE_ALERT_LIMITHow many blocked marker re-use attempts the always-visible alert lists at most.- See Also:
-
MAX_CONCURRENT_EXPORTS
public static final int MAX_CONCURRENT_EXPORTSMost CSV exports that may run at the same time, instance-wide (S-05).- See Also:
-
-
Constructor Details
-
HistorySection
public HistorySection()
-
-
Method Details
-
getTarget
- Specified by:
getTargetin interfaceorg.kohsuke.stapler.StaplerProxy
-
getDisplayName
- Specified by:
getDisplayNamein interfaceModelObject
-
getViewPermissions
Permissions for this screen'sl:layout(the same set its section gate checks). -
getLinks
Link predicates: a link to another screen is rendered only if the user may open it. -
doSummary
public void doSummary(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp, @QueryParameter String month) throws IOException GETsummary?month=YYYY-MM— the monthly aggregate as JSON (T-12-04). Absent month defaults to the current month; a malformed month is a 400.- Throws:
IOException
-
doDynamic
public void doDynamic(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp) throws IOException, jakarta.servlet.ServletException Serves the four CSV export URLs (runs.csv,incidents.csv,changes.csv,requests.csv); anything else under this section is a 404. Stapler cannot route dotted tokens todo*methods, hence the dynamic dispatch.- Throws:
IOExceptionjakarta.servlet.ServletException
-
getFilter
The validated filter for the current request (parsed once). -
getKind
The selected table, from?kind=;runson absence or garbage. -
getBaseQuery
The filter as a query fragment (no kind, no page) for CSV links. -
query
Full query fragment for a tab link of the given kind (filter preserved, page reset). -
getCsvUrl
The complete CSV export of what this screen lists (S-03), relative to this section. Pointed to by the truncation notice: the export is not bound by the per-screen record cap. Only ISO dates and constant names go into it, so no encoding is needed. -
getMarkerReuseItems
The blocked approval-marker re-use records matching the filter, newest first, at mostREUSE_ALERT_LIMITof them (D-30).A blocked re-use produces no
RunRecord, so on the defaultrunstab the attempt would otherwise be invisible; the index view renders these rows as an alert above the selected table on every tab. The period, job and user filters are the Changes tab's, so the alert describes the same window as that tab (which is what makes?user=u2a query for "what did this account attempt"). The read is bounded like every page. -
getMarkerReuseCount
public int getMarkerReuseCount()How many blocked re-use attempts match the filter (a lower bound when truncated). -
getMarkerReuseAlertItems
The re-use rows the alert actually lists: the newestREUSE_ALERT_LIMIT. The alert must stay a signal rather than become a second unbounded table when an automation retries in a loop;getMarkerReuseOverflow()says how many rows were left out and the Changes tab (andchanges.csv) has all of them. -
getMarkerReuseOverflow
public int getMarkerReuseOverflow()How many matching re-use records the alert does not list; 0 when it lists them all. -
getPage
public int getPage()Current 1-based page, from thepagequery parameter (Paging). -
getPageItems
The rows of the selected kind shown on the current page, newest first. -
getTotal
public int getTotal()Matching records read (a lower bound whenisTruncated()). -
isTruncated
public boolean isTruncated()Whether the per-request record cap stopped the read: ask to narrow the filter. -
getOversized
public int getOversized()Over-long lines (over 1 MiB) skipped while reading this table (security-11 N-02); the CSV export skips the same lines, so the screen says so rather than look complete. -
isHasPrevious
public boolean isHasPrevious() -
isHasNext
public boolean isHasNext() -
getSummaryMonth
The month shown in the on-page summary block and the JSON link: month of the filter end. -
getSummary
The on-page monthly aggregate rows forgetSummaryMonth(). -
getMonthlyMonth
The month of themonthlysummary screen (e2e-03 DEF-22, T-12-12), from?month=YYYY-MM; anything else (absent, malformed) falls back togetSummaryMonth(), so the query string never reaches the page unparsed. -
getMonthlySummary
The rows of themonthlysummary screen forgetMonthlyMonth(). -
summaryLabel
The label of a monthly summary row; an unknown key is shown as it is. -
join
An approver set for display (a1, a2). -
format
Human-readable timestamp. -
duration
Human-readable duration. -
runUrl
Root-relative build URL for a run record, or null for plain text (D-44). -
incidentRunUrl
Root-relative build URL for an incident's originating run, or null for plain text (D-44). -
incidentCreatedAt
Creation timestamp of an incident. -
parameters
One-line parameter rendering; values come from the record already masked.
-