This repository was archived by the owner on Jul 27, 2026. It is now read-only.
[ISSUE-029] Fix usage analytics date serialization — ISO-8601 datetime#56
Merged
Conversation
The /v1/usage endpoint requires full ISO-8601 datetimes; forwarding a plain YYYY-MM-DD produced a server 400 surfaced as a confusing SDK ResponseValidationError. Add a private _to_iso_datetime helper and apply it to start_time/end_time in get_usage_analytics only (date-only start -> T00:00:00Z, end -> T23:59:59Z; full datetimes pass through). get_voice_usage is unchanged. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Senior review: APPROVE. No Critical/High findings. Two Low items (lowercase t separator, empty-input validation) intentionally not gold-plated. uv run pytest: 157 passed, 1 skipped. ruff clean. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
pillip
added a commit
that referenced
this pull request
Jun 16, 2026
- src/supertone_cli/__init__.py: bump __version__ to 0.2.1
- CHANGELOG.md: cut [0.2.1] - 2026-06-16
- Fixed: usage analytics now converts YYYY-MM-DD to ISO-8601
datetime before calling /v1/usage (ISSUE-029, PR #56)
- Fixed: voices get falls back to the custom-voice endpoint on a
preset 404 so cloned voices resolve (ISSUE-030, PR #58)
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Closes #55
Summary
supertone usage analyticsforwarded a plainYYYY-MM-DDto the/v1/usageendpoint, which requires a full ISO-8601 datetime. The resulting server 400 surfaced as a confusing SDKResponseValidationError.This adds a private
_to_iso_datetime(value, *, end)helper inclient.pyand applies it tostart_time/end_timeinsideget_usage_analyticsonly:T00:00:00ZT23:59:59ZT-> passed through unchangedget_voice_usage(different endpoint, accepts plain dates) is untouched. CLI--helptext staysYYYY-MM-DD.Tests
client.usage.get_usagekwargs; already-Tpassthrough.usage analyticsexits 0 with mocked SDK.Track: quality | Priority: P1