Skip to content

Backend: Spring-style beans, transactions, scheduling, metrics and MCP, resolved at build time - #5908

Open
shai-almog wants to merge 50 commits into
masterfrom
backend-spring-model
Open

shai-almog wants to merge 50 commits into
masterfrom
backend-spring-model

Conversation

@shai-almog

Copy link
Copy Markdown
Collaborator

What

The backend now reads like a Spring application -- @Service, @Autowired, @Value, @ConfigurationProperties, @Bean, scopes, @Profile/@ConditionalOnProperty, @Transactional, @Async, @Scheduled, @ManagedResource/@Timed/@Counted, @McpTool -- all under com.codename1.backend.annotations, and all resolved at build time:

  • Injection: a new BackendBeanAnnotationProcessor resolves the bean graph and the entry point's generated BackendWiring constructs and injects every bean with straight-line new/setter calls. Private @Autowired fields get a woven setter. Missing, ambiguous or cyclic dependencies are build errors naming the injection point.
  • Aspects: @Transactional, @Async, @Timed, @Counted rewrite the method itself (body moved aside, the method delegates to a generated helper) -- no proxy, so self-calls, private methods and new-built objects get them too.
  • Runtime: thread-bound Transactions (all seven propagations, savepoints, read-only) that DataSource, daos and managed sessions join; Scheduler (cron masks computed by the build, fixed rate/delay, DB lock across replicas); Tasks/TaskExecutor including fd-less virtual-thread tasks with a per-host wake pipe; HttpSession with memory and JDBC stores; OTLP metrics + /manage endpoints (health, JSON, Prometheus, jobs, managed beans); an MCP endpoint serving @McpTool methods and, on dev profiles, development tools (backend_routes, backend_beans, backend_call, backend_requests, backend_sql, ...), excluded from cn1:backend-package by default.
  • Skill/archetype/docs: backend.md and full-stack-loop.md references in the Initializr skill, archetype/Initializr backend sample with an injected service, new Backend guide sections with compiled snippets.

Fixes found on the way

  • Virtual-thread yield reason was sticky (host-side reset is a no-op), so yieldNow() from a handler hung and IO parks after GC backpressure were misreported as runnable; each yield site now sets its reason.
  • Future.get() on a virtual thread blocked the host and could wedge every host; it now yields cooperatively.
  • A handler taking HttpServer.Request was refused ($ vs . in the nested type name).

Verification

  • Plugin: 2550 tests incl. 11 new end-to-end tests that compile, process, and run the generated server. Backend: 324 tests incl. transaction propagation, scheduler, sessions, metrics, MCP; server-engine test passed against PostgreSQL 16 and MySQL 8.
  • Native vm/tests backend suites (HTTP 72/72, WebSocket, OTel, runtime self-test, DB/ORM on all three engines) pass; a sample packaged with cn1:backend-package exercised every feature and survived a 7000-request concurrent soak.
  • SpotBugs 0, native signature gate, control characters/ASCII, copyright, Vale and LanguageTool on the Backend chapter, guide structure checks, Initializr fixture scripts.

Known limits

Aspects apply to project classes only; request/session/lazy beans need a non-final class with a no-arg constructor (run once for the stand-in); no transaction isolation levels; session-bean @PreDestroy not run on expiry; cn1app-archetype-test.sh extended but not run locally.

🤖 Generated with Claude Code

…P, resolved at build time

The backend gains Spring's programming model under com.codename1.backend.annotations
-- @Service/@Component/@repository, @Autowired, @value, @ConfigurationProperties,
@bean, scopes, profiles and conditions, @transactional, @async, @scheduled,
@ManagedResource/@Timed/@counted and @mcptool -- with every decision made by the
build: a generated BackendWiring constructs and injects the beans with plain code,
and aspects are woven into the annotated methods. No container, scan, proxy or
reflection at run time.

Runtime: thread-bound transactions that the pool, daos and sessions join, a cron
and fixed-rate scheduler with an optional database lock, task executors including
fd-less virtual-thread tasks with a per-host wake pipe, HTTP sessions (memory or
JDBC store), OTLP metrics and management endpoints, and an MCP endpoint with
development tools.

Also fixes the sticky virtual-thread yield reason (yieldNow from a handler hung),
a handler taking HttpServer.Request being refused, and adds the backend and
full-stack references to the generated agent skill.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@shai-almog

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 26, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-30T10:14:43.712406Z 8a41512 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@github-actions

github-actions Bot commented Sep 26, 2026 •

Copy link
Copy Markdown
Contributor

Developer Guide build artifacts are available for download from this workflow run:

Developer Guide quality checks:

  • AsciiDoc linter: No issues found (report)
  • Vale: No alerts found (report)
  • Paragraph capitalization: No paragraph capitalization issues (report)
  • LanguageTool: No grammar matches (report)
  • Image references: No unused images detected (report)

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 6dd51f4064

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread vm/backend/src/com/codename1/backend/Sessions.java Outdated
Comment thread vm/backend/src/com/codename1/backend/TaskExecutor.java Outdated
Comment thread vm/backend/src/com/codename1/backend/mcp/McpServer.java Outdated
Comment thread vm/backend/src/com/codename1/backend/otel/OtlpSchema.java Outdated
Comment thread vm/backend/src/com/codename1/backend/Sessions.java Outdated
Comment thread vm/backend/src/com/codename1/backend/Scheduler.java Outdated
Comment thread vm/backend/src/com/codename1/backend/mcp/DevTools.java Outdated
@shai-almog

shai-almog commented Sep 26, 2026 •

Copy link
Copy Markdown
Collaborator Author

Compared 172 screenshots: 172 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 64ms / native 5ms = 12.8x speedup
SIMD float-mul (64K x300) java 56ms / native 5ms = 11.2x speedup
SIMD kernel correctness PASS (native result == scalar reference)
Base64 native bridge unavailable (CN1 + SIMD + image benchmarks only)
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 89.000 ms
Base64 SIMD encode 111.000 ms
Base64 encode ratio (SIMD/CN1) 1.500x (50.0% slower)
Base64 SIMD decode 104.000 ms
Base64 decode ratio (SIMD/CN1) 1.169x (16.9% slower)
Image encode benchmark iterations 100
Image createMask (SIMD off) 10.000 ms
Image createMask (SIMD on) 4.000 ms
Image createMask ratio (SIMD on/off) 0.400x (60.0% faster)
Image applyMask (SIMD off) 17.000 ms
Image applyMask (SIMD on) 25.000 ms
Image applyMask ratio (SIMD on/off) 1.471x (47.1% slower)
Image modifyAlpha (SIMD off) 28.000 ms
Image modifyAlpha (SIMD on) 17.000 ms
Image modifyAlpha ratio (SIMD on/off) 0.607x (39.3% faster)
Image modifyAlpha removeColor (SIMD off) 30.000 ms
Image modifyAlpha removeColor (SIMD on) 19.000 ms
Image modifyAlpha removeColor ratio (SIMD on/off) 0.633x (36.7% faster)

ParparVM vs HotSpot (JDK 25): Windows x64

Runner CPU: AMD64 Family 25 Model 1 Stepping 1, AuthenticAMD (baseline windows-x64@amd64-family-25-model-1-authenticamd)

Ratios are ParparVM / JDK 25: below 1.00x ParparVM is faster (time) or smaller (RAM). Median of 5 interleaved, paired rounds; every run's output was verified. A regression is a ratio more than 15% (time) / 15% (RAM) above its baseline in vm/selfhost/perf-baseline.json (more, for a row whose calibration runs were noisier; the file records it), and for RAM also more than 0.05x above it in absolute terms. Both run unpinned on all of the runner's CPUs, with their own default thread counts.

Benchmark Cores Time RAM Status
hello (WinHelloMain) 4 1.09x (base 1.24x, -12.4%) 0.81x (base 0.80x, +1.5%) ok
translator (self) 4 0.60x (base 0.61x, -1.3%) 0.53x (base 0.54x, -2.1%) ok
intArithmetic 4 1.10x (base 1.10x, -0.0%) 0.06x (base 0.06x, -0.6%) ok
longArithmetic 4 1.08x (base 1.08x, -0.1%) 0.05x (base 0.05x, -0.2%) ok
mathTranscendental 4 0.79x (base 0.79x, +0.1%) 0.06x (base 0.06x, -0.1%) ok
arraySequential 4 1.35x (base 1.36x, -1.2%) 0.39x (base 0.39x, +0.1%) ok
arrayRandom 4 0.92x (base 1.06x, -13.5%) 0.23x (base 0.23x, +0.0%) ok
objectAllocation 4 6.55x (base 4.93x, +32.8%) 0.40x (base 0.40x, +0.8%) ok
valueEscape 4 0.10x (base 0.10x, +0.4%) 0.04x (base 0.04x, +1.6%) ok
hashMapChurn 4 1.81x (base 1.80x, +0.9%) 0.09x (base 0.09x, +0.5%) ok
stringBuilding 4 1.23x (base 1.22x, +1.2%) 0.27x (base 0.32x, -17.2%) better than baseline
recursion 4 1.49x (base 1.49x, -0.1%) 0.06x (base 0.06x, -0.8%) ok
quicksort 4 1.13x (base 1.13x, -0.1%) 0.12x (base 0.12x, -0.2%) ok

Result: no regression

@shai-almog

shai-almog commented Sep 26, 2026 •

Copy link
Copy Markdown
Collaborator Author

Compared 172 screenshots: 172 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 78ms / native 11ms = 7.0x speedup
SIMD float-mul (64K x300) java 66ms / native 6ms = 11.0x speedup
SIMD kernel correctness PASS (native result == scalar reference)
Base64 native bridge unavailable (CN1 + SIMD + image benchmarks only)
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 83.000 ms
Base64 CN1 decode 96.000 ms
Base64 SIMD encode 115.000 ms
Base64 encode ratio (SIMD/CN1) 1.386x (38.6% slower)
Base64 SIMD decode 113.000 ms
Base64 decode ratio (SIMD/CN1) 1.177x (17.7% slower)
Image encode benchmark iterations 100
Image createMask (SIMD off) 10.000 ms
Image createMask (SIMD on) 5.000 ms
Image createMask ratio (SIMD on/off) 0.500x (50.0% faster)
Image applyMask (SIMD off) 24.000 ms
Image applyMask (SIMD on) 29.000 ms
Image applyMask ratio (SIMD on/off) 1.208x (20.8% slower)
Image modifyAlpha (SIMD off) 37.000 ms
Image modifyAlpha (SIMD on) 23.000 ms
Image modifyAlpha ratio (SIMD on/off) 0.622x (37.8% faster)
Image modifyAlpha removeColor (SIMD off) 40.000 ms
Image modifyAlpha removeColor (SIMD on) 25.000 ms
Image modifyAlpha removeColor ratio (SIMD on/off) 0.625x (37.5% faster)

@github-actions

Copy link
Copy Markdown
Contributor

Cloudflare Preview

@shai-almog

shai-almog commented Sep 26, 2026 •

Copy link
Copy Markdown
Collaborator Author

Compared 172 screenshots: 172 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.

ParparVM vs HotSpot (JDK 25): Linux x64

Runner CPU: AMD EPYC 9V74 80-Core Processor (baseline linux-x64@amd-epyc-9v74-80-core-processor)

Ratios are ParparVM / JDK 25: below 1.00x ParparVM is faster (time) or smaller (RAM). Median of 5 interleaved, paired rounds; every run's output was verified. A regression is a ratio more than 15% (time) / 15% (RAM) above its baseline in vm/selfhost/perf-baseline.json (more, for a row whose calibration runs were noisier; the file records it), and for RAM also more than 0.05x above it in absolute terms. Both run unpinned on all of the runner's CPUs, with their own default thread counts.

Benchmark Cores Time RAM Status
hello (LinuxHelloMain) 4 0.90x (base 0.90x, +0.5%) 0.83x (base 0.79x, +5.3%) ok
translator (self) 4 0.46x (base 0.52x, -10.2%) 0.51x (base 0.52x, -2.2%) ok
intArithmetic 4 1.10x (base 1.10x, -0.0%) 0.06x (base 0.06x, +0.5%) ok
longArithmetic 4 1.08x (base 1.08x, +0.0%) 0.05x (base 0.06x, -2.2%) ok
mathTranscendental 4 1.09x (base 1.09x, -0.0%) 0.08x (base 0.07x, +13.1%) ok
arraySequential 4 2.78x (base 2.81x, -1.1%) 0.36x (base 0.35x, +0.7%) ok
arrayRandom 4 1.09x (base 1.02x, +6.5%) 0.23x (base 0.21x, +7.5%) ok
objectAllocation 4 4.73x (base 4.76x, -0.4%) 0.44x (base 0.39x, +12.9%) ok
valueEscape 4 0.10x (base 0.10x, +0.5%) 0.04x (base 0.06x, -23.0%) ok
hashMapChurn 4 1.47x (base 1.10x, +33.9%) 0.10x (base 0.10x, -3.8%) ok
stringBuilding 4 1.42x (base 1.49x, -4.5%) 0.26x (base 0.26x, -0.1%) ok
recursion 4 1.24x (base 1.24x, +0.0%) 0.05x (base 0.06x, -2.2%) ok
quicksort 4 1.07x (base 1.07x, -0.0%) 0.11x (base 0.11x, +0.4%) ok

Result: no regression

@shai-almog

shai-almog commented Sep 26, 2026 •

Copy link
Copy Markdown
Collaborator Author

Compared 172 screenshots: 172 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.

ParparVM vs HotSpot (JDK 25): Linux arm64

Runner CPU: Neoverse-N2 (baseline linux-arm64@neoverse-n2)

Ratios are ParparVM / JDK 25: below 1.00x ParparVM is faster (time) or smaller (RAM). Median of 5 interleaved, paired rounds; every run's output was verified. A regression is a ratio more than 15% (time) / 15% (RAM) above its baseline in vm/selfhost/perf-baseline.json (more, for a row whose calibration runs were noisier; the file records it), and for RAM also more than 0.05x above it in absolute terms. Both run unpinned on all of the runner's CPUs, with their own default thread counts.

Benchmark Cores Time RAM Status
hello (LinuxHelloMain) 4 0.92x (base 0.93x, -1.1%) 0.85x (base 0.87x, -2.4%) ok
translator (self) 4 0.61x (base 0.62x, -2.1%) 0.54x (base 0.54x, +0.1%) ok
intArithmetic 4 1.04x (base 1.04x, -0.1%) 0.03x (base 0.03x, +0.8%) ok
longArithmetic 4 0.79x (base 0.79x, -0.1%) 0.03x (base 0.03x, +0.9%) ok
mathTranscendental 4 1.10x (base 1.10x, -0.1%) 0.03x (base 0.03x, +0.9%) ok
arraySequential 4 0.36x (base 0.36x, -0.9%) 0.37x (base 0.37x, +0.2%) ok
arrayRandom 4 0.94x (base 0.94x, +0.1%) 0.20x (base 0.20x, +0.2%) ok
objectAllocation 4 2.98x (base 3.04x, -2.0%) 0.24x (base 0.24x, +1.2%) ok
valueEscape 4 0.51x (base 0.51x, -0.1%) 0.03x (base 0.03x, +2.9%) ok
hashMapChurn 4 0.82x (base 0.84x, -2.5%) 0.13x (base 0.12x, +5.2%) ok
stringBuilding 4 1.38x (base 1.36x, +1.3%) 0.26x (base 0.26x, -0.1%) ok
recursion 4 1.44x (base 1.43x, +0.2%) 0.03x (base 0.04x, -0.8%) ok
quicksort 4 0.99x (base 0.99x, -0.1%) 0.09x (base 0.09x, -0.1%) ok

Result: no regression

@shai-almog

shai-almog commented Sep 26, 2026 •

Copy link
Copy Markdown
Collaborator Author

Compared 172 screenshots: 172 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 53ms / native 3ms = 17.6x speedup
SIMD float-mul (64K x300) java 54ms / native 4ms = 13.5x speedup
SIMD kernel correctness PASS (native result == scalar reference)
Base64 native bridge unavailable (CN1 + SIMD + image benchmarks only)
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 59.000 ms
Base64 CN1 decode 70.000 ms
Base64 SIMD encode 78.000 ms
Base64 encode ratio (SIMD/CN1) 1.322x (32.2% slower)
Base64 SIMD decode 73.000 ms
Base64 decode ratio (SIMD/CN1) 1.043x (4.3% slower)
Image encode benchmark iterations 100
Image createMask (SIMD off) 5.000 ms
Image createMask (SIMD on) 1.000 ms
Image createMask ratio (SIMD on/off) 0.200x (80.0% faster)
Image applyMask (SIMD off) 13.000 ms
Image applyMask (SIMD on) 16.000 ms
Image applyMask ratio (SIMD on/off) 1.231x (23.1% slower)
Image modifyAlpha (SIMD off) 12.000 ms
Image modifyAlpha (SIMD on) 9.000 ms
Image modifyAlpha ratio (SIMD on/off) 0.750x (25.0% faster)
Image modifyAlpha removeColor (SIMD off) 18.000 ms
Image modifyAlpha removeColor (SIMD on) 9.000 ms
Image modifyAlpha removeColor ratio (SIMD on/off) 0.500x (50.0% faster)

ParparVM vs HotSpot (JDK 25): Windows arm64

Runner CPU: ARMv8 (64-bit) Family 8 Model D49 Revision 0, MICROSOFT CORPORATION (baseline windows-arm64@armv8-64-bit-family-8-model-d49-microsoft-corporation)

Ratios are ParparVM / JDK 25: below 1.00x ParparVM is faster (time) or smaller (RAM). Median of 5 interleaved, paired rounds; every run's output was verified. A regression is a ratio more than 15% (time) / 15% (RAM) above its baseline in vm/selfhost/perf-baseline.json (more, for a row whose calibration runs were noisier; the file records it), and for RAM also more than 0.05x above it in absolute terms. Both run unpinned on all of the runner's CPUs, with their own default thread counts.

Benchmark Cores Time RAM Status
hello (WinHelloMain) 4 1.09x (base 1.11x, -1.6%) 0.91x (base 0.90x, +1.3%) ok
translator (self) 4 0.74x (base 0.75x, -0.9%) 0.54x (base 0.54x, +0.1%) ok
intArithmetic 4 1.04x (base 1.04x, -0.0%) 0.06x (base 0.06x, +0.0%) ok
longArithmetic 4 0.80x (base 0.80x, +0.1%) 0.06x (base 0.06x, +0.4%) ok
mathTranscendental 4 0.72x (base 0.72x, -0.0%) 0.06x (base 0.06x, +0.2%) ok
arraySequential 4 0.38x (base 0.39x, -2.6%) 0.39x (base 0.39x, -0.3%) ok
arrayRandom 4 0.94x (base 0.94x, +0.1%) 0.23x (base 0.23x, +0.0%) ok
objectAllocation 4 2.70x (base 2.73x, -1.3%) 0.46x (base 0.46x, -1.0%) ok
valueEscape 4 0.76x (base 0.76x, +0.0%) 0.05x (base 0.05x, -0.3%) ok
hashMapChurn 4 1.00x (base 0.98x, +1.5%) 0.11x (base 0.12x, -7.3%) ok
stringBuilding 4 1.44x (base 1.43x, +0.6%) 0.27x (base 0.27x, -0.3%) ok
recursion 4 1.46x (base 1.46x, -0.1%) 0.06x (base 0.07x, -0.7%) ok
quicksort 4 1.00x (base 1.00x, -0.2%) 0.12x (base 0.12x, -0.2%) ok

Result: no regression

@github-actions

github-actions Bot commented Sep 26, 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)
    • ✅ backend: 0 findings (no issues)
    • ✅ build-hint-catalog: 0 findings (no issues)
    • ✅ build-hint-tools: 0 findings (no issues)
    • ✅ codenameone-maven-plugin: 0 findings (no issues)
    • ✅ core-unittests: 0 findings (no issues)
    • ✅ ios: 0 findings (no issues)
  • ❌ PMD: 1 findings (P4: 1) [HTML preview] [Download]
  • ✅ Checkstyle: 0 findings (no issues) [Report archive]

Generated automatically by the PR CI workflow.

@github-actions

github-actions Bot commented Sep 26, 2026 •

Copy link
Copy Markdown
Contributor

✅ ByteCodeTranslator Quality Report

Test & Coverage

  • ✅ Tests: 740 total, 0 failed, 57 skipped

Benchmark Results

  • Execution Time: 20801 ms

  • Hotspots (Top 20 sampled methods):

    • 6.45% java.util.ArrayList.indexOf (125 samples)
    • 5.78% com.codename1.tools.translator.IteratorEscape.ctorOnlyStoresParamsIntoThis (112 samples)
    • 5.16% com.codename1.tools.translator.BytecodeMethod.equals (100 samples)
    • 4.23% java.lang.StringBuilder.append (82 samples)
    • 2.68% com.codename1.tools.translator.JavascriptReachability.enqueueResolved (52 samples)
    • 2.63% java.lang.String.equals (51 samples)
    • 2.12% java.util.HashMap.hash (41 samples)
    • 1.81% java.lang.System.identityHashCode (35 samples)
    • 1.81% com.codename1.tools.translator.BytecodeMethod.optimize (35 samples)
    • 1.81% com.codename1.tools.translator.ByteCodeClass.hasDeclaredMethod (35 samples)
    • 1.65% org.objectweb.asm.tree.analysis.SourceInterpreter.merge (32 samples)
    • 1.55% com.codename1.tools.translator.IteratorEscape.walk (30 samples)
    • 1.34% com.codename1.tools.translator.NativeSymbolIndex.<init> (26 samples)
    • 1.34% org.objectweb.asm.tree.analysis.Analyzer.analyze (26 samples)
    • 1.34% com.codename1.tools.translator.IteratorEscape.mangle (26 samples)
    • 1.34% com.codename1.tools.translator.bytecodes.Invoke.findMethodUp (26 samples)
    • 1.19% java.util.HashMap.putVal (23 samples)
    • 1.19% java.io.FileOutputStream.writeBytes (23 samples)
    • 1.14% com.codename1.tools.translator.ByteCodeClass.generateCCode (22 samples)
    • 1.08% java.lang.Object.hashCode (21 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 Sep 26, 2026 •

Copy link
Copy Markdown
Collaborator Author

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

- Sessions: the session cookie goes on a copy of the handler's Response,
  never into it (it may be a shared constant); cn1.session.secure refuses
  anything but auto/true/false.
- TaskExecutor: virtual submissions are refused after shutdown and counted
  active before the hand-off; @async accessors re-fetch a shut-down executor.
- MCP: only loopback or listed origins pass (the Host match let DNS
  rebinding through); byte/short tool arguments are range-checked;
  backend_call uses https against a TLS server.
- Request metrics are recorded in a finally, so failures count and the
  route label is cleared.
- Factory beans inherit their configuration class's @Profile and
  @ConditionalOnProperty; request-scoped beans' destroyMethod runs.
- Scheduler lock: an INSERT failure with no existing row is rethrown.
- OTLP histogram bucket_counts stays fixed64 (per metrics.proto), now held
  by a test decoding with the generated opentelemetry-proto classes.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@shai-almog

shai-almog commented Sep 26, 2026 •

Copy link
Copy Markdown
Collaborator Author

Compared 157 screenshots: 157 matched.

Native Android coverage

  • 📊 Line coverage: 9.37% (9331/99611 lines covered) [HTML preview] (artifact android-coverage-report, jacocoAndroidReport/html/index.html)
    • Other counters: instruction 9.10% (47834/525841), branch 3.60% (1793/49819), complexity 3.57% (1898/53096), method 5.52% (1542/27918), class 11.04% (413/3742)
    • Lowest covered classes
      • kotlin.collections.kotlin.collections.ArraysKt___ArraysKt – 0.00% (0/6367 lines covered)
      • kotlin.collections.unsigned.kotlin.collections.unsigned.UArraysKt___UArraysKt – 0.00% (0/2384 lines covered)
      • org.jacoco.agent.rt.internal_0e20598.asm.org.jacoco.agent.rt.internal_0e20598.asm.ClassReader – 0.00% (0/1524 lines covered)
      • kotlin.collections.kotlin.collections.CollectionsKt___CollectionsKt – 0.00% (0/1187 lines covered)
      • org.jacoco.agent.rt.internal_0e20598.asm.org.jacoco.agent.rt.internal_0e20598.asm.MethodWriter – 0.00% (0/922 lines covered)
      • kotlin.sequences.kotlin.sequences.SequencesKt___SequencesKt – 0.00% (0/736 lines covered)
      • com.google.common.cache.com.google.common.cache.LocalCache$Segment – 0.00% (0/726 lines covered)
      • okio.okio.Buffer – 0.00% (0/687 lines covered)
      • kotlin.text.kotlin.text.StringsKt___StringsKt – 0.00% (0/625 lines covered)
      • org.jacoco.agent.rt.internal_0e20598.asm.org.jacoco.agent.rt.internal_0e20598.asm.Frame – 0.00% (0/570 lines covered)

✅ Native Android screenshot tests passed.

Native Android coverage

  • 📊 Line coverage: 9.37% (9331/99611 lines covered) [HTML preview] (artifact android-coverage-report, jacocoAndroidReport/html/index.html)
    • Other counters: instruction 9.10% (47834/525841), branch 3.60% (1793/49819), complexity 3.57% (1898/53096), method 5.52% (1542/27918), class 11.04% (413/3742)
    • Lowest covered classes
      • kotlin.collections.kotlin.collections.ArraysKt___ArraysKt – 0.00% (0/6367 lines covered)
      • kotlin.collections.unsigned.kotlin.collections.unsigned.UArraysKt___UArraysKt – 0.00% (0/2384 lines covered)
      • org.jacoco.agent.rt.internal_0e20598.asm.org.jacoco.agent.rt.internal_0e20598.asm.ClassReader – 0.00% (0/1524 lines covered)
      • kotlin.collections.kotlin.collections.CollectionsKt___CollectionsKt – 0.00% (0/1187 lines covered)
      • org.jacoco.agent.rt.internal_0e20598.asm.org.jacoco.agent.rt.internal_0e20598.asm.MethodWriter – 0.00% (0/922 lines covered)
      • kotlin.sequences.kotlin.sequences.SequencesKt___SequencesKt – 0.00% (0/736 lines covered)
      • com.google.common.cache.com.google.common.cache.LocalCache$Segment – 0.00% (0/726 lines covered)
      • okio.okio.Buffer – 0.00% (0/687 lines covered)
      • kotlin.text.kotlin.text.StringsKt___StringsKt – 0.00% (0/625 lines covered)
      • org.jacoco.agent.rt.internal_0e20598.asm.org.jacoco.agent.rt.internal_0e20598.asm.Frame – 0.00% (0/570 lines covered)

Benchmark Results

Detailed Performance Metrics

Metric Duration
SIMD kernel backend scalar fallback (no native SIMD)
SIMD int-add (64K x300) java 269ms / native 189ms = 1.4x speedup
SIMD float-mul (64K x300) java 187ms / native 114ms = 1.6x 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 72.000 ms
Base64 CN1 decode 85.000 ms
Base64 native encode 360.000 ms
Base64 encode ratio (CN1/native) 0.200x (80.0% faster)
Base64 native decode 274.000 ms
Base64 decode ratio (CN1/native) 0.310x (69.0% faster)
Image encode benchmark status skipped (SIMD unsupported)

@shai-almog

shai-almog commented Sep 26, 2026 •

Copy link
Copy Markdown
Collaborator Author

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

@shai-almog

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e31da12f35

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread vm/backend/src/com/codename1/backend/HttpSession.java Outdated
Comment thread vm/backend/src/com/codename1/backend/Backend.java Outdated
Comment thread vm/backend/src/com/codename1/backend/mcp/McpServer.java Outdated
Comment thread vm/backend/src/com/codename1/backend/Transactions.java Outdated
Comment thread vm/backend/src/com/codename1/backend/Sessions.java Outdated
Comment thread vm/backend/src/com/codename1/backend/Backend.java Outdated
Comment thread vm/backend/src/com/codename1/backend/otel/OtlpMetricExporter.java Outdated
Comment thread vm/backend/src/com/codename1/backend/Backend.java Outdated
Comment thread vm/backend/src/com/codename1/backend/Backend.java Outdated
@shai-almog

shai-almog commented Sep 26, 2026 •

Copy link
Copy Markdown
Collaborator Author

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

Benchmark Results

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

Build and Run Timing

Metric Duration
Simulator Boot 2000 ms
Simulator Boot (Run) 1000 ms
App Install 20000 ms
App Launch 18000 ms
Test Execution 453000 ms

Detailed Performance Metrics

Metric Duration
SIMD kernel backend SSE2 (x64) / NEON (arm64) native kernels
SIMD int-add (64K x300) java 130ms / native 5ms = 26.0x speedup
SIMD float-mul (64K x300) java 148ms / native 2ms = 74.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 203.000 ms
Base64 CN1 decode 140.000 ms
Base64 native encode 3046.000 ms
Base64 encode ratio (CN1/native) 0.067x (93.3% faster)
Base64 native decode 2559.000 ms
Base64 decode ratio (CN1/native) 0.055x (94.5% faster)
Base64 SIMD encode 297.000 ms
Base64 encode ratio (SIMD/CN1) 1.463x (46.3% slower)
Base64 SIMD decode 168.000 ms
Base64 decode ratio (SIMD/CN1) 1.200x (20.0% slower)
Base64 encode ratio (SIMD/native) 0.098x (90.2% faster)
Base64 decode ratio (SIMD/native) 0.066x (93.4% faster)
Image encode benchmark iterations 100
Image createMask (SIMD off) 31.000 ms
Image createMask (SIMD on) 7.000 ms
Image createMask ratio (SIMD on/off) 0.226x (77.4% faster)
Image applyMask (SIMD off) 1031.000 ms
Image applyMask (SIMD on) 637.000 ms
Image applyMask ratio (SIMD on/off) 0.618x (38.2% faster)
Image modifyAlpha (SIMD off) 84.000 ms
Image modifyAlpha (SIMD on) 887.000 ms
Image modifyAlpha ratio (SIMD on/off) 10.560x (956.0% slower)
Image modifyAlpha removeColor (SIMD off) 127.000 ms
Image modifyAlpha removeColor (SIMD on) 637.000 ms
Image modifyAlpha removeColor ratio (SIMD on/off) 5.016x (401.6% slower)

…lit the guide

Review fixes:
- Sessions, MCP tools and managed beans are per server (Backend.getSessions,
  Environment.registerTool/registerManaged, Builder.mcpTool); two servers in
  one process no longer share cookies, sessions or tools.
- @SessionScope beans are kept by the server for the session's lifetime and
  destroyed on invalidate, expiry and stop; a negative session timeout fails.
- Transactions: no process-wide default pool; a NESTED method before the
  first statement sets its savepoint after BEGIN. setRollbackOnly in the
  method that began the transaction rolls back without throwing.
- Backend.stop runs destroy callbacks once; a failed start destroys built
  beans; management routes precede application handlers; session-store
  failures are logged as 500s; metrics shutdown is bounded by its timeout.
- Weaving keeps synchronized on the body, so a synchronized @async method
  holds its monitor where it runs.
- Injection points and lifecycle methods inherited from base classes are
  wired; @ConditionalOnMissingBean matches the bean's exposed types and
  takes explicit ones.

Docs: the backend chapter is split into nine chapters (web, beans, data and
transactions, sessions, scheduling, observability, MCP, operations) with
diagrams and compiled samples.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@shai-almog

shai-almog commented Sep 26, 2026 •

Copy link
Copy Markdown
Collaborator Author

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

@shai-almog

shai-almog commented Sep 26, 2026 •

Copy link
Copy Markdown
Collaborator Author

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

Benchmark Results

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

Detailed Performance Metrics

Metric Duration
SIMD kernel backend SSE2 (x64) / NEON (arm64) native kernels
SIMD int-add (64K x300) java 83ms / native 3ms = 27.6x speedup
SIMD float-mul (64K x300) java 90ms / native 3ms = 30.0x speedup
SIMD kernel correctness PASS (native result == scalar reference)
Base64 native bridge unavailable (CN1 + SIMD + image benchmarks only)
Base64 payload size 8192 bytes
Base64 benchmark iterations 6000
Base64 SIMD byte path active (NEON-accelerated)
Base64 CN1 encode 44.000 ms
Base64 CN1 decode 56.000 ms
Image encode benchmark iterations 100
Image createMask (SIMD off) 8.000 ms
Image createMask (SIMD on) 4.000 ms
Image createMask ratio (SIMD on/off) 0.500x (50.0% faster)
Image applyMask (SIMD off) 61.000 ms
Image applyMask (SIMD on) 70.000 ms
Image applyMask ratio (SIMD on/off) 1.148x (14.8% slower)
Image modifyAlpha (SIMD off) 51.000 ms
Image modifyAlpha (SIMD on) 41.000 ms
Image modifyAlpha ratio (SIMD on/off) 0.804x (19.6% faster)
Image modifyAlpha removeColor (SIMD off) 40.000 ms
Image modifyAlpha removeColor (SIMD on) 48.000 ms
Image modifyAlpha removeColor ratio (SIMD on/off) 1.200x (20.0% slower)

ParparVM vs HotSpot (JDK 25): macOS arm64

Runner CPU: Apple M1 (Virtual) (baseline macos-arm64)

Ratios are ParparVM / JDK 25: below 1.00x ParparVM is faster (time) or smaller (RAM). Median of 5 interleaved, paired rounds; every run's output was verified. A regression is a ratio more than 15% (time) / 15% (RAM) above its baseline in vm/selfhost/perf-baseline.json (more, for a row whose calibration runs were noisier; the file records it), and for RAM also more than 0.05x above it in absolute terms. Both run unpinned on all of the runner's CPUs, with their own default thread counts.

Benchmark Cores Time RAM Status
hello (HelloCodenameOne) 3 0.76x (base 0.96x, -20.9%) 1.29x (base 1.34x, -3.6%) ok
translator (self) 3 0.50x (base 0.54x, -6.4%) 0.77x (base 0.74x, +4.8%) ok
intArithmetic 3 1.04x (base 1.03x, +0.9%) 0.12x (base 0.12x, -0.2%) ok
longArithmetic 3 1.00x (base 1.03x, -2.9%) 0.11x (base 0.11x, +0.4%) ok
mathTranscendental 3 0.93x (base 1.01x, -8.1%) 0.12x (base 0.12x, -1.6%) ok
arraySequential 3 0.45x (base 0.42x, +6.8%) 0.53x (base 0.53x, -0.3%) ok
arrayRandom 3 0.96x (base 0.99x, -3.1%) 0.32x (base 0.32x, -0.2%) ok
objectAllocation 3 4.28x (base 3.70x, +15.8%) 0.60x (base 0.48x, +25.6%) ok
valueEscape 3 0.50x (base 0.51x, -1.6%) 0.09x (base 0.09x, +4.9%) ok
hashMapChurn 3 1.06x (base 1.18x, -9.6%) 0.08x (base 0.07x, +14.3%) ok
stringBuilding 3 0.81x (base 0.84x, -3.9%) 0.47x (base 0.54x, -13.4%) ok
recursion 3 1.25x (base 1.24x, +0.8%) 0.12x (base 0.12x, -1.3%) ok
quicksort 3 0.98x (base 1.01x, -3.6%) 0.11x (base 0.11x, -2.0%) ok

Result: no regression

@shai-almog

shai-almog commented Sep 26, 2026 •

Copy link
Copy Markdown
Collaborator Author

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

Benchmark Results

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

Build and Run Timing

Metric Duration
Simulator Boot 87000 ms
Simulator Boot (Run) 1000 ms
App Install 21000 ms
App Launch 93000 ms
Test Execution 559000 ms

Detailed Performance Metrics

Metric Duration
SIMD kernel backend SSE2 (x64) / NEON (arm64) native kernels
SIMD int-add (64K x300) java 75ms / native 4ms = 18.7x speedup
SIMD float-mul (64K x300) java 72ms / native 2ms = 36.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 84.000 ms
Base64 CN1 decode 116.000 ms
Base64 native encode 2685.000 ms
Base64 encode ratio (CN1/native) 0.031x (96.9% faster)
Base64 native decode 3019.000 ms
Base64 decode ratio (CN1/native) 0.038x (96.2% faster)
Base64 SIMD encode 151.000 ms
Base64 encode ratio (SIMD/CN1) 1.798x (79.8% slower)
Base64 SIMD decode 243.000 ms
Base64 decode ratio (SIMD/CN1) 2.095x (109.5% slower)
Base64 encode ratio (SIMD/native) 0.056x (94.4% faster)
Base64 decode ratio (SIMD/native) 0.080x (92.0% 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) 493.000 ms
Image applyMask (SIMD on) 85.000 ms
Image applyMask ratio (SIMD on/off) 0.172x (82.8% faster)
Image modifyAlpha (SIMD off) 986.000 ms
Image modifyAlpha (SIMD on) 623.000 ms
Image modifyAlpha ratio (SIMD on/off) 0.632x (36.8% faster)
Image modifyAlpha removeColor (SIMD off) 55.000 ms
Image modifyAlpha removeColor (SIMD on) 39.000 ms
Image modifyAlpha removeColor ratio (SIMD on/off) 0.709x (29.1% faster)

@shai-almog

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 28cad305bb

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread vm/backend/src/com/codename1/backend/Tasks.java Outdated
Comment thread vm/backend/src/com/codename1/backend/Backend.java Outdated
Comment thread vm/backend/src/com/codename1/backend/CronSchedule.java
Comment thread vm/backend/src/com/codename1/backend/TaskExecutor.java
Comment thread vm/backend/src/com/codename1/backend/metrics/Histogram.java
Comment thread vm/backend/src/com/codename1/backend/Backend.java Outdated
Comment thread vm/backend/src/com/codename1/backend/Backend.java Outdated
@shai-almog

shai-almog commented Sep 27, 2026 •

Copy link
Copy Markdown
Collaborator Author

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

Benchmark Results

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

Detailed Performance Metrics

Metric Duration
SIMD kernel backend SSE2 (x64) / NEON (arm64) native kernels
SIMD int-add (64K x300) java 54ms / native 2ms = 27.0x speedup
SIMD float-mul (64K x300) java 63ms / native 5ms = 12.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 77.000 ms
Base64 CN1 decode 78.000 ms
Base64 native encode 844.000 ms
Base64 encode ratio (CN1/native) 0.091x (90.9% faster)
Base64 native decode 425.000 ms
Base64 decode ratio (CN1/native) 0.184x (81.6% faster)
Base64 SIMD encode 71.000 ms
Base64 encode ratio (SIMD/CN1) 0.922x (7.8% faster)
Base64 SIMD decode 67.000 ms
Base64 decode ratio (SIMD/CN1) 0.859x (14.1% faster)
Base64 encode ratio (SIMD/native) 0.084x (91.6% faster)
Base64 decode ratio (SIMD/native) 0.158x (84.2% faster)
Image encode benchmark iterations 100
Image createMask (SIMD off) 13.000 ms
Image createMask (SIMD on) 7.000 ms
Image createMask ratio (SIMD on/off) 0.538x (46.2% faster)
Image applyMask (SIMD off) 110.000 ms
Image applyMask (SIMD on) 86.000 ms
Image applyMask ratio (SIMD on/off) 0.782x (21.8% faster)
Image modifyAlpha (SIMD off) 87.000 ms
Image modifyAlpha (SIMD on) 74.000 ms
Image modifyAlpha ratio (SIMD on/off) 0.851x (14.9% faster)
Image modifyAlpha removeColor (SIMD off) 56.000 ms
Image modifyAlpha removeColor (SIMD on) 80.000 ms
Image modifyAlpha removeColor ratio (SIMD on/off) 1.429x (42.9% slower)

- Executors belong to the server that opened them: request, task,
  scheduler and start-up threads carry it, stopping one server no longer
  shuts down another's, and generated @async code looks the executor up
  per call. At the shutdown deadline queued tasks are dropped rather than
  run against destroyed beans, and running ones are interrupted; a virtual
  task a host cannot run falls back to its own executor.
- Every server applies cn1.session.* (handler-only ones sent a TLS
  session cookie without Secure); a failing request still stores its
  session so its session beans are kept or destroyed.
- Request beans are destroyed while their request is still current;
  @PreDestroy runs subclass before superclass; factory beans run
  inherited lifecycle methods.
- Health reports STARTING until the start-up hook returns.
- A cron time inside a DST gap is skipped instead of firing an hour late.
- The metrics exporter can be reopened; histograms copy and validate
  their bounds and labels.
- A managed resource must be a singleton and cannot overload operations.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@shai-almog

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d4d761e707

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread vm/backend/src/com/codename1/backend/Backend.java
Comment thread vm/backend/src/com/codename1/backend/Sessions.java
Comment thread vm/backend/src/com/codename1/backend/Sessions.java Outdated
Comment thread vm/backend/src/com/codename1/backend/Transactions.java Outdated
Comment thread vm/backend/src/com/codename1/backend/CronSchedule.java Outdated
Comment thread vm/backend/src/com/codename1/backend/mcp/DevTools.java
@shai-almog

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

seedIds();
exporter = new BatchExporter(endpoint, headers, protobuf, resource, queue, batch,
delay, relayBytes * 4L);

P2 Badge Reject concurrent reuse of one tracer instance

When two live builders are given the same OtlpTracer, the second open() replaces this instance's exporter while the first export thread remains alive. Spans from both servers then enqueue through the new exporter, and stopping either backend shuts that exporter down; Tracing also records the shared tracer only once in its owned set, so the other live server loses tracing. Refuse an already-open tracer instance, or maintain independent per-open state rather than overwriting the live fields.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread vm/backend/src/com/codename1/backend/Sessions.java
Comment thread vm/backend/src/com/codename1/backend/Backend.java Outdated
…lly, interface aspects refused

- The memory store answers a lookup only when the session still has that id:
  a login's changeSessionId() retires the old, possibly planted id at once,
  as a servlet container does, instead of when the login request saves. An
  undone rotation restores the id and the entry answers again.
- Request-scoped beans that a @PreDestroy builds are destroyed however deep
  the chain goes (bounded), not just one pass further.
- @transactional, @async, @timed or @counted on a project interface -- on a
  default method, an abstract one, or the type -- is a build error: the build
  weaves classes, and the annotation was silently applied to nothing.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@shai-almog

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 035be3064b

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread vm/backend/src/com/codename1/backend/HttpServer.java
…s in Spring

- Backend.start() refuses a second live Backend in the same process (a
  stopping one is waited for, so stop-then-start still works). Scaling out is
  more processes -- sessions in the JDBC store, job locks in the database --
  and the runtime's process-wide state (tracer, metrics and exporter, default
  executors, virtual-thread hosts) assumes one server. The tests that exercised
  two concurrent servers are removed; one test pins the rule.
- A required dependency whose candidates are all conditional is checked at
  start, as Spring checks it (Wiring.single names the injection point); the
  developer guide no longer claims the build proves coverage.
- A @scheduled method returning a Future builds with a warning: its return is
  ignored, as in Spring, and the run ends when the method returns.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@shai-almog

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 5b45f82f5d

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread vm/backend/src/com/codename1/backend/HttpServer.java Outdated
Comment thread vm/backend/src/com/codename1/backend/Backend.java
shai-almog and others added 2 commits September 29, 2026 10:35
… names, full termination; build on master

- Moved method bodies are named per declaring class, so a same-package
  subclass's woven override no longer overrides the base class's body: an
  explicit super.foo() runs the base body instead of recursing.
- stop() called from a virtual @async task no longer waits out the drain for
  its own host: each virtual task records the host it runs on.
- Two beans of one class with @scheduled methods (two @bean factories) get
  their jobs named by bean, as Spring schedules each, instead of refusing
  the start with a duplicate name.
- awaitTermination() also waits for a deferred teardown, so a process does
  not exit while @PreDestroy and the pool close are still running.
- The wake-pipe native reads the array payload through CN1_ARRAY_DATA:
  master's 4-byte header (#5903) removed the data pointer.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@shai-almog

Copy link
Copy Markdown
Collaborator Author

@codex review

shai-almog added a commit that referenced this pull request Sep 29, 2026
…yTest flake

check-ablation-arms swept CN1_HAVE_DLL_INTRINSICS as a -D arm, but like
CN1_HAVE_SB_INTRINSICS it is defined by cn1_intrinsics.h when the translation
carries dart_core_DartLongList.h, and forcing it without that header cannot
compile.

TelemetryTest: the same change as 98e65a7 on backend-spring-model (#5908).
An earlier test's queued export reached the collector mock after the
connections were cleared, and the traceparent test accepted any span.
Applied identically so the two branches merge cleanly.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3acab79911

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread vm/backend/src/com/codename1/backend/Backend.java
Comment thread vm/backend/src/com/codename1/backend/HttpServer.java Outdated
Comment thread vm/backend/src/com/codename1/backend/Backend.java Outdated
…start cursor, slot released

- Woven body names carry the declaring class's own name, not its hash, and
  support-class names encode `_` and `$` injectively: two classes whose names
  shared a hash (Aa, BB), or Outer_Inner and Outer$Inner, no longer get one
  name -- a recursing super call, or one helper replacing the other.
- A file response replaced by a 500 because the session could not be stored
  closes its descriptor; only the writer closed it before.
- The virtual-task host cursor is reduced to the current server's host count,
  so a restart with fewer hosts does not index past its array.
- A stopped Backend frees the process slot, so its destroyed beans and
  sessions are not kept reachable until the next start.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@shai-almog

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f930488ec3

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

… runs synchronously

- Support-class names escape `_` as `__` and `$` as `_S`, so no two class
  names meet (A$_B and A_$B collided under the previous scheme).
- Scoped and lazy stand-ins are named per bean: two @bean methods of one
  class, both request-scoped, each get their own instead of one source
  replacing the other.
- A stand-in whose bean's constructor calls an overridable method runs the
  bean's own code during construction rather than dereferencing a scope that
  is not assigned yet.
- @async on @PostConstruct or @PreDestroy is not applied, with a warning, as
  Spring calls lifecycle methods on the bean itself: the server no longer
  becomes ready before initialisation, and a @PreDestroy body still runs.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@shai-almog

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 030a2feef3

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread vm/backend/src/com/codename1/backend/Backend.java Outdated
shai-almog and others added 6 commits September 29, 2026 15:26
…tate fault twin may wedge

Review:
- A request's scoped beans are destroyed even when serialising the deferred
  JSON body throws: the array was taken first, and every later pass found
  nothing to destroy.
- @Profile("!") (an empty negated name) is a build error; it activated the
  bean under every profile.
- A @PostConstruct or @PreDestroy returning a Future builds with a warning:
  the return is ignored, as in Spring, and the server goes on when the method
  returns.

Gates:
- perf-baseline.json: the windows-x64 AMD family 25 model 1 rows are
  recalibrated with calibrate-perf-baseline.py from the six calibration runs
  of #5903 plus this branch's run, which changes nothing in the VM. Its
  arrayRandom rounds spanned 1.06-1.49 inside one run (median 1.38 against a
  0.97 baseline) -- runner noise the row's 25% tolerance could not absorb; the
  row is now 1.061 with 45%, the script's own rule for the observed spread.
- GcSteadyStateIntegrationTest scenario 4 builds the reserve OUT
  (-DCN1_PACING_NO_RESERVE) to prove scenario 3 can fail. That deliberately
  broken build can wedge on the admission margin instead of finishing, and the
  gate required it to finish, so it failed on a slow runner (footprint
  745MB of a 768MB budget, no cycles, no reserve parks). A wedge is now
  accepted as the demonstration, checked from the per-second probe: headroom
  under the threshold and no reserve parks. A finishing run is held to the
  same assertions as before.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
… session store

- Remove every hand-wired server from the guide (ServerSnippets, raw
  HttpServer.start/serveForever, installByHand, mcpTool builder); the build
  writes the entry point and that is the only supported shape.
- Promote java.util.concurrent Future/ExecutionException/TimeoutException/
  CancellationException/TimeUnit (and Properties) to documented backend API:
  rendered in the backend javadoc, gated by check-backend-jdk-surface.py
  (which also scans the guide's demos), and exercised on ParparVM by
  SelfTest.futures().
- Session store value "jdbc" -> "db"; diagrams clarified (no bare "null",
  fixedRate vs fixedDelay with varied run lengths).
- ParparVM virtual threads are not Java 21 ones; say so.
- Correct doc claims the audit found false: CN1_ prefixed env names,
  multi-server passages (one backend per process), @scheduled scope rules,
  management "always on in dev", injected DataSource instead of
  DataSource.open(getenv), PushFeedback on the backend Json and injection.
- Document the missing cn1.otel.* keys and CN1_HTTP_MAX_UPLOAD_MB.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…ations

- Backend no longer names Management or McpServer. Only the builder's
  management() and mcp() do, and the generated entry point calls them only
  when the build asked (@enablemanagement / @EnableMcpServer / an @mcptool /
  a literal cn1.*.enabled=true in any application*.properties, or a dev
  build). The translator drops the uncalled builder method and the classes
  with it; BackendOtelTest now asserts from nm that a server that never asked
  carries neither, against a control that links both.
- Typed settings annotations -- @serverconfig, @SessionConfig,
  @DataSourceConfig, @StaticFilesConfig, exporter settings on
  @opentelemetry, paths on the Enable* ones -- compiled in as the bottom
  configuration layer (Config.withCompiledDefaults), under the files and the
  environment. Values the runtime would refuse, and two classes disagreeing,
  are build errors naming the class.
- OtlpTracerTest.partialSuccessIsCounted waited on a flush that could run
  before the request's span was queued (the span ends after the response is
  written); it now waits for the span first.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…as JSON

A route may now return an entity or DTO (and collections or String-keyed
maps of them) and take one as @RequestBody, as a Spring controller does
through Jackson. The build writes a <Name>Cn1Json codec per class -- plain
code, no reflection -- in the app's @mapped JSON form, so a class shared by
app and backend round-trips: fields (public directly, others via bean
accessors), @JsonProperty/@JsonIgnore (now shared with the backend), Date as
epoch millis (read from millis or ISO-8601), byte[] base64, enums by name,
subclasses written as themselves, unknown members ignored.

- A body the codec refuses is a 400 naming the path
  ($.lines[0].quantity: expected ...); a response nesting past 64 objects
  (a cycle) is a 500 pointing at @JsonIgnore.
- Generic type-variable fields, body classes without a no-arg constructor,
  interfaces, arrays other than byte[], and runtime types such as
  HttpServer.Response inside a list stay build errors, with the reason.
- HttpServer renders a deferred JSON body before the write, into the same
  buffer, so a throw there (a Writable, a codec) is answered 500 and recorded
  as the handler's failure instead of dropping the connection unanswered.
- The guide's order example is compiled from the guide's own files and run
  end to end by BackendBeansTest.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…host

A virtual thread used to park only on the socket it served. An outbound
read -- a PostgreSQL or MySQL query, a Web call, a TLS handshake -- did a
blocking recv() on the host pthread, and with one host per core that many
slow calls stopped the server answering anything.

- Native: a per-virtual-thread wait record (descriptors, events, timeout)
  and cn1BackendVtWait/cn1BackendAwaitFd; resume answers WAITING (3) for
  it. Outbound Tcp descriptors stay non-blocking for life and every wait
  (connect, read, write, TLS handshake/read/write) parks on a virtual
  thread and polls anywhere else, so platform threads behave as before.
  SO_RCVTIMEO/SO_SNDTIMEO become the wait's deadline. Web drives libcurl
  through the multi interface on a virtual thread.
- Host: WAITING registers the descriptors with the host's own poller for
  exactly the wait, wakes on readiness or deadline, and the stop drain
  keeps pumping tasks that wait on outbound I/O.
- Docs/javadoc/skill: network databases, Web and TLS are fine on VIRTUAL;
  SQLite, file access, host-name resolution and Object.wait still block.
- Tests: SelfTest (Tcp, Web, TLS handshake, TLS read, read deadline) and
  DbCheck (pg_sleep / SLEEP against a one-host server) prove another
  request is served while the call waits; both fail with the old
  blocking wait.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
- The seven AvoidUsingHardCodedIP findings are loopback and wildcard
  literals that recognise or bind the local interface and dial nothing;
  each carries a //NOPMD with that reason, the convention ServerSocket and
  Credentials already use. The OwnRoute overrides get @OverRide.
- SelfTest exercises JsonCodec on the translated runtime: range and
  fraction refusals with their paths, dates from millis and ISO-8601 with
  offsets and fractions, an impossible date refused, base64, writeDate.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@shai-almog

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 903a18fb09

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread vm/backend/src/com/codename1/backend/JsonCodec.java Outdated
Comment thread vm/backend/src/com/codename1/backend/mcp/McpServer.java Outdated
Comment thread vm/backend/src/com/codename1/backend/mcp/McpServer.java
…and paths

- An Object or raw Map/List field is written by its run-time class through a
  generated cn1app.JsonValues: a class the build writes goes through its
  codec, Date as millis, enums by name, JDK shapes through Json; any other
  class is a 500 instead of its toString().
- A TreeSet body needs a Comparable element; refused at build time otherwise.
- readLong bounds a fractional-free double by 2^63 before converting, so
  9223372036854775808.0 is refused instead of clamped to Long.MAX_VALUE.
- MCP and management match the canonical path (pathFrom), as the routers,
  static files and relay do: /%6dcp is /mcp.
- MCP answers an allowed origin's CORS preflight before authentication and
  names the origin on every reply to it (new Response.header).
- The guide's order example uses one source block per include, which the
  snippet validator requires.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@shai-almog

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 8a415127f0

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +1206 to +1209
return pool.execute("DELETE FROM " + TABLE + " WHERE max_inactive > 0 AND "
+ "(last_accessed + max_inactive * 1250.0 < ? OR "
+ "last_accessed + max_inactive * 1000.0 + " + TOUCH_INTERVAL + " < ?) "
+ "AND namespace = ?" + spare.toString(), params.toArray());

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Protect sessions active on another replica from purge

When replicas share this DB store, busy contains only sessions used by the current process. A request on replica A can load a session near the end of its expiry grace and continue running while replica B executes this delete; once the remaining grace elapses, B removes the row even though A is still using it. A's later save() sees no row and returns without restoring it, so its changes are lost and the client's next request is signed out. The DB store needs a cross-replica lease/touch strategy rather than relying solely on the local busy exclusion.

Useful? React with 👍 / 👎.

Comment on lines +1500 to +1502
if (ok) {
bean.tools.add(tool);
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Validate MCP tool return values before registration

When an @McpTool returns an ordinary application DTO, or a container holding one, this accepts the method after validating only its parameters. McpServer.callTool() subsequently passes the value to Json.write(), whose fallback serializes unknown objects as a quoted toString() value such as "com.example.Order@...", so the agent receives bogus text instead of the promised JSON object. Reject unsupported return shapes here or route them through the generated DTO codecs.

Useful? React with 👍 / 👎.

Comment on lines +267 to +269
Database opened;
try {
opened = Database.open(url);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Open pooled connections outside the pool monitor

On the packaged virtual-thread server, an on-demand Database.open() can now park during TCP connect, authentication, or setup, but borrowFromPool() is synchronized and therefore retains the data-source monitor across this call. The host may then run another virtual request that tries to borrow from the same pool and blocks the OS host acquiring that monitor; because virtual threads have host affinity, the parked opener cannot resume on another host to release it, and concurrent requests can wedge every host on the same monitor. Reserve pool capacity under the lock and perform the blocking/parking open outside it; the exhausted-pool wait() path likewise needs a cooperative virtual-thread wait.

Useful? React with 👍 / 👎.

Comment on lines +1477 to +1480
if (!toolArgument(args[i])) {
ctx.error(cls, "Parameter " + (i + 1) + " of @McpTool " + where + " is a "
+ args[i].getClassName() + "; a tool argument is a String, a "
+ "number, a boolean, an enum, a Map or a List.");

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Validate generic MCP collection element types

When a tool parameter is declared as List<Integer>, Map<String, MyDto>, or another parameterized collection, this check sees only the erased ASM type and accepts it. The generated adapter then returns the parser's raw collection unchanged; JSON integers are Long values and JSON objects are Map values, so the tool body encounters ClassCastException when it reads the declared elements and otherwise-valid calls can never succeed. Inspect the generic parameter signature and recursively convert supported elements, or reject shapes the adapter cannot materialize.

Useful? React with 👍 / 👎.

Comment on lines +460 to +464
long now = databaseNow();
long until = AsyncTask.deadline(now, job.lockAtMostFor);
int updated = locks.execute("UPDATE " + LOCK_TABLE + " SET lock_until = ?, locked_at = ?, "
+ "locked_by = ? WHERE name = ? AND lock_until <= ?",
new Object[] {Long.valueOf(until), Long.valueOf(now), lease, job.lock, Long.valueOf(now)});

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Start scheduler leases when the claim is written

When a replica is delayed after databaseNow()—for example while waiting for a pool connection or an UPDATE lock—and that delay reaches lockAtMostFor, the later UPDATE or INSERT stores an already-expired lock_until but this method still returns a lease. Another replica can immediately claim the same row while the first proceeds into the job, so a job can overlap before its body has even consumed its configured lease. Derive the expiry from database time in the claim statement or transaction, or reject a claim whose lease is no longer live.

Useful? React with 👍 / 👎.

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