Skip to content

feat: add remote result API contract - #143

Merged
delete-cloud merged 1 commit into
mainfrom
feat/remote-result-api-contract
May 13, 2026
Merged

delete-cloud merged 1 commit into
mainfrom
feat/remote-result-api-contract

Conversation

@delete-cloud

@delete-cloud delete-cloud commented May 13, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • add ADR-0024 result/diff/patch/publish response schemas
  • add session-scoped HTTP result publication contract routes
  • keep diff, patch, and publish fail-closed with explicit 501 responses until implementation lands
  • add HTTP contract tests for result shape, ownership hiding, missing sessions, and unsupported operations

Validation

  • uv run pytest tests/ui/test_http_server.py -k "RemoteResultPublicationContract" -q
  • uv run pytest tests/ui/test_http_server.py -k "RemoteResultPublicationContract or GetSession or workspace_archive" -q
  • uv run pytest tests/ui/test_http_server.py tests/ui/test_http_server_workspace_transfer.py tests/cli/test_remote_client.py -k "session_result or workspace_diff or workspace_patch or publish or RemoteResultPublicationContract or workspace_archive or remote" -q
  • uv run basedpyright --level error src/coding_agent/ui/schemas.py src/coding_agent/ui/http_server.py tests/ui/test_http_server.py
  • uv run ruff format --check src/coding_agent/ui/schemas.py src/coding_agent/ui/http_server.py tests/ui/test_http_server.py
  • git diff --check

Summary by CodeRabbit

  • New Features
    • Added REST API endpoints to retrieve session results with workspace context and verification details.
    • Added placeholder endpoints for workspace diff, patch, and publish operations (not yet implemented).
    • Enhanced authorization checks to ensure secure access to session data across all endpoints.

Review Change Stack

@coderabbitai

coderabbitai Bot commented May 13, 2026 •

Copy link
Copy Markdown
Contributor

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: dfaade55-018f-484f-abf4-5763aeddd9c8

📥 Commits

Reviewing files that changed from the base of the PR and between bca687e and 0a2a15b.

📒 Files selected for processing (3)
  • coding-agent/src/coding_agent/ui/http_server.py
  • coding-agent/src/coding_agent/ui/schemas.py
  • coding-agent/tests/ui/test_http_server.py

📝 Walkthrough

Walkthrough

The PR adds REST endpoints for retrieving session results and publishing session workspaces. New Pydantic schemas define request/response models. A shared authorization helper (_get_visible_session) validates session visibility before processing requests. One endpoint fully implements session result retrieval; three others stub workspace diff, patch, and publish operations with HTTP 501. Tests verify the contract, authorization boundaries, and error responses.

Changes

Remote Session Result Publication

Layer / File(s) Summary
Schema definitions for session results and publication
coding-agent/src/coding_agent/ui/schemas.py
Six new Pydantic models define request and response contracts: SessionResultResponse captures session state with optional result/verification/failure fields, WorkspaceDiffFileSchema and WorkspaceDiffResponse model file-level and aggregate diff metadata, WorkspacePatchResponse returns unified diff patches, and PublishSessionRequest/Response model publish operations and outcomes.
HTTP server endpoints with authorization helper
coding-agent/src/coding_agent/ui/http_server.py
Schema imports are added to the server module, a new _get_visible_session helper centralizes session retrieval and authorization checks, and four endpoints are implemented: GET /sessions/{session_id}/result returns a populated SessionResultResponse, while GET /workspace/diff, GET /workspace/patch, and POST /publish verify visibility and return HTTP 501 stubs.
Tests for session result and publication endpoints
coding-agent/tests/ui/test_http_server.py
A new test class validates the session result endpoint contract, authorization hiding across user boundaries, 501 error details for unimplemented operations, and 404 responses when sessions do not exist.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • delete-cloud/Coding-Agent-Loop#125: The main PR's new session-result/workspace publish endpoints reuse the same AuthContext-based session visibility and authorization logic pattern introduced in the retrieved PR.

Poem

🐰 A rabbit hops through sessions vast,
retrieving results from code run past,
with schemas neat and endpoints sure,
and 501 stubs for futures pure—
authorization guards each way,
in tests we trust, come what may! ✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 15.38% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'feat: add remote result API contract' directly and clearly summarizes the main change—adding new API endpoints and schemas for remote session result publication.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/remote-result-api-contract

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@delete-cloud
delete-cloud merged commit 0f8cf92 into main May 13, 2026
1 check passed
@delete-cloud
delete-cloud deleted the feat/remote-result-api-contract branch May 13, 2026 05:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant