feat: let wrappers identify themselves in X-Sonilo-Client (0.5.1) - #12
Merged
Conversation
The CLI and video kit both build on the SDK, so every call they made reported as sdk-python — making CLI and kit traffic indistinguishable from direct SDK use in server-side analytics, with no way to recover the split retroactively. Sonilo/AsyncSonilo now take optional client_name/client_version, defaulting to sdk-python and the SDK version. The CLI sends cli-python and the video kit sends kit-python-video, each with its own package version. A caller-supplied client keeps its owner's identity; only the kit's internally constructed default clients are tagged. Released as a patch (0.5.1) rather than a minor: the change is purely additive, and a 0.6.0 would have forced pin bumps and re-releases across sonilo-cli and sonilo-video-kit, which pin <0.6.
Sapient docs evalsWaiting for the staging docs URL before running evals. Sapient will start the selected PR evals automatically when GitHub reports a successful docs deployment for this PR. This usually happens within 15 minutes. Commit: |
_default_client() builds Sonilo() without an explicit key, so the SDK reads SONILO_API_KEY. The test passed locally only because a key happened to be exported; CI has none and failed on both matrix entries.
The dashboard's source taxonomy is <surface>-<language> (sdk-js, sdk-python). kit-python-video broke that ordering; videokit-python lines up with cli-python and leaves room for videokit-js.
4 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The dashboard shows CLI calls as SDK (Python). Both first-party wrappers —
sonilo-cliandsonilo-video-kit— construct aSonilo()client, and the SDK hardcodesX-Sonilo-Client: sdk-pythonwith no way to override it. So every CLI and video-kit call is indistinguishable from direct SDK use.That matters because CLI and SDK users are different populations (scripts/ops/evaluation vs. product integration), and the split cannot be recovered retroactively — mixed history stays mixed.
This is out of step with the usual convention, where the CLI is its own client surface:
aws-cli/2.15.0 … botocore/1.34boto3/1.34stripe-cli/1.19stripe-python/8.xgh/2.xoctokit/xChange
Sonilo/AsyncSonilotake two new optional arguments:Both default to
sdk-pythonand the SDK's own version, so direct SDK use is unchanged.DEFAULT_CLIENT_NAMEis exported for callers that want the default explicitly.Resulting identities:
X-Sonilo-ClientX-Sonilo-Client-Versionsdk-pythonsonilo-clicli-pythonsonilo-video-kitkit-python-videoA caller-supplied client keeps whatever identity its owner gave it — only the video kit's internally constructed default clients (
generate.py,duck.py) are tagged.Why a patch release (0.5.1), not 0.6.0
Strict semver would call a new public parameter a minor bump. A 0.6.0 would break the package set:
sonilo-cliandsonilo-video-kitboth pinsonilo <0.6, so the CLI would need>=0.6to use the new argument while the kit still demanded<0.6— the exactResolutionImpossiblethat #11 had to clean up.The change is purely additive with defaults preserving current behavior, so 0.5.1 keeps every existing pin valid and leaves
sonilo-video-kit's dependency untouched.Version bumps
sonilo0.5.0 → 0.5.1sonilo-cli0.1.0 → 0.1.1sonilo-video-kit0.1.1 → 0.1.2 (adds_version.py, which the package previously lacked)Required follow-up outside this repo
cli-python→CLI (Python)kit-python-video→Video Kit (Python)sonilo-jshardcodessdk-jsthe same way and will need the equivalent hook before the JS CLI (sonilo-js#12) ships.Test plan
pytest→ 173 passed (6 new: defaults, independent overrides, async parity)pytest sonilo-cli→ 29 passed (1 new)pytest sonilo-video-kit→ 53 passed (1 new)sonilo accountcall against the production API succeeded via the CLI