Skip to content

FOUR-34463: Preserve actionable script errors and executor diagnostics - #9179

Open
eiresendez wants to merge 4 commits into
developfrom
task/FOUR-34463
Open

eiresendez wants to merge 4 commits into
developfrom
task/FOUR-34463

Conversation

@eiresendez

@eiresendez eiresendez commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Issue & Reproduction Steps

Script microservice 1.2.1 can return a generic exit-status message in error_message alongside an actionable cause in error.error. ProcessMaker prioritizes the generic message and loses executor diagnostics when constructing the exception. An empty Smart Extract Variable Name reproduces this behavior.

Solution

  • Treat known generic execution failures as fallbacks while preserving actionable top-level message precedence.
  • Log bounded, sanitized executor diagnostics and correlation identifiers. Omit text traces and retain only structured frame fields, excluding arguments and objects. Redact complete JSON credential values, including escaped quotes and backslashes. Avoid PCRE JIT stack exhaustion for long credentials and omit diagnostic text if JSON credential redaction fails.
  • Document the observed 1.0.0 and 1.2.1 response contracts and add versioned regression fixtures.

How to Test

  • ScriptMicroserviceErrorContractTest: 49 tests passed, 124 assertions. Coverage includes both response formats, exit codes 1 and 255, fallback behavior, timeouts, text-trace omission, structured-frame filtering, escaped JSON credential redaction, long credentials with PCRE JIT enabled and disabled, redaction failure handling, all credential families in JSON and plain text, and diagnostic scalar/depth compatibility.
  • Smart Extract smoke with microservice 1.2.1 and the standard PHP executor passed: variableName is required was persisted and displayed, while executor diagnostics and correlation identifiers remained in application logs.
  • Additional Smart Extract smoke passed: the specific cause remained available, text traces were omitted, and file, line, code, and correlation identifiers were preserved.
  • Verify that a generic execution message remains available when no actionable cause is returned.

Related Tickets & Packages

ci:deploy

Cover script microservice 1.0.0 and 1.2.1 error contracts, retaining sanitized diagnostics and correlation identifiers.

Refs: FOUR-34463
@cursor

cursor Bot commented Nov 18, 2026 •

Copy link
Copy Markdown

PR Summary

Medium Risk
Changes script error parsing and new error logging on every microservice failure path; behavior is regression-tested but affects user-visible messages and log content.

Overview
Script microservice failures now surface the real failure reason to users instead of generic exit-status text, while application logs gain bounded, redacted executor diagnostics.

ErrorHandling::convertResponseToException treats messages like Script execution failed with exit code: N as fallbacks and prefers nested actionable fields (e.g. error.error on API 1.2.1 vs output.error on 1.0.0). Before raising ScriptException, it logs a single error entry with sanitized diagnostics, output_diagnostics, and correlation—never the full response. Diagnostics are depth- and length-capped; text stack traces are dropped, and only structured trace frames (file, line, class, function) are kept without args/objects. redactScriptErrorDetails is extended for JSON credential values (including escaped quotes), with a safe fallback when regex redaction fails.

Versioned fixtures and ScriptMicroserviceErrorContractTest lock both API shapes and logging/redaction behavior.

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

@eiresendez eiresendez self-assigned this Nov 18, 2026
Omit text traces and retain only structured frame fields. Redact complete JSON credential values containing escaped quotes or backslashes.

Refs: FOUR-34463
Resolve SonarQube return-count and regex-complexity findings without changing diagnostic behavior.

Refs: FOUR-34463
@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

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant