Repository navigation
Description
Description
Add a Refresh action to the Action Center's Quick Actions that sends every selected contentlet to be reindexed.
Unlike the other quick actions, Refresh does not depend on content state. Publish only applies to items that are not live, Delete only to archived ones — Refresh applies to the whole selection regardless of live / archived / locked status, so it is always listed whenever the selection contains at least one contentlet.
What it does. Clears the contentlet cache and reindexes the item — the same effect as the existing single-item endpoint PUT /api/v1/content/_refresh/{identifierOrInode}, which performs CacheLocator.getContentletCache().remove(identifier) followed by contentletAPI.refresh(contentlet). Useful when content is correct in the database but stale or missing in search results.
There is no bulk endpoint. Two things it must not be confused with:
POST /api/v1/esindex/reindexrebuilds the entire index (optionally filtered by content type). It is not a per-selection operation and must not be used here.- Legacy does have a batch path, but not over REST:
cmd=full_reindex_list→EditContentletAction._batchReindex, which loops the inodes on a background thread.
So this needs either N calls to _refresh from the client, or a new bulk endpoint. That decision should be made before building.
Permission question to settle
The legacy equivalent of this button is not shown to everyone. view_contentlets.jsp gates it:
final boolean canReindexContentlets =
APILocator.getRoleAPI().doesUserHaveRole(user, loadRoleByKey(Role.CMS_POWER_USER))
|| APILocator.getRoleAPI().doesUserHaveRole(user, loadCMSAdminRole());"Always available" in this issue means not gated by content state. Whether it is additionally gated by role is a separate decision, and reindexing is an expensive operation, so matching legacy (Power User or Admin) is the conservative default. This needs an explicit answer rather than being inherited by accident.
Acceptance Criteria
Updated to match what shipped in #37131. Original wording kept wherever it still describes the
behaviour; reworded only where the implementation went somewhere the AC did not anticipate.
- Decide whether Refresh is role-gated — decided: yes, matching legacy (CMS Power User or CMS Administrator), enforced server-side in
BulkRefreshHelper.canRefresh. Deliberately not mirrored in the client: the browser knows whether the user is an admin but cannot tell whether they are a Power User, so a client-side gate would hide Refresh from exactly the users the legacy button was written for. A visible action that answers 403 beats a capability silently withheld. - Refresh appears in Quick Actions whenever the selection contains at least one contentlet, regardless of live / archived / locked state
- The count shown equals the number of selected contentlets, with folders excluded
- Executing it reindexes every selected contentlet — every version of each, not just the working one — and reports the outcome in the same toast shape as the other quick actions
- The operation is asynchronous and the user is told so twice: a toast at trigger saying it runs in the background, and a completion toast pushed over the websocket when the job finishes. The outcome also lands in the notification bell, so it survives the user navigating away.
- Nothing in the UI or copy suggests this triggers a full index rebuild
- The grid refreshes after the run so the user sees the reindexed state
- Decide client-side loop vs new bulk endpoint — decided: new bulk endpoint,
POST /api/v1/content/_bulkrefresh. Permission enforced server-side; 11 integration tests and 5 Postman requests cover it. - Unit tests cover the always-available listing behaviour and the execute path — 24 backend unit tests, plus Content Drive store and Action Center specs on the frontend
Added during implementation, not in the original list:
- Indexing is synchronous per version (
IndexPolicy.WAIT_FOR), so a job reporting SUCCESS means the content is genuinely searchable rather than merely queued - The contentlet cache is evicted by inode, not identifier — an identifier-keyed eviction leaves a stale cached version to be written straight back to the index, which is the exact failure this action exists to repair
- The submission is capped (default 500,
CONTENT_BULK_REFRESH_MAX_ITEMS) - Firing any action clears the grid selection — not Refresh-specific, but a general change this work pulled in
Known divergence, left open deliberately:
- The completion toast counts identifiers, not selected rows. Selecting three language versions of one contentlet reports "1 item", because the job groups inodes by identifier and reindexes all versions of each together. Accurate to the work done, potentially confusing next to the count shown at trigger. Copy decision, not a behaviour bug.
Priority
Medium
Additional Context
Endpoints in play today:
| Purpose | Endpoint | Scope |
|---|---|---|
| Refresh / reindex one contentlet | PUT /api/v1/content/_refresh/{identifierOrInode} (optional ?language=) |
single |
| Full index rebuild | POST /api/v1/esindex/reindex |
whole index — not for a selection |
| Reindex progress | GET /api/v1/esindex/reindex |
whole index |
| Legacy batch reindex | cmd=full_reindex_list (Struts, not REST) |
batch, loops server-side |
This mirrors the Lock/Unlock situation closely: existing single-item REST endpoint, a legacy Struts command that loops server-side, and no bulk REST equivalent. If a _bulkrefresh endpoint is added it would be worth designing it alongside _bulklock / _bulkunlock so the three share one request/response shape rather than each inventing its own.
The legacy button carries the label "Refresh" (view_bulk_actions_inc.jsp), so the naming here is consistent with what existing users already know.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
[-]Content Drive Action Center: add a Refresh quick action that reindexes the selection[/-][+]Workflow Center: add a Refresh quick action that reindexes the selection[/+]github-actions commentedon Aug 20, 2026
PRs linked to this issue
rjvelazco commentedon Aug 21, 2026
Decision log
Recording the calls made while building #37131, since several went beyond what the AC anticipated.
The AC above has been updated to match; this is the reasoning behind it.
Role gate: yes, matching legacy
CMS Power User or CMS Administrator, enforced in
BulkRefreshHelper.canRefreshon submit. "Alwaysavailable" in the original issue means not gated by content state, and that still holds.
The gate is not mirrored in the client. The browser knows whether the user is an admin but has no
way to tell whether they are a Power User, so the only client-side gate available would hide Refresh
from exactly the users the legacy button was written for. A visible action that answers 403 is a
better failure than a capability silently withheld from people who have it.
New bulk endpoint, not N client calls
POST /api/v1/content/_bulkrefresh, answering202with ajobId. N client calls would have madethe browser the coordinator of a minutes-long operation, with no server-side record if the tab closed
and no cap on the fan-out.
Job-backed and pushed, not synchronous — and why it cannot mimic
_refreshThis was the most-revisited decision, so it is worth writing down properly.
PUT /api/v1/content/_refresh/{identifierOrInode}returns200immediately, and it is tempting toread that as "reindexed". It is not. It calls
contentletAPI.refresh, which reachesaddContentToIndexwith the default policy — and the default isDEFER(
INDEX_POLICY_SINGLE_CONTENT,IndexPolicyProvider:33).DEFERwrites a row todist_reindex_journaland returns;ReindexThreaddoes the work later. The200means enqueued.The bulk workflow fire endpoints genuinely do block —
distributeWorkAndProcesswaits onfuture.get()— but their per-item work is a DB write plus a deferred index write, so a hundred itemsstill settle in seconds.
This endpoint deliberately uses
IndexPolicy.WAIT_FORinstead, so that a job reporting SUCCESS meansthe content is actually searchable.
WAIT_FORblocks on an Elasticsearch refresh cycle (~1s bydefault) per bulk request, and the processor issues one per version, widened further when
includeDependenciesis set. A 500-item selection is therefore minutes of real waiting — past anyproxy or load-balancer timeout, holding a servlet thread the whole way, with the run dying if the tab
closes. Hence the job queue, the
202, and reporting by push.Honest trade: a synchronous mode for small selections is perfectly feasible (run inline under some
threshold,
202above it, which is roughly whatview_bulk_actions_inc.jspdoes). Not done, becauseone response shape is simpler than two and the background path has to exist for the large case anyway.
Not modelled as a workflow action or SystemAction
Bulk workflow fire resolves its target set by searching the index. That is circular for an
operation whose entire purpose is to repair the index: content missing from the index cannot be found
by an index search, so the items that most need this are exactly the ones such a path could never
reach.
Reporting: two toasts, no progress, no polling
BULK_REFRESH_COMPLETEDsystem event arrives over the websocket theadmin UI already holds open, carrying success / skipped / failed counts.
survives the user navigating away.
Things tried and removed along the way, all deliberately:
GET /_bulkrefresh/{jobId}status endpointPOST /_bulkrefresh/{jobId}/cancelCancellable, so a stuck run is still killable through the genericPOST /api/v1/jobs/{jobId}/cancel.Also changed, beyond Refresh
Firing any action now clears the grid selection. Previously the boxes only cleared via the
post-run
loadItems, so they stayed ticked whenever a run failed, timed out, or hit an early returnin
loadItems— in that last case permanently.Deliberately not done
includeItemResultsis hardcodedfalse. The per-item records are implemented and reachablethrough the generic
GET /api/v1/jobs/{jobId}/status, but nothing requests them, so in practicethey are never produced. Worth removing if no consumer appears.
versionsIndexedis produced but unused client-side. Harmless payload weight.notification-bell record is the fallback either way.
WAIT_FORbulk request per version. Batching all versions of an identifier into a singlerequest would cut the wall-clock several-fold. Left alone as an optimisation, not a fix.
3 remaining items
rjvelazco commentedon Aug 25, 2026
Note for QA
The refresh is an asynchronous job; once triggered, the UI will not be blocked. This is different from the regular bulk actions that block the UI while running.
Videos
video.mov
video.mov
zJaaal commentedon Aug 26, 2026
QA:
POST /api/v1/content/_bulkrefreshPasses. Live trunk instance (classes dated 2026-08-26, so it carries #37131), tested over HTTP with direct Elasticsearch and Postgres inspection. 41 checks, 4 findings, none blocking.
Endpoint only. @zJaaal covered the UI separately.
The three tests that mattered
The endpoint's whole claim is that
SUCCESSmeans searchable, unlike the single-item_refresh, which only enqueues. Three tests were built to break that. None did.1. Missing index entry. Deleted the document from both indices, confirmed search went to zero, submitted one inode.
Searchable the moment the job reported success, no wait on
ReindexThread.WAIT_FORdoes what it says.2. Stale cache written back to the index. Warmed the contentlet cache, then changed the row in Postgres behind dotCMS's back.
The index took database truth, not the cached copy. The inode-keyed eviction earns its comment.
3. Every version, not just the working one. Built a contentlet with working ≠ live, wiped both documents, submitted only the live inode →
versionsIndexed: 2, correct inode restored in each index.Findings
F1 · The AC says Power User or Admin. It is Admin only.
select role_key from cms_role where role_key ilike '%power%'returns 0 rows, soloadRoleByKeyanswers null and that half ofcanRefreshis always false. Admin-only is the intended gate, so the behaviour is right — only the AC wording andtest_bulkRefresh_powerUserIsAllowed, which creates the key itself, suggest otherwise. The client now gates onisAdminto match (shipped in #37216). Left to do: reword the AC line.F2 · Anonymous callers get 400 with validation detail instead of 401.
BulkRefreshFormcallscheckValid()from its@JsonCreator, so validation runs beforeinit(). Not platform-wide —/api/v1/categoriesanswers 401 here — and it contradicts the endpoint's own@ApiResponse. Leaks only the endpoint's existence and field names.F3 · A run where every item failed still reports
state: SUCCESS. The notification gets it right (ERROR level), butGET /api/v1/jobs/{id}/statusis the only programmatic read, and a caller keying onstatesees green. Worth a doc line:stateis the job, the counters are the outcome.F4 · One 400 returns
text/plain. A type mismatch ({"contentletIds":"abc"}) escapes as a raw Jackson message; every other 400 isapplication/json. The client always sends an array, so nothing ships broken.Noted, no action
Trigger vs completion count behaves exactly as the open AC item documents: two language inodes of one contentlet give
submitted: 2andtotal: 1. Coverage is a superset of the selection, so nothing is missed.Throughput is ~1 item/sec. 50 real contentlets took 58.9s — the ~1s Elasticsearch refresh cycle per
WAIT_FORrequest, per version, as predicted. Extrapolated, the 500 cap is 8–10 minutes with no progress and no cancel control. Vindicates the job queue; worth the PO knowing the real number.All 41 checks (click to expand)
Auth — anonymous with valid body 401 · wrong password 401 · anonymous with invalid body 400 (F2) · admin 202 · non-admin refused in UI
Validation — no body, literal
null, empty array,contentletIds: null, malformed JSON, unknown field all 400 · missing/wrong Content-Type 415 · GET 405 · 500 items 202 · 501 items 400Reindex — missing index doc repaired in both indices · stale cache loses to db truth · working ≠ live both indexed · two language inodes collapse to one identifier · one language submitted reindexes both · duplicate inodes collapse · bogus inode fails without rejecting the batch · bogus mixed with real leaves batch intact · folder / content type / template inodes each fail per item · archived, locked and unpublished all reindex ·
includeDependenciesandincludeItemResultshonouredLifecycle — cancel mid-run gives CANCELED with 1 succeeded / 49 skipped and
skipReason· counters always sum to total · notification level correct for success, partial, cancelled and all-failed · two concurrent submissions get distinct job ids and both finish · Postman collection registered in CI ·SystemEventTypeandLanguage.propertieskeys presentStill open
BULK_REFRESH_COMPLETEDneeds two nodes. Already flagged in the decision log; the notification-bell record is the fallback.BulkRefreshHelper's javadoc notes thatGET /api/v1/jobs/{jobId}/statusneeds only a back-end user and returns the whole job, every submitted inode included. Pre-existing, not created here, and it needs a job UUID you would already have to know. Untested.Cleanup
Test content created for this run was deleted afterwards. One demo contentlet had its Elasticsearch documents removed and restored by the endpoint under test. Nothing in the database was left modified.
QA run and comment authored by Claude (Claude Code), posted from @zJaaal's account.
zJaaal commentedon Aug 26, 2026
QA Passed
Tested with admin and with limited user
We are gating the refresh to admin only, preventing it to be fired with no permissions and with text explaining why on: #37216
Screen.Recording.2026-08-26.at.6.06.47.PM-1.mov
feat(content-drive): gate the Refresh quick action on the CMS Adminis…
docs(content-drive): add spec for bulk file upload backend (#37166)
docs(content-drive): add spec for bulk file upload backend (#37166)