Fixes#617
## Summary
Replaces deprecated Nashorn JavaScript engine (removed in Java 15) with
GraalJS, porting production-tested enterprise features from Orkes Conductor
to OSS.
## Enterprise Feature Port
This implementation is based on OrkesScriptEvaluator from Orkes Enterprise,
adapted for OSS with the following enterprise features:
### Ported Features:
- GraalJS engine implementation (battle-tested in production)
- Timeout protection (prevents runaway scripts)
- Context pooling (optional performance optimization)
- ConsoleBridge (console logging support)
- Deep copy protection (prevents PolyglotMap issues)
- Enhanced error handling (line number information)
### Excluded (Enterprise-only):
- Spring @Value configuration injection
- Enterprise telemetry/monitoring hooks
- Enterprise-specific error reporting
### Adapted for OSS:
- Environment variable configuration (vs Spring properties)
- Self-initializing with defaults (no Spring DI required)
- Simplified configuration model
## Changes
### Core Implementation
- Migrated ScriptEvaluator from Nashorn to GraalJS with timeout protection
- Added ConsoleBridge for console.log/info/error support
- Updated JavascriptEvaluator with deep copy protection for PolyglotMap issues
- Updated exception handling in DecisionTaskMapper, DoWhile, WorkflowTaskTypeConstraint
### Dependencies
- Added GraalJS dependencies (org.graalvm.js:js:24.1.0, js-scriptengine:24.1.0)
- Removed Nashorn dependency (org.openjdk.nashorn:nashorn-core)
### Features Added (from Enterprise)
- ES6+ JavaScript support (const, let, arrow functions, template literals, etc.)
- Script execution timeout protection (4 seconds default, configurable)
- Optional context pooling for improved performance
- Enhanced error messages with line number information
- ConsoleBridge for capturing console output in tasks
- Deep copy protection for workflow task data
### Configuration
New optional environment variables:
- CONDUCTOR_SCRIPT_MAX_EXECUTION_SECONDS (default: 4)
- CONDUCTOR_SCRIPT_CONTEXT_POOL_SIZE (default: 10)
- CONDUCTOR_SCRIPT_CONTEXT_POOL_ENABLED (default: false)
### Testing
- Updated existing ScriptEvaluator tests for GraalJS
- Added comprehensive TestGraalJSFeatures test suite (16 tests)
- Tests cover enterprise features: timeout, console, context pooling
- All tests passing with Java 17
## Backward Compatibility
- 100% backward compatible at application level
- All existing workflows continue to work unchanged
- No API changes, workflow definitions, or syntax changes
- Deprecated: CONDUCTOR_NASHORN_ES6_ENABLED env var (no longer needed)
## Version Impact
Minor version bump (3.23.0) - adds enterprise features, fixes deprecated
dependency, maintains backward compatibility. Java 17 requirement was
already established on main branch in PR #3733.
## Enterprise Parity
Brings OSS closer to feature parity with Orkes Enterprise by porting
production-tested JavaScript evaluation capabilities. Timeout protection
and error handling improvements are particularly valuable for production
deployments.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>