Skip to content

SessionLoop.java exceeds the file-length threshold (922 > 800 LOC) #80

@nficano

Description

@nficano

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

  • SessionLoop.java is under 800 lines and each extracted responsibility lives in its own cohesive type with its own tests.

Metadata

Metadata

Assignees

No one assigned

    Labels

    audit/refactorOversized/structural refactor (audit)sev/majorLikely defect or structural break

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions