Skip to content

Fix JSON-RPC correctness bugs and implement loadProblem - #6

Merged
wadoon merged 4 commits into
mainfrom
fix/java-rpc-correctness
Jun 29, 2026
Merged

Fix JSON-RPC correctness bugs and implement loadProblem#6
wadoon merged 4 commits into
mainfrom
fix/java-rpc-correctness

Conversation

@unp1

@unp1 unp1 commented Jun 22, 2026

Copy link
Copy Markdown
Member

Fixes five correctness bugs in the KeY JSON-RPC server (keyext.api) and the hand-rolled Java client (keyext.api.client), and implements loadProblem:

  • loadProblem previously returned a future resolving to null (NPE-ing callers). Now implemented: a ProblemDefinition (sorts/functions/predicates + antecedent/succedent sequent) is rendered to a .key document — the sequent encoded as (a1 & … & an) -> (s1 | … | sm) — and loaded through the existing .key path.
  • clientApi NPE racenull until setClientApi ran, so startup callbacks could NPE. Now initialised to a no-op ClientApi, swapped for the real proxy on connect.
  • KeyIdentifications — plain HashMaps under multi-threaded request dispatch could lose updates / throw ConcurrentModificationException; now ConcurrentHashMaps.
  • RPCLayer queueadd() threw IllegalStateException (killing the reader thread) on a full queue; now put() for back-pressure.
  • RPCLayer partial reads — a single read() could truncate a message on a socket; now loops until the full message or EOF.

Tests (run against KeY 3.0.0-SNAPSHOT): new RPCLayerTest cases (partial reads, back-pressure), KeyApiImplTest (loadProblem rendering + end-to-end load incl. abstract sorts), KeyIdentificationsTest (concurrent register/query via Mockito). Also wired JUnit into the client module and repaired its stale test sources so the suite compiles. All green.

PR has been created with AI tooling

@wadoon
wadoon merged commit fb665f1 into main Jun 29, 2026
3 checks passed
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.

2 participants