Skip to content

Add complete public SDK coverage#57

Merged
jadenfix merged 6 commits into
mainfrom
codex/sdk-complete-facade-coverage
Jun 18, 2026
Merged

Add complete public SDK coverage#57
jadenfix merged 6 commits into
mainfrom
codex/sdk-complete-facade-coverage

Conversation

@jadenfix

Copy link
Copy Markdown
Contributor

Summary

  • regenerate the Python SDK wrappers from the complete public SDK contract
  • add public connections/connectors/table coverage and keep replace/update methods aligned with the contract
  • refresh SDK_EXAMPLES.md and README text so clients see public client calls only

Validation

  • uv run pytest -q
  • uv run ruff check .
  • rg scan of README.md and SDK_EXAMPLES.md found no raw/generated endpoint examples
  • git diff --check

Depends on roe-python #56 and the roe-main complete-coverage follow-up.

@greptile-apps

greptile-apps Bot commented Jun 17, 2026

Copy link
Copy Markdown

Greptile Summary

This PR regenerates the Python SDK wrappers to expose the full public API surface — connections, connectors, and extended table operations — replacing raw client.raw.get_httpx_client() examples with stable ergonomic methods. It also adds replace (PUT) methods to AgentsAPI, AgentVersionsAPI, and PoliciesAPI, and introduces a _DictBody shim so plain dict bodies can flow through the typed _get_kwargs plumbing.

  • New ConnectionsAPI and ConnectorsAPI: eight connection endpoints and two connector endpoints are generated, with organization_id correctly injected only into POST bodies (not PATCH/PUT) via the new _dict_body_lines helper.
  • Generator improvements: _render_api_module gains per-flag import tracking (needs_any, needs_org_id, needs_request_json/raw) and a body kind dispatch path, and return_import is now guarded so DELETE-style operations without a return model don't crash codegen.
  • Documentation refresh: README.md removes the "Raw API Access" section and SDK_EXAMPLES.md replaces all client.raw.get_httpx_client().request(...) blocks with public wrapper calls.

Confidence Score: 5/5

Safe to merge. The organization_id body-injection fix is correct and test-covered; the new dict-body plumbing is well-isolated and independently tested.

All changed code paths are either covered by new transport tests or follow the same verified pattern used for agents/policies. The _DictBody shim is tested in test_generated_request.py, and the three critical org_id cases (POST body+query, PATCH query-only, PUT query-only) each have an assertion. The only gaps are missing tests for ConnectorsAPI and several ConnectionsAPI read/delete methods, none of which have logic complex enough to hide a correctness bug.

src/roe/api/connections.py and src/roe/api/connectors.py have untested methods (list, retrieve, delete, test, test_credentials, and both connector methods).

Important Files Changed

Filename Overview
src/roe/utils/generated_request.py Adds _DictBody shim so plain dicts can be passed through _get_kwargs which expects a .to_dict() method; the override of request_kwargs["json"] with the original body ensures the final JSON payload is always the raw dict, not a double-serialized copy. Logic is correct.
src/roe/api/connections.py New generated ConnectionsAPI wrapping all 8 connection endpoints. organization_id is correctly kept out of PATCH/PUT bodies and only injected for POST create. Missing transport tests for list, retrieve, delete, test, and test_credentials.
src/roe/api/connectors.py New ConnectorsAPI with list and retrieve. Straightforward request_raw wrappers, no body, no org_id injection. No unit tests.
scripts/generate_wrappers.py Adds _dict_body_lines for dict-format bodies, a new body kind handler, and per-flag import tracking (needs_any, needs_org_id, needs_request_json/raw). The POST-only gate for organization_id body injection is correct.
openapi/wrappers.yml Adds connection, connector, table, and agent PUT/replace operations. The version_id path param still lacks wire_name: agent_version_id (flagged in a prior review thread). All other new operations have correct wire_name mappings.
src/roe/api/tables.py Adds list, query, query_result, describe, preview, and delete table operations. Uses request_raw + from_dict for bodyless GETs and request_json + resp.parsed for POSTs with a typed body model. Internally consistent.
src/roe/api/agents.py Adds AgentsAPI.replace (PUT /v1/agents/{agent_id}/) and AgentVersionsAPI.replace (PUT /v1/agents/{agent_id}/versions/{agent_version_id}/). Both correctly build typed request bodies and pass organization_id as a query param. Tests added.
tests/unit/test_connections_wrapper_transport.py Covers create (org_id in body+query), update PATCH (org_id only in query), and replace PUT (org_id only in query). Missing coverage for list, retrieve, delete, test, and test_credentials.
tests/unit/test_generated_request.py New test verifying request_json accepts a plain dict body, wraps it in _DictBody for _get_kwargs, and produces the correct json kwarg. Directly validates the new _DictBody shim.

Sequence Diagram

%%{init: {'theme': 'neutral'}}%%
sequenceDiagram
    participant C as Client code
    participant API as ConnectionsAPI
    participant RJ as request_json / request_raw
    participant DB as _DictBody
    participant EP as Generated endpoint module
    participant SRV as Roe API server

    C->>API: api.create(connector_type, name, config)
    API->>API: build body dict, inject org_id (POST only)
    API->>RJ: "request_json(raw, ep, body=dict, organization_id=UUID)"
    RJ->>DB: wrap dict → _DictBody(dict)
    RJ->>EP: "_get_kwargs(body=_DictBody, organization_id=UUID)"
    EP-->>RJ: "request_kwargs {method, url, json, params}"
    RJ->>RJ: "override request_kwargs[json] = original dict"
    RJ->>SRV: httpx POST request
    SRV-->>RJ: 201 JSON
    RJ->>RJ: translate_response (raise on error)
    RJ->>EP: _build_response → Response[Connection]
    EP-->>API: "resp.parsed = Connection"
    API-->>C: Connection

    C->>API: "api.update(connection_id, name=x)"
    API->>API: build body dict, NO org_id injection for PATCH
    API->>RJ: "request_json(raw, ep, connection_id, body=dict, organization_id=UUID)"
    RJ->>SRV: "PATCH /v1/connections/{id}/?organization_id=..."
    SRV-->>RJ: 200 JSON
    RJ-->>API: "resp.parsed = Connection"
    API-->>C: Connection
Loading
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
sequenceDiagram
    participant C as Client code
    participant API as ConnectionsAPI
    participant RJ as request_json / request_raw
    participant DB as _DictBody
    participant EP as Generated endpoint module
    participant SRV as Roe API server

    C->>API: api.create(connector_type, name, config)
    API->>API: build body dict, inject org_id (POST only)
    API->>RJ: "request_json(raw, ep, body=dict, organization_id=UUID)"
    RJ->>DB: wrap dict → _DictBody(dict)
    RJ->>EP: "_get_kwargs(body=_DictBody, organization_id=UUID)"
    EP-->>RJ: "request_kwargs {method, url, json, params}"
    RJ->>RJ: "override request_kwargs[json] = original dict"
    RJ->>SRV: httpx POST request
    SRV-->>RJ: 201 JSON
    RJ->>RJ: translate_response (raise on error)
    RJ->>EP: _build_response → Response[Connection]
    EP-->>API: "resp.parsed = Connection"
    API-->>C: Connection

    C->>API: "api.update(connection_id, name=x)"
    API->>API: build body dict, NO org_id injection for PATCH
    API->>RJ: "request_json(raw, ep, connection_id, body=dict, organization_id=UUID)"
    RJ->>SRV: "PATCH /v1/connections/{id}/?organization_id=..."
    SRV-->>RJ: 200 JSON
    RJ-->>API: "resp.parsed = Connection"
    API-->>C: Connection
Loading

Reviews (3): Last reviewed commit: "fix: keep connection org id out of updat..." | Re-trigger Greptile

Comment thread scripts/generate_wrappers.py
Comment thread openapi/wrappers.yml
@jadenfix

Copy link
Copy Markdown
Contributor Author

/greptile

@jadenfix

Copy link
Copy Markdown
Contributor Author

@greptile review

Comment thread src/roe/api/connections.py
@jadenfix

Copy link
Copy Markdown
Contributor Author

@greptile review

@jadenfix

Copy link
Copy Markdown
Contributor Author

/greptile

2 similar comments
@jadenfix

Copy link
Copy Markdown
Contributor Author

/greptile

@jadenfix

Copy link
Copy Markdown
Contributor Author

/greptile

@jadenfix jadenfix changed the base branch from codex/sdk-contract-fanout to main June 18, 2026 20:22
@jadenfix jadenfix force-pushed the codex/sdk-complete-facade-coverage branch from a719b08 to 32e9279 Compare June 18, 2026 20:22
@jadenfix jadenfix merged commit a26079e into main Jun 18, 2026
3 checks passed
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.

2 participants