Category: refactor Severity: major
Location: arcp-runtime/src/main/java/dev/arcp/runtime/session/SessionLoop.java:1-922
What
At 922 lines (threshold 800) SessionLoop mixes at least six responsibilities — handshake/auth, heartbeat scheduling, job submission + execution lifecycle (runJob + the inline JobContext), idempotency fingerprinting, subscribe fan-out, list-jobs paging, and envelope encoding/send — concentrating most of the runtime's logic in a single hard-to-test type.
Evidence
public final class SessionLoop implements Flow.Subscriber<Envelope> {
// 922 lines: handshake, dispatch, heartbeat, job lifecycle, idempotency,
// subscribe fan-out, credential rotation, list-jobs paging, and wire send.
Proposed fix
Extract cohesive collaborators: a handshake/auth helper, a heartbeat controller, a job-execution driver (runJob + JobContext), a list-jobs query/paging helper, and the idempotency fingerprint computation. Keep SessionLoop as the dispatch coordinator.
Acceptance criteria
Category: refactor Severity: major
Location:
arcp-runtime/src/main/java/dev/arcp/runtime/session/SessionLoop.java:1-922What
At 922 lines (threshold 800)
SessionLoopmixes at least six responsibilities — handshake/auth, heartbeat scheduling, job submission + execution lifecycle (runJob+ the inlineJobContext), idempotency fingerprinting, subscribe fan-out, list-jobs paging, and envelope encoding/send — concentrating most of the runtime's logic in a single hard-to-test type.Evidence
Proposed fix
Extract cohesive collaborators: a handshake/auth helper, a heartbeat controller, a job-execution driver (
runJob+JobContext), a list-jobs query/paging helper, and the idempotency fingerprint computation. KeepSessionLoopas the dispatch coordinator.Acceptance criteria
SessionLoop.javais under 800 lines and each extracted responsibility lives in its own cohesive type with its own tests.