Skip to content

Fix JavaScript port status reliability#5411

Merged
shai-almog merged 5 commits into
masterfrom
fix-javascript-port-status-flakiness
Jul 19, 2026
Merged

Fix JavaScript port status reliability#5411
shai-almog merged 5 commits into
masterfrom
fix-javascript-port-status-flakiness

Conversation

@shai-almog

Copy link
Copy Markdown
Collaborator

Summary

  • make JavaScript screenshot CI fail when the underlying suite reports assertion or runtime errors
  • repair worker/host bindings, callback dispatch, and RTA retention for timers, crypto, browser components, camera, video, and related HTML5 APIs
  • fix JavaScript runtime semantics exposed by the port-status suite, including regex replacement, time-zone offsets, floating formatting, PrintStream, accessibility, chart construction, and orientation behavior
  • enable the HTML5 camera test with deterministic fake media and real asynchronous photo capture instead of skipping it
  • strengthen end-to-end assertions and add translator/core regression coverage

Root cause

Recent port-status reports combined several independent failures. Browser-facing callbacks were either missing host bindings or were culled because the bytecode-only reachability analysis could not see host-dispatched edges. Camera photo completion could also deadlock behind the EDT. Several Java runtime behaviors diverged on JavaScript, and the screenshot workflow did not make Java assertion/runtime markers fatal, allowing a green workflow to publish a red report.

This change fixes the runtime and lifecycle paths themselves, retains only the required dynamic dispatch targets, and makes report failures fail CI. It does not skip failing tests, force timeouts, reseed screenshot references, or relax comparison thresholds.

Validation

  • built a clean optimized JavaScript bundle and ran the complete browser suite twice from fresh browser/server sessions
    • all 164 JavaScript tests completed without assertion/runtime errors or report-level skips
    • 180/180 screenshots delivered on each run with zero dropped frames
    • all 180 screenshot hashes were byte-for-byte identical between runs
  • ran focused CameraApiTest and StringApiTest browser checks successfully
  • JavascriptRuntimeSemanticsTest: 171 tests, 0 failures, 0 errors; one pre-existing deferred monitor-FIFO skip
  • AccessibilitySemanticsTest,CombinedXYChartTest: 11 tests, 0 failures, 0 errors, 0 skips
  • port-status contract unit tests: 3 passed
  • emitted/source JavaScript syntax, shell syntax, and git diff --check passed

The local macOS normalized report still records pixel differences against CI-owned screenshot references. No references or thresholds were changed; screenshot sanity reported zero structurally wrong images, and both complete runs produced identical output. CI remains the authoritative pixel-reference environment.

@github-actions

Copy link
Copy Markdown
Contributor

Cloudflare Preview

@shai-almog

shai-almog commented Jul 19, 2026

Copy link
Copy Markdown
Collaborator Author

Compared 146 screenshots: 146 matched.
Native Windows port (x64 / Intel-AMD): full hellocodenameone screenshot suite rendered offscreen with Direct2D/DirectWrite, plus the real benchmarks (base64 native/CN1/SIMD, image createMask/applyMask/modifyAlpha/PNG/JPEG, SSE2 SIMD kernels). Compared against the in-repo baseline in scripts/windows/screenshots.

Benchmark Results

Detailed Performance Metrics

Metric Duration
SIMD kernel backend SSE2 (x64) / NEON (arm64) native kernels
SIMD int-add (64K x300) java 34ms / native 2ms = 17.0x speedup
SIMD float-mul (64K x300) java 39ms / native 2ms = 19.5x speedup
SIMD kernel correctness PASS (native result == scalar reference)

@github-actions

github-actions Bot commented Jul 19, 2026

Copy link
Copy Markdown
Contributor

✅ ByteCodeTranslator Quality Report

Test & Coverage

  • Tests: 405 total, 0 failed, 14 skipped

Benchmark Results

  • Execution Time: 20279 ms

  • Hotspots (Top 20 sampled methods):

    • 20.85% java.util.ArrayList.indexOf (382 samples)
    • 5.40% com.codename1.tools.translator.BytecodeMethod.addToConstantPool (99 samples)
    • 4.15% com.codename1.tools.translator.ByteCodeClass.markDependent (76 samples)
    • 3.60% java.lang.StringBuilder.append (66 samples)
    • 2.67% com.codename1.tools.translator.BytecodeMethod.optimize (49 samples)
    • 2.35% com.codename1.tools.translator.ByteCodeClass.hasDeclaredMethod (43 samples)
    • 2.29% com.codename1.tools.translator.Parser.cn1EnsureSubclassIndex (42 samples)
    • 2.07% java.lang.System.identityHashCode (38 samples)
    • 1.80% com.codename1.tools.translator.bytecodes.Invoke.resolveDirectTarget (33 samples)
    • 1.69% com.codename1.tools.translator.Parser.generateClassAndMethodIndexHeader (31 samples)
    • 1.64% org.objectweb.asm.tree.analysis.Analyzer.findSubroutine (30 samples)
    • 1.58% java.lang.Object.hashCode (29 samples)
    • 1.58% org.objectweb.asm.tree.analysis.Analyzer.analyze (29 samples)
    • 1.53% com.codename1.tools.translator.BytecodeMethod.appendCMethodPrefix (28 samples)
    • 1.47% com.codename1.tools.translator.Parser.classIndex (27 samples)
    • 1.47% java.lang.StringCoding.encode (27 samples)
    • 1.36% com.codename1.tools.translator.BytecodeMethod.equals (25 samples)
    • 1.36% java.lang.String.equals (25 samples)
    • 1.36% java.util.HashMap.hash (25 samples)
    • 0.93% com.codename1.tools.translator.NativeSymbolIndex.<init> (17 samples)
  • ⚠️ Coverage report not generated.

Static Analysis

  • ✅ SpotBugs: no findings (report was not generated by the build).
  • ⚠️ PMD report not generated.
  • ⚠️ Checkstyle report not generated.

Generated automatically by the PR CI workflow.

@shai-almog

shai-almog commented Jul 19, 2026

Copy link
Copy Markdown
Collaborator Author

Compared 146 screenshots: 146 matched.
Native Windows port (arm64 / Apple Silicon - Arm): full hellocodenameone screenshot suite rendered offscreen with Direct2D/DirectWrite, plus the real benchmarks (base64 native/CN1/SIMD, image createMask/applyMask/modifyAlpha/PNG/JPEG, NEON SIMD kernels). Compared against the in-repo baseline in scripts/windows/screenshots.

Benchmark Results

Detailed Performance Metrics

Metric Duration
SIMD kernel backend SSE2 (x64) / NEON (arm64) native kernels
SIMD int-add (64K x300) java 55ms / native 4ms = 13.7x speedup
SIMD float-mul (64K x300) java 55ms / native 3ms = 18.3x speedup
SIMD kernel correctness PASS (native result == scalar reference)

@shai-almog

shai-almog commented Jul 19, 2026

Copy link
Copy Markdown
Collaborator Author

Compared 151 screenshots: 151 matched.

Native Android coverage

  • 📊 Line coverage: 11.44% (12041/105219 lines covered) [HTML preview] (artifact android-coverage-report, jacocoAndroidReport/html/index.html)
    • Other counters: instruction 10.24% (59645/582206), branch 5.32% (2834/53223), complexity 5.06% (2823/55771), method 7.55% (2166/28678), class 11.96% (489/4088)
    • Lowest covered classes
      • kotlin.collections.kotlin.collections.ArraysKt___ArraysKt – 0.00% (0/6327 lines covered)
      • kotlin.collections.unsigned.kotlin.collections.unsigned.UArraysKt___UArraysKt – 0.00% (0/2384 lines covered)
      • org.jacoco.agent.rt.internal_b6258fc.asm.org.jacoco.agent.rt.internal_b6258fc.asm.ClassReader – 0.00% (0/1519 lines covered)
      • kotlin.collections.kotlin.collections.CollectionsKt___CollectionsKt – 0.00% (0/1148 lines covered)
      • org.jacoco.agent.rt.internal_b6258fc.asm.org.jacoco.agent.rt.internal_b6258fc.asm.MethodWriter – 0.00% (0/923 lines covered)
      • kotlin.sequences.kotlin.sequences.SequencesKt___SequencesKt – 0.00% (0/730 lines covered)
      • com.google.common.cache.com.google.common.cache.LocalCache$Segment – 0.00% (0/726 lines covered)
      • kotlin.text.kotlin.text.StringsKt___StringsKt – 0.00% (0/623 lines covered)
      • org.jacoco.agent.rt.internal_b6258fc.asm.org.jacoco.agent.rt.internal_b6258fc.asm.Frame – 0.00% (0/564 lines covered)
      • kotlin.collections.kotlin.collections.ArraysKt___ArraysJvmKt – 0.00% (0/495 lines covered)

✅ Native Android screenshot tests passed.

Native Android coverage

  • 📊 Line coverage: 11.44% (12041/105219 lines covered) [HTML preview] (artifact android-coverage-report, jacocoAndroidReport/html/index.html)
    • Other counters: instruction 10.24% (59645/582206), branch 5.32% (2834/53223), complexity 5.06% (2823/55771), method 7.55% (2166/28678), class 11.96% (489/4088)
    • Lowest covered classes
      • kotlin.collections.kotlin.collections.ArraysKt___ArraysKt – 0.00% (0/6327 lines covered)
      • kotlin.collections.unsigned.kotlin.collections.unsigned.UArraysKt___UArraysKt – 0.00% (0/2384 lines covered)
      • org.jacoco.agent.rt.internal_b6258fc.asm.org.jacoco.agent.rt.internal_b6258fc.asm.ClassReader – 0.00% (0/1519 lines covered)
      • kotlin.collections.kotlin.collections.CollectionsKt___CollectionsKt – 0.00% (0/1148 lines covered)
      • org.jacoco.agent.rt.internal_b6258fc.asm.org.jacoco.agent.rt.internal_b6258fc.asm.MethodWriter – 0.00% (0/923 lines covered)
      • kotlin.sequences.kotlin.sequences.SequencesKt___SequencesKt – 0.00% (0/730 lines covered)
      • com.google.common.cache.com.google.common.cache.LocalCache$Segment – 0.00% (0/726 lines covered)
      • kotlin.text.kotlin.text.StringsKt___StringsKt – 0.00% (0/623 lines covered)
      • org.jacoco.agent.rt.internal_b6258fc.asm.org.jacoco.agent.rt.internal_b6258fc.asm.Frame – 0.00% (0/564 lines covered)
      • kotlin.collections.kotlin.collections.ArraysKt___ArraysJvmKt – 0.00% (0/495 lines covered)

Benchmark Results

Detailed Performance Metrics

Metric Duration
SIMD kernel backend scalar fallback (no native SIMD)
SIMD int-add (64K x300) java 236ms / native 221ms = 1.0x speedup
SIMD float-mul (64K x300) java 125ms / native 82ms = 1.5x speedup
SIMD kernel correctness PASS (native result == scalar reference)
Base64 payload size 8192 bytes
Base64 benchmark iterations 6000
Base64 SIMD byte path gated to scalar (CPU autovectorizes scalar; explicit SIMD not beneficial here)
Base64 CN1 encode 74.000 ms
Base64 CN1 decode 84.000 ms
Base64 native encode 359.000 ms
Base64 encode ratio (CN1/native) 0.206x (79.4% faster)
Base64 native decode 311.000 ms
Base64 decode ratio (CN1/native) 0.270x (73.0% faster)
Image encode benchmark status skipped (SIMD unsupported)

@shai-almog

shai-almog commented Jul 19, 2026

Copy link
Copy Markdown
Collaborator Author

Compared 217 screenshots: 217 matched.
✅ Native Apple Watch (watchOS, Core Graphics) screenshot tests passed.

@shai-almog

shai-almog commented Jul 19, 2026

Copy link
Copy Markdown
Collaborator Author

Compared 148 screenshots: 148 matched.
✅ Native Mac screenshot tests passed.

Benchmark Results

  • VM Translation Time: 0 seconds
  • Compilation Time: 173 seconds

Detailed Performance Metrics

Metric Duration
SIMD kernel backend SSE2 (x64) / NEON (arm64) native kernels
SIMD int-add (64K x300) java 60ms / native 4ms = 15.0x speedup
SIMD float-mul (64K x300) java 71ms / native 7ms = 10.1x speedup
SIMD kernel correctness PASS (native result == scalar reference)
Base64 payload size 8192 bytes
Base64 benchmark iterations 6000
Base64 SIMD byte path active (NEON-accelerated)
Base64 CN1 encode 158.000 ms
Base64 CN1 decode 116.000 ms
Base64 native encode 642.000 ms
Base64 encode ratio (CN1/native) 0.246x (75.4% faster)
Base64 native decode 283.000 ms
Base64 decode ratio (CN1/native) 0.410x (59.0% faster)
Base64 SIMD encode 48.000 ms
Base64 encode ratio (SIMD/CN1) 0.304x (69.6% faster)
Base64 SIMD decode 44.000 ms
Base64 decode ratio (SIMD/CN1) 0.379x (62.1% faster)
Base64 encode ratio (SIMD/native) 0.075x (92.5% faster)
Base64 decode ratio (SIMD/native) 0.155x (84.5% faster)
Image encode benchmark iterations 100
Image createMask (SIMD off) 9.000 ms
Image createMask (SIMD on) 3.000 ms
Image createMask ratio (SIMD on/off) 0.333x (66.7% faster)
Image applyMask (SIMD off) 55.000 ms
Image applyMask (SIMD on) 38.000 ms
Image applyMask ratio (SIMD on/off) 0.691x (30.9% faster)
Image modifyAlpha (SIMD off) 40.000 ms
Image modifyAlpha (SIMD on) 38.000 ms
Image modifyAlpha ratio (SIMD on/off) 0.950x (5.0% faster)
Image modifyAlpha removeColor (SIMD off) 41.000 ms
Image modifyAlpha removeColor (SIMD on) 33.000 ms
Image modifyAlpha removeColor ratio (SIMD on/off) 0.805x (19.5% faster)

@github-actions

github-actions Bot commented Jul 19, 2026

Copy link
Copy Markdown
Contributor

✅ Continuous Quality Report

Test & Coverage

Static Analysis

  • SpotBugs [Report archive]
    • ByteCodeTranslator: 0 findings (no issues)
    • android: 0 findings (no issues)
    • codenameone-maven-plugin: 0 findings (no issues)
    • core-unittests: 0 findings (no issues)
    • ios: 0 findings (no issues)
  • PMD: 0 findings (no issues) [Report archive]
  • Checkstyle: 0 findings (no issues) [Report archive]

Generated automatically by the PR CI workflow.

@shai-almog

shai-almog commented Jul 19, 2026

Copy link
Copy Markdown
Collaborator Author

Compared 143 screenshots: 143 matched.
✅ Native iOS screenshot tests passed.

Benchmark Results

  • VM Translation Time: 0 seconds
  • Compilation Time: 279 seconds

Build and Run Timing

Metric Duration
Simulator Boot 69000 ms
Simulator Boot (Run) 1000 ms
App Install 12000 ms
App Launch 2000 ms
Test Execution 601000 ms

Detailed Performance Metrics

Metric Duration
SIMD kernel backend SSE2 (x64) / NEON (arm64) native kernels
SIMD int-add (64K x300) java 64ms / native 3ms = 21.3x speedup
SIMD float-mul (64K x300) java 100ms / native 4ms = 25.0x speedup
SIMD kernel correctness PASS (native result == scalar reference)
Base64 payload size 8192 bytes
Base64 benchmark iterations 6000
Base64 SIMD byte path active (NEON-accelerated)
Base64 CN1 encode 157.000 ms
Base64 CN1 decode 177.000 ms
Base64 native encode 308.000 ms
Base64 encode ratio (CN1/native) 0.510x (49.0% faster)
Base64 native decode 388.000 ms
Base64 decode ratio (CN1/native) 0.456x (54.4% faster)
Base64 SIMD encode 48.000 ms
Base64 encode ratio (SIMD/CN1) 0.306x (69.4% faster)
Base64 SIMD decode 46.000 ms
Base64 decode ratio (SIMD/CN1) 0.260x (74.0% faster)
Base64 encode ratio (SIMD/native) 0.156x (84.4% faster)
Base64 decode ratio (SIMD/native) 0.119x (88.1% faster)
Image encode benchmark iterations 100
Image createMask (SIMD off) 8.000 ms
Image createMask (SIMD on) 1.000 ms
Image createMask ratio (SIMD on/off) 0.125x (87.5% faster)
Image applyMask (SIMD off) 45.000 ms
Image applyMask (SIMD on) 34.000 ms
Image applyMask ratio (SIMD on/off) 0.756x (24.4% faster)
Image modifyAlpha (SIMD off) 44.000 ms
Image modifyAlpha (SIMD on) 45.000 ms
Image modifyAlpha ratio (SIMD on/off) 1.023x (2.3% slower)
Image modifyAlpha removeColor (SIMD off) 47.000 ms
Image modifyAlpha removeColor (SIMD on) 43.000 ms
Image modifyAlpha removeColor ratio (SIMD on/off) 0.915x (8.5% faster)

@shai-almog

shai-almog commented Jul 19, 2026

Copy link
Copy Markdown
Collaborator Author

Compared 144 screenshots: 144 matched.
✅ Native Apple TV (tvOS, Metal) screenshot tests passed.

@shai-almog

shai-almog commented Jul 19, 2026

Copy link
Copy Markdown
Collaborator Author

Compared 146 screenshots: 146 matched.
Native Windows port, REAL shipping pipeline: the hellocodenameone screenshot suite rendered by a binary CROSS-COMPILED on Linux (clang-cl + xwin, WebView2 linked) and RUN on a Windows x64 runner. Compared against the in-repo baseline in scripts/windows/screenshots.

Benchmark Results

Detailed Performance Metrics

Metric Duration
SIMD kernel backend SSE2 (x64) / NEON (arm64) native kernels
SIMD int-add (64K x300) java 63ms / native 4ms = 15.7x speedup
SIMD float-mul (64K x300) java 64ms / native 4ms = 16.0x speedup
SIMD kernel correctness PASS (native result == scalar reference)

@shai-almog

shai-almog commented Jul 19, 2026

Copy link
Copy Markdown
Collaborator Author

Compared 147 screenshots: 147 matched.
Native Linux port (x64), GTK3/Cairo/Pango, ParparVM bytecode-to-C (no JVM): the hellocodenameone screenshot suite rendered by a native ELF built + run on the GitHub x64 runner. Baseline: scripts/linux/screenshots.

@shai-almog

shai-almog commented Jul 19, 2026

Copy link
Copy Markdown
Collaborator Author

Compared 147 screenshots: 147 matched.
Native Linux port (arm64), GTK3/Cairo/Pango, ParparVM bytecode-to-C (no JVM): the hellocodenameone screenshot suite rendered by a native ELF built + run on the GitHub arm64 runner. Baseline: scripts/linux/screenshots-arm.

@shai-almog

shai-almog commented Jul 19, 2026

Copy link
Copy Markdown
Collaborator Author

Compared 181 screenshots: 181 matched.
✅ JavaScript-port screenshot tests passed.

@shai-almog

shai-almog commented Jul 19, 2026

Copy link
Copy Markdown
Collaborator Author

Compared 149 screenshots: 149 matched.
✅ Native iOS Metal screenshot tests passed.

Benchmark Results

  • VM Translation Time: 0 seconds
  • Compilation Time: 424 seconds

Build and Run Timing

Metric Duration
Simulator Boot 79000 ms
Simulator Boot (Run) 1000 ms
App Install 12000 ms
App Launch 1000 ms
Test Execution 699000 ms

Detailed Performance Metrics

Metric Duration
SIMD kernel backend SSE2 (x64) / NEON (arm64) native kernels
SIMD int-add (64K x300) java 102ms / native 3ms = 34.0x speedup
SIMD float-mul (64K x300) java 71ms / native 3ms = 23.6x speedup
SIMD kernel correctness PASS (native result == scalar reference)
Base64 payload size 8192 bytes
Base64 benchmark iterations 6000
Base64 SIMD byte path active (NEON-accelerated)
Base64 CN1 encode 147.000 ms
Base64 CN1 decode 124.000 ms
Base64 native encode 261.000 ms
Base64 encode ratio (CN1/native) 0.563x (43.7% faster)
Base64 native decode 268.000 ms
Base64 decode ratio (CN1/native) 0.463x (53.7% faster)
Base64 SIMD encode 48.000 ms
Base64 encode ratio (SIMD/CN1) 0.327x (67.3% faster)
Base64 SIMD decode 41.000 ms
Base64 decode ratio (SIMD/CN1) 0.331x (66.9% faster)
Base64 encode ratio (SIMD/native) 0.184x (81.6% faster)
Base64 decode ratio (SIMD/native) 0.153x (84.7% faster)
Image encode benchmark iterations 100
Image createMask (SIMD off) 7.000 ms
Image createMask (SIMD on) 3.000 ms
Image createMask ratio (SIMD on/off) 0.429x (57.1% faster)
Image applyMask (SIMD off) 50.000 ms
Image applyMask (SIMD on) 32.000 ms
Image applyMask ratio (SIMD on/off) 0.640x (36.0% faster)
Image modifyAlpha (SIMD off) 37.000 ms
Image modifyAlpha (SIMD on) 30.000 ms
Image modifyAlpha ratio (SIMD on/off) 0.811x (18.9% faster)
Image modifyAlpha removeColor (SIMD off) 34.000 ms
Image modifyAlpha removeColor (SIMD on) 26.000 ms
Image modifyAlpha removeColor ratio (SIMD on/off) 0.765x (23.5% faster)

@shai-almog
shai-almog merged commit 42bdcda into master Jul 19, 2026
53 checks passed
@shai-almog
shai-almog deleted the fix-javascript-port-status-flakiness branch July 19, 2026 04:05
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