Skip to content

chore: sync sdk output for unified single-file upload guard#424

Merged
chyroc merged 2 commits into
mainfrom
chore/sync-remove-files-before-body-order
Feb 26, 2026
Merged

chore: sync sdk output for unified single-file upload guard#424
chyroc merged 2 commits into
mainfrom
chore/sync-remove-files-before-body-order

Conversation

@chyroc

@chyroc chyroc commented Feb 26, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • sync generated Python SDK output after upstream optimization in coze-sdk-gen for single-file upload rendering
  • unify all single-file upload assignments to:
    • files = {"file": _try_fix_file(file)} if file else {}
  • this removes the previous inconsistency where required file fields used unconditional assignment while optional file fields used conditional assignment

Generator change

Changed SDK files

  • cozepy/audio/transcriptions/init.py
  • cozepy/audio/voices/init.py
  • cozepy/audio/voiceprint_groups/init.py
  • cozepy/audio/voiceprint_groups/features/init.py

Validation

  • from coze-sdk-gen repo:
    • ./scripts/genpy.sh --output-sdk exist-repo/coze-py --ci-check
  • coze-py checks passed in ci-check:
    • poetry build
    • poetry run ruff check cozepy
    • poetry run ruff format --check
    • poetry run mypy .
    • poetry run pytest --cov --cov-report=xml

Summary by CodeRabbit

  • Refactor
    • Adjusted multipart handling across voiceprint groups, audio features, transcriptions, and voice clone operations to include file data only when a file is provided, reducing unnecessary payloads.
  • Chore
    • Minor internal cleanup improving request construction consistency.

@chyroc chyroc added the chore Project maintenance work not related to features and bug fixes label Feb 26, 2026
@codecov

codecov Bot commented Feb 26, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 40.00000% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 91.75%. Comparing base (5661b28) to head (1cd7abf).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
...ozepy/audio/voiceprint_groups/features/__init__.py 0.00% 4 Missing ⚠️
cozepy/audio/voiceprint_groups/__init__.py 0.00% 2 Missing ⚠️
@@           Coverage Diff           @@
##             main     #424   +/-   ##
=======================================
  Coverage   91.75%   91.75%           
=======================================
  Files         105      105           
  Lines        9542     9542           
=======================================
  Hits         8755     8755           
  Misses        787      787           
Files with missing lines Coverage Δ
cozepy/audio/transcriptions/__init__.py 100.00% <100.00%> (ø)
cozepy/audio/voices/__init__.py 100.00% <100.00%> (ø)
cozepy/audio/voiceprint_groups/__init__.py 46.84% <0.00%> (ø)
...ozepy/audio/voiceprint_groups/features/__init__.py 50.57% <0.00%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@coderabbitai

coderabbitai Bot commented Feb 26, 2026

Copy link
Copy Markdown

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 5a785c0 and 1cd7abf.

📒 Files selected for processing (4)
  • cozepy/audio/transcriptions/__init__.py
  • cozepy/audio/voiceprint_groups/__init__.py
  • cozepy/audio/voiceprint_groups/features/__init__.py
  • cozepy/audio/voices/__init__.py

📝 Walkthrough

Walkthrough

Conditionalized multipart file payload construction moved into several audio client methods (voiceprint_groups, its features, transcriptions, and voices): files are now set to {"file": _try_fix_file(file)} only when a truthy file is provided; otherwise files is an empty dict. No public signatures changed.

Changes

Cohort / File(s) Summary
Voiceprint Groups
cozepy/audio/voiceprint_groups/__init__.py
speaker_identify (sync & async): build files as {"file": _try_fix_file(file)} only when file is truthy; otherwise use {}.
Voiceprint Groups Features
cozepy/audio/voiceprint_groups/features/__init__.py
create & update (sync & async): move/conditionally assign files after body construction; include files only when provided.
Transcriptions
cozepy/audio/transcriptions/__init__.py
create (sync & async): files now conditional — include file only if truthy, else {}.
Voices (clone)
cozepy/audio/voices/__init__.py
clone (sync & async): multipart files payload is conditional; omit files when no file supplied.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Poem

🐰 I hopped through code with soft, swift paws,
Tidied files and fixed their cause.
If no file comes, I skip the tray —
Quiet payloads hop away. 🥕

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: it mentions syncing SDK output and a unified single-file upload guard, which aligns with the PR's objective of synchronizing generated SDK output after upstream changes to file/body assignment order.

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

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch chore/sync-remove-files-before-body-order

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.

@chyroc chyroc changed the title chore: sync sdk output for files/body assignment order chore: sync sdk output for unified single-file upload guard Feb 26, 2026
chyroc added a commit to coze-dev/coze-sdk-gen that referenced this pull request Feb 26, 2026
…uard (#65)

## Summary
- remove files_before_body from OperationMapping config schema
- simplify Python operation renderer to always render files assignment
after body preparation
- remove all files_before_body entries from config/generator.yaml
- optimize single-file upload rendering: always use guarded assignment
(`if file else {}`) for consistent behavior across required/optional
file fields
- update renderer test coverage to assert the new fixed ordering and
unified file guard expression

## Validation
- ./scripts/fmt.sh
- ./scripts/lint.sh
- ./scripts/test.sh (coverage: 83.2%)
- ./scripts/build.sh

## Downstream PR
- coze-py: coze-dev/coze-py#424
@chyroc
chyroc merged commit 6b0f4cd into main Feb 26, 2026
18 of 19 checks passed
@chyroc
chyroc deleted the chore/sync-remove-files-before-body-order branch February 26, 2026 12:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

chore Project maintenance work not related to features and bug fixes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant