Repository navigation
OSS-169: accept hydradb-sdk>=2.1.7,<3 so installing the CLI no longer downgrades the SDK - #60
adityamishra-hydradb wants to merge 2 commits into
Conversation
The exact pin made pip downgrade a user's newer SDK and uv refuse the install. Accept any 2.x from 2.1.7 up, and make the wrapper work on 2.1.8: send app_knowledge as an extra form field when the SDK has no keyword for it, keep the rotate-credentials body the same when the SDK renames its keyword, and read a 2xx answer that a stricter generated response model rejects as plain JSON. CI runs the tests on the floor too. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: adityamishra-hydradb <[email protected]>
|
@hydra-mira-review review |
|
/devin review |
Mira score 5/5 · 🟢 Good to merge
Installing the CLI now allows newer compatible SDK versions without forcing a downgrade. The PR broadens the dependency range, adapts SDK calls and response handling, and adds compatibility coverage. How this PR works · 5 changes, 3 high risk, 1 medium risk, 1 low riskInstalling the CLI could downgrade an existing SDK or cause a dependency conflict. This PR accepts 1. Allow compatible SDK versions instead of forcing a downgrade · 🟠 medium risk ·
|
Only keyword-only SDK parameters count as body fields. A path argument (id) and request_options are not, so a credentials object that holds either key is sent as it is instead of crashing the call on SDK 2.1.8. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: adityamishra-hydradb <[email protected]>
|
@hydra-mira-review review |
|
/devin review |
For humans
Installing the CLI pinned one SDK version exactly (
hydradb-sdk==2.1.7onmain,==2.1.2in the 0.2.0 release). When a project already had a newer SDK, pip replaced it with the old one without a question, and uv refused the install. This PR changes the pin to the rangehydradb-sdk>=2.1.7,<3.A range alone was not enough. The CLI failed on SDK 2.1.8 (64 tests failed), because 2.1.8 changed three things the wrapper used. This PR fixes all three in the wrapper, so the CLI works on 2.1.7 and on 2.1.8:
app_knowledgekeyword oncontext.ingest. The API still reads that form field. The wrapper now sends it as an extra form field when the SDK has no keyword for it.request=becamerefresh_token=). The wrapper now sends the same credentials body on both.CI now also runs the tests on the floor of the range (2.1.7). The normal test job gets the newest 2.x.
Follow-ups (not in this PR):
main).Fixes OSS-169.
For agents
pyproject.toml:hydradb-sdk==2.1.7->hydradb-sdk>=2.1.7,<3. Floor 2.1.7 because the wrapper is tested on it; older 2.1.x were not checked.src/hydradb_cli/hydra/client.py:_split_body(fn, body): fieldsfnnames as parameters go as keywords; the rest go torequest_options["additional_body_parameters"], which Fern merges into the JSON body or the multipart form on 2.1.7 and 2.1.8 (sameget_request_bodycode in both)._invoke_write(..., extra_body=)merges that withmax_retries: 0._invoke: aParsingErrorwith a 2xx status and a dict body returns the body (envelope -> object withdata/success/meta), so_unwrapand_request_id_ofwork unchanged. Non-2xx or non-dict bodies still raiseHydraDBClientError.context.ingest:app_knowledgegoes through_split_body.connectors.rotate_credentials:request=when the SDK has it; otherwise_split_body, and a required keyword the credentials lack is passed as...(FernOMIT), so the JSON body is exactly the credentials..github/workflows/ci.yml: new jobtest-sdk-floorreads the floor frompyproject.tomland runspytest -qon it.Proof
A = base
main@5a5842d(hydradb-sdk==2.1.7) · B = this PR @ed1ec15(hydradb-sdk>=2.1.7,<3). Run 2026-12-04 22:40-22:50 UTC. Raw output:~/hydradb/dogfood/sdk/proof/oss-169/(pin_ab.txt,smoke_218.txt,tests_A.txt,tests_B.txt).1. A/B on the real repro: install the CLI next to SDK 2.1.8
Clean venvs (Python 3.12),
hydradb-sdk==2.1.8installed first, then the CLI wheel built from each commit (uv build --wheel). Command for pip:pip install <cli wheel>. Command for uv:uv pip install hydradb-sdk==2.1.8 <cli wheel>.Requires-Disthydradb-sdk==2.1.7hydradb-sdk<3,>=2.1.7Found existing installation: hydradb-sdk 2.1.8...Successfully uninstalled hydradb-sdk-2.1.8)Requirement already satisfied: hydradb-sdk<3,>=2.1.7 ... (2.1.8))HydraDB(...).byogpresent after installFalse(lost with the downgrade)Truehydradb-cli==0.2.3 depends on hydradb-sdk==2.1.7 ... your requirements are unsatisfiablehydradb-cli==0.2.3, SDK stays 2.1.82. A/B: the CLI on SDK 2.1.8, against prod
Own database
dogfood-fix-oss-169in our test org (deleted after). A = base CLI with SDK 2.1.8 forced in (uv pip install --no-deps hydradb-sdk==2.1.8), which is what the range lets users get. B = PR CLI, SDK 2.1.8 resolved by pip.-o json)ingest --kind knowledge --text ... --source-id k-XTypeError: ContextClient.ingest() got an unexpected keyword argument 'app_knowledge'Knowledge uploaded successfullyingest --kind memory --text ...ingest <file>database stats/database readinesslist --kind knowledgequery "Who owns the zephyr ledger?"chunks: []app_external_id: k-B,app_kind: knowledge_basedelete k-X --kind knowledge -yNothing deleted: no matching knowledge source(s) for k-Adeleted_count: 1, idk-B3. Regression: full test suite (
pytest -q), on both SDK releasesThe 64 A failures on 2.1.8 (list:
A_on_2.1.8_failures.txt): 55 are theapp_knowledgekeyword (every knowledge-text ingest path in the sim, wrapper and conformance tests), 1 is the rotate-credentialsrequest=keyword, and 8 are stricter 2.1.8 response models that refuse a 2xx body (ParsingErrorondatabases.create/delete/status/statsandconnectors.delete_resource). B adds 13 tests.ruff check .andruff format --check .pass. CI on B:test (3.10-3.13)(newest SDK) and the newtest-sdk-floor(2.1.7) are green.4. Smoke
Section 2, column B, is the smoke run: ingest (text, memory, file), database stats and readiness, list, query, delete, all on SDK 2.1.8 against prod.
5. Stress / load
N/A: the change is to dependency resolution and request building, not to limits, concurrency or batching.
6. Edge cases the change targets
app_knowledgekeyword: field still reaches the multipart formTestSdkRangeCompat::test_app_knowledge_reaches_the_form_when_the_sdk_has_no_keywordrefresh_token=): body is the whole credentials objecttest_sends_the_same_body_when_the_sdk_names_one_field,test_installed_sdk_sends_the_credentials_as_the_bodyidorrequest_options(Devin finding)test_credential_fields_named_like_call_arguments_stay_in_the_bodytest_a_required_field_the_credentials_lack_is_omitted_not_inventedtest_a_2xx_body_the_response_model_rejects_is_returned_unwrapped,test_a_2xx_bare_body_is_returned_as_isParsingErroron a 5xx, or on a non-object 2xx body: still an errortest_a_parsing_error_on_an_error_status_still_raises,test_a_2xx_body_that_is_not_an_object_still_raisespyproject.tomlkeeps a rangetest_the_sdk_dependency_is_a_range_not_an_exact_pin🤖 Generated with Claude Code