Workflow tasks cleaner icon
Module Id
workflow-tasks-cleaner
Group Id
org.jahia.community
Updated
Requires Jahia
8.2.2.1
Author
Florent BOURASSE
Category
Tools and Utilities
Status
COMMUNITY info

Workflow tasks cleaner group_work

A Jahia 8.2 module that automatically cleans exited or completed workflow tasks (publication, etc.).

Dependencies & Dependants

Dependants
  • NONE

Changelog 2.0.1

Overview

This is a maintenance release focused on WCAG 2.1 AA accessibility for the admin UI and hardening of the cleanup scheduler backend. No new features, no breaking changes; the GraphQL schema and module configuration surface are unchanged.

Highlights

  • Full WCAG 2.1 AA pass on the React admin UI (Scheduler Configuration + Workflow Tasks Cleaner panels).
  • Race-condition fix on the manual/scheduled cleanup trigger.
  • Server-side validation of the cron expression before persistence.

Changes

Backend — WorkflowTasksCleanerMutationExtension.java

  • Race guard hardening (runClean): replaced the non-atomic get() + set() pattern with AtomicBoolean.compareAndSet(false, true), closing the TOCTOU window where two concurrent invocations (manual GraphQL trigger + scheduler tick) could both start a cleanup pass.
  • Cron validation (saveConfig): the submitted cronExpression is now validated via org.quartz.CronExpression.isValidExpression(...) before being persisted. Previously an admin could save a syntactically invalid schedule that would silently fail to activate at the next scheduler bind.

Frontend — Accessibility (WCAG 2.1 AA)

Affected files:

  • src/javascript/WorkflowTasksCleaner/WorkflowTasksCleaner.jsx
  • src/javascript/WorkflowTasksCleaner/SchedulerConfig.jsx
  • src/javascript/WorkflowTasksCleaner/WorkflowTasksCleaner.scss
  • src/main/resources/javascript/locales/en.json (new label.scheduler.configTitle)

Critical fixes:

  • CRIT-01 — Table header font size raised from 0.6875rem to 0.75rem to remain legible at the uppercase scale.
  • CRIT-02 — The single dynamic-role live region was split into two fixed-role, always-in-DOM regions (role="status" + role="alert") in both panels. Removed the liveRef focus call that was moving focus to a visually hidden element.
  • CRIT-03 — Tables switched from aria-label to aria-labelledby pointing to an existing on-screen heading, avoiding Moonstone child-forwarding ambiguity.

Major fixes:

  • MAJ-01 — Hardcoded #595959 for table header, tooltip and restart-hint text (replaces var(--color-gray) whose Moonstone runtime value could fall below the 5.5:1 contrast threshold).
  • MAJ-02 — Hardcoded #767676 for section and table-row borders (previous #dadada failed SC 1.4.11 non-text contrast at 1.47:1).
  • MAJ-03 / MIN-08 — SchedulerConfig document.title and <h2> now use label.scheduler.configTitle ("Scheduler Configuration") instead of a generic "Configuration".
  • MAJ-04 — Module-level .wtc_container *:focus-visible policy added (2px accent outline) for keyboard focus visibility.
  • MAJ-05 — .wtc_label label font-size converted from 14px to 0.875rem (SC 1.4.4 — text resizing).
  • MAJ-06 — Cron Input now carries required + aria-required="true" (SC 3.3.2, 4.1.2).
  • MAJ-07 — Cron Input exposes aria-invalid and a conditional aria-describedby referencing wtc-cron-error on save failure (SC 3.3.1).

Upgrade Notes

  • Drop-in replacement for 2.0.0. No JCR, OSGi config, or GraphQL contract changes.
  • Existing persisted cron expressions are not re-validated retroactively; only new/edited values pass through the new validator.
  • Operators relying on the previous behaviour where invalid cron strings could be saved should expect a GraphQL error on save in 2.0.1.

Full Changelog2_0_0...2_0_1

FAQ

GraphQL API

The module exposes a GraphQL API under the WorkflowTasksCleanerQuery and WorkflowTasksCleanerMutations extensions.

Queries

workflowTasksCleanerConfig

Returns the current scheduler configuration (cron expression).

query {
  workflowTasksCleanerConfig {
    cronExpression
    isRunning
    tasksScanned
    tasksDeleted
    tasksFixed
  }
}
workflowTasksCleanerWorkflowList

Lists workflow tasks with optional state filter.

query {
  workflowTasksCleanerWorkflowList(taskState: ESCALATED) {
    taskId
    taskName
    taskState
    processId
    processSubject
    assignee
    createdDate
    dueDate
  }
}

taskState values: PENDINGIN_PROGRESSCOMPLETEDCANCELLEDEXITEDESCALATEDSUSPENDEDOBSOLETE

Mutations

workflowTasksCleanerRunClean

Triggers an immediate cleanup of exited/completed tasks. Returns false if a clean is already running.

mutation {
  workflowTasksCleanerRunClean
}
workflowTasksCleanerSaveConfig

Saves a new cron expression for the scheduled job. A module restart is required for schedule changes to take effect.

mutation {
  workflowTasksCleanerSaveConfig(cronExpression: "0 0 3 * * ?")
}

Admin UI

The module includes a React-based admin UI accessible via the Jahia tools:

  • Karaf command line (legacy): workflow-cleaner:cleanworkflow-cleaner:listworkflow-cleaner:task
  • Admin UI (recommended): Available in the Jahia admin panel under the workflow tasks cleaner section

Karaf Commands (legacy)

workflow-cleaner:list

List all current workflow tasks with human-readable values for task states.

workflow-cleaner:task

Options:

  • -id (required): The task id
  • --fix: Try to fix the task (reassign groups/users)
  • --delete: Delete the task
workflow-cleaner:task -id 12345 --delete

How To Install

Installation

  • In Jahia, go to "Administration --> Server settings --> System components --> Modules"
  • Upload the JAR workflow-tasks-cleaner-X.X.X.jar
  • Check that the module is started

License

MIT License

Copyright (c) 2022 - present Florent BOURASSÉ

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.