Conversation
Replace the Nashorn java.* package globals in smartRequest.ts with hoisted Java.type(...) lookups so the HTTP error-handling branches resolve under GraalJS, which does not expose java.* without the nashorn-compat escape hatch. Add dual-engine test wiring (testRuntimeOnly org.graalvm.polyglot:js and a testGraalJs task wired into check, mirroring enonic/lib-sql#154) plus a ScriptRunnerSupport test that loads the compiled smartRequest bundle and exercises every catch branch on both Nashorn and GraalJS. Requires xpVersion=8.1.0-SNAPSHOT (ScriptRunnerSupport fix from enonic/xp#12198). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #426 +/- ##
==========================================
- Coverage 17.28% 17.28% -0.01%
==========================================
Files 322 322
Lines 18741 18744 +3
Branches 697 741 +44
==========================================
Hits 3240 3240
- Misses 15207 15208 +1
- Partials 294 296 +2 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
Pushed CI status (Gradle Build run):
Verified locally against the platform built from |
Fixes #425
Java package globals
smartRequest.tsmatched connection errors with the Nashornjava.*packageglobals (
java.net.ConnectException,java.net.SocketTimeoutException,java.lang.NullPointerException). Those globals are a Nashorn feature thatGraalJS only exposes under nashorn-compat, so the
instanceofchecks break oncethat escape hatch is gone. They are now hoisted, constant
Java.type(...)lookups (standard GraalJS interop — XP configures
allowHostClassLookup),exactly as the issue prescribes.
app-explorerreaches this same file throughits
symlinks/lib-explorersymlink, so it is fixed there too.Tests on both engines
Added the dual-engine wiring from the issue (mirroring enonic/lib-sql#154):
testRuntimeOnly org.graalvm.polyglot:jsand atestGraalJstask that runsalongside the Nashorn
testtask viacheck. The newSmartRequestTest(
ScriptRunnerSupport) loads the compiledsmartRequestbundle and drivesevery catch branch —
ConnectException/SocketTimeoutException/NullPointerException/ unhandled — plus the happy path.Verified locally with the platform built from
enonic/xp@claude/graaljs-support-limitations-pzu6z8to mavenLocal (GraalVM CE 25)::test(Nashorn) — 5/5 green:testGraalJs(GraalJS) — 5/5 greennpm test(Jest) — 542/542 green;tsc --noEmitcleanDraft
Needs the
ScriptRunnerSupportfix from enonic/xp#12198, hencexpVersion=8.1.0-SNAPSHOT. CItestGraalJsstays red until #12198 is mergedand a fresh 8.1.0-SNAPSHOT is published — on the currently published snapshot
ScriptRunnerSupport.findTestNames()tears down the shared script executorduring test discovery, so the GraalJS run fails with
IllegalStateException/PolyglotEngineExceptionbefore the assertions run(the Nashorn
:testrun is unaffected). Kept as a draft until then.