Skip to content

FOUR-34642 PMQL Is Invalid when loading Tasks page with Process column enabled - #9208

Open
devmiguelangel wants to merge 6 commits into
developfrom
FOUR-34642
Open

devmiguelangel wants to merge 6 commits into
developfrom
FOUR-34642

Conversation

@devmiguelangel

@devmiguelangel devmiguelangel commented Nov 30, 2026 •

Copy link
Copy Markdown
Contributor

Issue & Reproduction Steps

/tasks shows "PMQL Is Invalid." and the Inbox never loads when the task columns include the default Process column (process_request.name).

  1. Keep OPTIMIZED_TASKS_ENABLED on (default).
  2. Make sure the task columns include Process (process_request.name).
  3. Open /tasks.
  4. GET /api/1.0/tasks?...&columns=case_number,...,process_request.name returns 422.

Cause: mapColumnsToFields() in TaskControllerIndexMethods passed any unrecognised column straight into the SELECT on process_request_tokens. The query failed with Unknown column 'process_request.name' in 'field list'. handleQueryException() reports every QueryException as a PMQL error. The same failure hit process_request.id, process.*, user.* and unknown columns. It is a regression from the optimized task index, first shipped in v2026.17.1.

Solution

  • TaskControllerIndexMethods: add sanitizeIndexFields(). Relation columns (process_request.*, processRequest.*, process.*, user.*) map to their foreign key (process_request_id, process_id, user_id), so the eager-loaded relations still render. Any other column that is not a real process_request_tokens column is dropped.
  • Apply the same sanitizing to the raw fields param, on both the optimized and the legacy Api\TaskController::index().
  • ProcessMakerModel::getTableColumns() is now public so the cached schema column list can be used as the whitelist.
  • Both handleQueryException() copies now also match 'field list' and 'order clause' errors, so the message names the offending column. The "PMQL Is Invalid." prefix is unchanged.
  • Add regression tests in tests/Feature/Api/TasksTest.php.
CleanShot.2026-11-30.at.10.46.10.AM.mp4

How to Test

  • ./vendor/bin/phpunit tests/Feature/Api/TasksTest.php (73 tests pass). TaskControllerTest and TaskListNonAdminCaseTitleOrderTest also pass.
  • Manually: open /tasks as an Admin and an Operator. The Inbox loads with the Process column filled in and no toast.
  • API: the request from the ticket (columns=...,process_request.name) now returns 200.

Related Tickets & Packages

FOUR-34642

Code Review Checklist

  • I have pulled this code locally and tested it on my instance, along with any associated packages.
  • This code adheres to ProcessMaker Coding Guidelines.
  • This code includes a unit test or an E2E test that tests its functionality, or is covered by an existing test.
  • This solution fixes the bug reported in the original ticket.
  • This solution does not alter the expected output of a component in a way that would break existing Processes.
  • This solution does not implement any breaking changes that would invalidate documentation or cause existing Processes to fail.
  • This solution has been tested with enterprise packages that rely on its functionality and does not introduce bugs in those packages.
  • This code does not duplicate functionality that already exists in the framework or in ProcessMaker.
  • This ticket conforms to the PRD associated with this part of ProcessMaker.

ci:deploy

@cursor

cursor Bot commented Nov 30, 2026 •

Copy link
Copy Markdown

PR Summary

Medium Risk
Changes core task list SQL projection for all index requests using columns/fields; wrong sanitization could omit columns or break relation payloads, but behavior is covered by new API tests and fixes a production regression.

Overview
Fixes the Tasks inbox 422 / “PMQL Is Invalid” error when column selection includes UI fields like process_request.name that are not real process_request_tokens columns.

Task index columns / fields are now sanitized before SELECT: dotted relation fields map to the matching foreign keys (process_request_id, process_id, user_id), unknown names are dropped, and include keeps the needed FKs for eager-loaded relations so values such as process request name still render from relations.

The legacy Api\TaskController::index path applies the same filtering on fields; ProcessMakerModel::getTableColumns() is public so token columns can be whitelisted; handleQueryException also recognizes “field list” / “order clause” SQL errors; includeProcessRequest is null-safe; regression tests cover optimized and legacy index behavior.

Reviewed by Cursor Bugbot for commit a97f110. Bugbot is set up for automated code reviews on this repo. Configure here.

@devmiguelangel devmiguelangel changed the title FOUR-34642: Fix "PMQL Is Invalid." on /tasks when the Process column is enabled FOUR-34642 PMQL Is Invalid when loading Tasks page with Process column enabled Nov 30, 2026
@devmiguelangel devmiguelangel self-assigned this Nov 30, 2026
cursor[bot]

This comment was marked as duplicate.

@cursor
cursor Bot requested review from gproly and pmPaulis November 30, 2026 15:02
@devmiguelangel
devmiguelangel removed the request for review from gproly November 30, 2026 15:02
@nolanpro

Copy link
Copy Markdown
Contributor

QA server K8S was successfully deployed https://tenant-1.ci-f02a3f5349.engk8s.processmaker.net

@decisions-sonarqube

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants