Refactor/automation#19
Merged
Merged
Conversation
Pass 6 of lint cleanup. ESLint errors: 48 -> 40. - handleJobSubmit (163 lines, complexity 31) split into a top-level pipeline (rejectIfOverConcurrencyCap -> resolveSubmitAgent -> validateLeaseAndConstraints -> checkIdempotency -> acceptAndDispatchSubmit) plus dedicated helpers for each stage. - runHandler (110 lines, 6 params, complexity 20) -> options bag (RunHandlerArgs) + extracts scheduleRuntimeTimeout, runAndEmitResult, emitHandlerFailure, wrapHandlerError, scheduleLeaseExpiry. - createDelegateJob (94 lines, complexity 15) -> resolveDelegateAgent, validateDelegateLease, constructDelegateChild. - wrapJobCtx (4 params) -> WrapJobCtxArgs options bag. - New sibling job-runner-helpers.ts holds the module-level error emitters, the runtime/lease timer helpers, validateDelegateLease, wrapJobCtx, and forwardEventToSubscriber (re-exported from job-runner.ts for back-compat). job-runner.ts: 565 -> 546 lines. job-runner-helpers.ts: 247 lines (new). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Pass 7 of lint cleanup. ESLint errors: 40 -> 26. - Extract makeHandleFromInvocation + InvocationState to client-handle.ts. - Extract dispatchRaw + routeJobEvent + per-type handlers (session.welcome / session.error / session.ping / session.jobs / job.subscribed / job.accepted / job.event / job.result / job.error) to client-dispatch.ts. dispatchRaw shrinks from 115 lines / complexity 39 to a thin delegator. - Extract envelope builders (hello / submit / subscribe / unsubscribe / bye) to client-envelopes.ts. - Inline ARCPClient methods become single-purpose: connectInternal -> wireTransport + buildAdvertisedCapabilities + awaitHandshake + rejectHandshakeForAbort; submit -> registerSubmitInvocation + wireSubmitAbort; close -> rejectAllPending + clearAutoAckTimer + sendBye. client.ts: 856 -> 612 lines (logical 446). 0 violations for client.ts. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Pass 8 of lint cleanup. ESLint errors: 26 -> 1 (file-size only). SessionContext: - send (63 lines, complexity 24, depth 4) split into persistOutbound + fanOutToSubscribers + forwardEnvelopeToSubscriber + maybeEmitBackPressure. - dispatchRaw (94 lines, complexity 20) split into parseInboundFrame + dropPreHandshakeNonHandshake + dedupeInbound + validateInbound + handleUnknownTypeDisposition + invokeHandler. ARCPServer: - handleSessionHello (74 lines) split into authenticateHello + acceptFreshSession + buildWelcomePayload. - handleResume (88 lines, complexity 15) split into validateResumeRecord + rebindResumedSession + rotateResumeToken + sendResumeWelcome + replayResumeEvents. - registerPostHandshakeHandlers (77 lines) split into registerJobLifecycleHandlers + registerSessionControlHandlers + registerListJobsHandler + registerSubscriptionHandlers. - handleJobCancel (48 lines) split into emitCancelTargetMissing + scheduleCancelGrace. - handleListJobs (82 lines, complexity 33) split into buildListJobsCandidates plus new list-jobs.ts module (compileListJobsFilter, compareJobListEntries, paginateJobList). - handleJobSubscribe (92 lines, complexity 21, depth 5) split into authorizeSubscribe + registerSubscriber + replaySubscribeHistory. Client-dispatch: - onSessionError (complexity 12) split into rejectAllInvocations + rejectAllPendingMaps. Removed unnecessary Deferred<unknown> casts. Remaining: server.ts file-size (1115 lines vs 500 cap) — addressed in the next commit by extracting SessionContext to its own module. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…odules Pass 8 (final). ESLint errors: 1 -> 0. - Extract SessionContext class to session-context.ts (455 logical lines). Server.ts re-exports it. Internal usage uses an aliased import (SessionContextCtor) so unicorn/prefer-export-from is satisfied without disabling. - Extract handleListJobs + handleJobSubscribe + helpers to server-subscribe.ts as free functions taking ARCPServer first. - Extract handleResume + helpers (validateResumeRecord, rebindResumedSession, rotateResumeToken, sendResumeWelcome, replayResumeEvents) to server-resume.ts. handleResume + helpers use options-bag args so each stays under max-params 3. - Make resumeStore, sessions, buildWelcomePayload, registerPostHandshakeHandlers, makeNegotiatedCapabilities, bindLogger public on ARCPServer so the new sibling modules can call them. - handleJobSubscribe split (extract maybeReplaySubscribeHistory) so the function stays under max-lines-per-function 40. server.ts: 1115 -> 467 logical lines. All gates green: pnpm lint (biome + eslint) clean, pnpm typecheck clean, pnpm test all passing (105+), check:cycles clean, check:attw clean, check:publint clean. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…issues) Planning and refactor planning content has moved to per-repo GitHub issues. The 'v0.1 release-readiness' epics (#2-#9) and 'v1.1 implementation roadmap' is now tracked as issues going forward.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.