Repository navigation
feat: [SDK-5374] add sessions API backend client - #2775
Conversation
📊 Diff Coverage ReportDiff Coverage Report (Changed Lines Only)Gate: aggregate coverage on changed executable lines must be ≥ 80% (JaCoCo line data for lines touched in the diff). Changed Files Coverage
Overall (aggregate gate)50/50 touched executable lines covered (100.0% — requires ≥ 80%) |
There was a problem hiding this comment.
Multi-model review
Claude Opus 5.5, GPT 5.6 Sol, and Grok 4.7 reviewed 10a61054...9d345ceb (sessions API backend client).
Act on (3/3): classifyFailure retries only status 0. HttpClient leaves httpResponse at -1 for ConnectException, UnknownHostException, and socket timeouts, so those become Drop(-1) and offline create/update never retry. NetworkUtils.getResponseStatusType treats unknown codes including -1 as RETRYABLE. Tests only pin 0. Treat code <= 0 (or throwable != null) as Retry and add a -1 case.
Consider (2/3): safeString + Android JSONObject.getString turns "session_id": null into Success("null"), then later PATCH .../sessions/null 404s and drops. Reject isNull / non-string ids.
Consider (2/3): a 2xx with an unparseable body is Drop, so an idempotent create that already landed (or a captive-portal HTML 200, same class of bug as SDK-4478) never recovers the session id. Prefer Retry for unparseable success; keep Drop for real 4xx.
Noted: consent-not-given is HttpResponse(0) → Retry(0, null); the future caller needs its own backoff. Path segments are unencoded, matching other backend services.
Sent by Cursor Automation: PR Reviews
|
Addressed the review in 3c3de96:
|
3c3de96 to
2a2b5f1
Compare
sherwinski
left a comment
There was a problem hiding this comment.
- nit: ISessionsBackendService.kt:27:
CreateSessionRequest.subscriptionIdis non-null whileSessionModel.subscriptionIdis nullable. - nit: SessionsBackendService.kt:38: a
202with no session ID returnsRetry(202, null), which might read weird in logs
2a2b5f1 to
0cbdd86
Compare
|
nan-li
left a comment
There was a problem hiding this comment.
Is the open questions in the PR description confirmed?
Ah thanks, theyre addressed. Device type is an int, and I added use of toIso8601 for start_time and end_time |
abdulraqeeb33
left a comment
There was a problem hiding this comment.
RFC3339 fix confirmed. Paths, field names, device_type and the 202 handling match sessions-http/openapi.yaml.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…to the caller Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
3d12bb3 to
ca3be87
Compare


Description
One Line Summary
Add
SessionsBackendServiceforPOST /apps/{app_id}/sessionsandPATCH /apps/{app_id}/sessions/{session_id}.Details
Motivation
Typed request/response layer for the public sessions API, used by the upcoming persistent queue (SDK-5378).
Scope
ISessionsBackendService/SessionsBackendServiceonIHttpClient, registered inSessionModule.BackendException(status, payload,Retry-After) on failure and leaves retry classification to the executor.createSessionreturns the session ID, or null if a success response has no usabledata.session_id.start_time/end_timeare sent as ISO 8601 UTC strings anddevice_typeas an int, per the tech spec.Retry-Aftercomes fromHttpClient, which already falls back to a default on429without the header.Testing
Unit testing
SessionsBackendServiceTests: request bodies (with and without optional fields),202parsing, malformed create responses,BackendExceptionwith status andRetry-Afteron failure.Manual testing
Not tested on device; no callers yet.
Affected code checklist
Checklist
Overview
Testing
Final pass
🤖 Generated with Claude Code