Category: spec-conformance Severity: minor
Location: Sources/ARCP/Runtime/JobManager.swift:304-318, 354-359
Spec: ARCP v1.1 §7.4
What
Two issues in one path. (1) handleInterrupt returns silently when the target job is unknown — no cancel.refused/nack — so a client that interrupts a finished or unknown job waits forever with no signal. (2) Both handlers resolve the job by jobs.keys.first(where: { $0.rawValue == payload.targetId }) (O(n) linear scan) instead of constructing JobId(payload.targetId) and a dictionary lookup. The scan is also subtly wrong: it cannot distinguish "job belongs to another session" from "no such job", which matters once cross-session targeting is possible.
Evidence
guard payload.target == .job,
let jobId = jobs.keys.first(where: { $0.rawValue == payload.targetId })
else {
return // handleInterrupt: silent no-op, no ack/refusal to the client
}
Proposed fix
- Replace the linear scan with
let jobId = JobId(payload.targetId); guard let record = jobs[jobId] else { ...send refusal... }.
- In
handleInterrupt, send a cancel.refused (or nack) with NOT_FOUND when the target is unknown, mirroring handleCancel.
Acceptance criteria
Category: spec-conformance Severity: minor
Location:
Sources/ARCP/Runtime/JobManager.swift:304-318,354-359Spec: ARCP v1.1 §7.4
What
Two issues in one path. (1)
handleInterruptreturns silently when the target job is unknown — nocancel.refused/nack — so a client that interrupts a finished or unknown job waits forever with no signal. (2) Both handlers resolve the job byjobs.keys.first(where: { $0.rawValue == payload.targetId })(O(n) linear scan) instead of constructingJobId(payload.targetId)and a dictionary lookup. The scan is also subtly wrong: it cannot distinguish "job belongs to another session" from "no such job", which matters once cross-session targeting is possible.Evidence
Proposed fix
let jobId = JobId(payload.targetId); guard let record = jobs[jobId] else { ...send refusal... }.handleInterrupt, send acancel.refused(ornack) withNOT_FOUNDwhen the target is unknown, mirroringhandleCancel.Acceptance criteria