Add thumbnail support and fill_gaps param for API spec v0.6.5#96
Conversation
Update generated clients and SDK wrappers to expose include_thumbnails query param on describe, extract, and collection detail endpoints, and add fill_gaps to shot segmentation config with updated duration bounds. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
📝 WalkthroughWalkthroughBumps package to 0.7.2, updates a spec submodule pointer, adds optional include_thumbnails?: boolean to several API method signatures, and adds a post-generation transform in generate.js that strips OpenAPI-derived .default() calls from generated Zod schemas. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (2)
spec (1)
1-1: Consider documenting spec changes in the PR or commit.For maintainability, it would be helpful to document what changed in the spec submodule update, either in the PR description or a commit message. Key changes to document:
- Addition of
include_thumbnailsquery parameter- Addition of
fill_gapsto shot segmentation configuration- Change in maximum duration bounds (3600 → 600)
This helps reviewers and future maintainers understand the impact of the spec update without needing to diff the submodule commits directly.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@spec` at line 1, Add a short changelog entry to the PR description or the commit message summarizing the spec submodule update: list the new query parameter include_thumbnails, the new shot segmentation option fill_gaps, and the change to maximum duration bounds from 3600 to 600; mention any affected endpoints or config objects (e.g., shot segmentation configuration) and the expected behavioral impact so reviewers and future maintainers can quickly understand the update without diffing the submodule.src/api/describe.api.ts (1)
80-102: Consider:waitForReadydoesn't forwardinclude_thumbnailsto final response.The
waitForReadymethod only forwardsresponse_formatwhen callinggetDescribe(line 94). If callers want thumbnails in the final returned job object, they would need to callgetDescribeseparately afterwaitForReadycompletes.This is likely acceptable since polling typically only checks status, but you may want to consider supporting
include_thumbnailsinWaitForReadyOptionsfor consistency if users expect thumbnails in the final response.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/api/describe.api.ts` around lines 80 - 102, waitForReady currently passes only response_format to getDescribe, so callers cannot request thumbnails in the final returned job; update the WaitForReadyOptions type to include include_thumbnails (boolean) and forward include_thumbnails when calling getDescribe inside waitForReady (in addition to response_format) so the final returned job can contain thumbnails when requested; make sure to read include_thumbnails from options and pass it through in the getDescribe call.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@spec`:
- Line 1: The PR introduces a new API surface (the include_thumbnails parameter
used across multiple methods) but lacks the companion integration tests
referenced in the test plan; either block merging until the
cloudglue-js-examples integration tests are added and passing, or update the PR
with explicit test-gap documentation and an actionable tracking issue: add a
clear note in the PR description stating tests are missing, create a tracker
issue that lists the required integration tests for the methods that accept
include_thumbnails, and attach a CI plan and expected passing criteria so
reviewers can merge safely once the integration suite in cloudglue-js-examples
is implemented and green.
---
Nitpick comments:
In `@spec`:
- Line 1: Add a short changelog entry to the PR description or the commit
message summarizing the spec submodule update: list the new query parameter
include_thumbnails, the new shot segmentation option fill_gaps, and the change
to maximum duration bounds from 3600 to 600; mention any affected endpoints or
config objects (e.g., shot segmentation configuration) and the expected
behavioral impact so reviewers and future maintainers can quickly understand the
update without diffing the submodule.
In `@src/api/describe.api.ts`:
- Around line 80-102: waitForReady currently passes only response_format to
getDescribe, so callers cannot request thumbnails in the final returned job;
update the WaitForReadyOptions type to include include_thumbnails (boolean) and
forward include_thumbnails when calling getDescribe inside waitForReady (in
addition to response_format) so the final returned job can contain thumbnails
when requested; make sure to read include_thumbnails from options and pass it
through in the getDescribe call.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: f3577d5c-930f-42ca-af8f-de395f11f10d
⛔ Files ignored due to path filters (6)
generated/Collections.tsis excluded by!**/generated/**generated/Describe.tsis excluded by!**/generated/**generated/Extract.tsis excluded by!**/generated/**generated/Segments.tsis excluded by!**/generated/**generated/common.tsis excluded by!**/generated/**package-lock.jsonis excluded by!**/package-lock.json
📒 Files selected for processing (5)
package.jsonspecsrc/api/collections.api.tssrc/api/describe.api.tssrc/api/extract.api.ts
| @@ -1 +1 @@ | |||
| Subproject commit f1fb4bacd98af31e26e921e74963008ed8a1ac5b | |||
| Subproject commit c37a268a65fc331352f2504953c1051a3190d0b6 | |||
There was a problem hiding this comment.
Integration tests are incomplete.
The test plan explicitly states "Integration tests in cloudglue-js-examples to be run with a companion PR (not yet completed)." Merging this PR without completed integration tests poses a risk, especially since this adds new API surface area (include_thumbnails parameter across multiple methods).
Consider holding this PR until integration tests are completed and passing, or at minimum, document the testing gap and create a tracking issue.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@spec` at line 1, The PR introduces a new API surface (the include_thumbnails
parameter used across multiple methods) but lacks the companion integration
tests referenced in the test plan; either block merging until the
cloudglue-js-examples integration tests are added and passing, or update the PR
with explicit test-gap documentation and an actionable tracking issue: add a
clear note in the PR description stating tests are missing, create a tracker
issue that lists the required integration tests for the methods that accept
include_thumbnails, and attach a CI plan and expected passing criteria so
reviewers can merge safely once the integration suite in cloudglue-js-examples
is implemented and green.
The openapi-zod-client generator adds .default() for fields with OpenAPI defaults, but these are server-side defaults. Client-side, .default() makes fields required in Zod's output type, breaking user code that omits optional fields (e.g. shot_detector_config without fill_gaps). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
🧹 Nitpick comments (2)
generate.js (2)
137-140: Document the regex limitation for nested parentheses.The regex pattern
[^)]*cannot handle default values containing nested parentheses (e.g.,.default(someFn())). While OpenAPI defaults are typically JSON literals that don't contain nested parens, this assumption could break with unusual specs.Consider adding a comment documenting this limitation, or for robustness, implementing balanced-parenthesis matching:
📝 Suggested documentation comment
// Pattern 1: .nullish().default(VALUE) → .nullish() +// Note: [^)]* assumes no nested parentheses in default values (safe for JSON literals) fileContent = fileContent.replace(/\.nullish\(\)\.default\([^)]*\)/g, '.nullish()');🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@generate.js` around lines 137 - 140, The two regex replacements on fileContent (the patterns using /\.nullish\(\)\.default\([^)]*\)/ and /\.optional\(\)\.default\([^)]*\)/) do not handle default(...) values that contain nested parentheses; update generate.js to either (a) add a clear comment above these replacements documenting this limitation (that the regex won't match defaults with nested parentheses like .default(someFn())) or (b) replace the simple regex with a more robust parser/approach that matches balanced parentheses for the .default(...) portion; reference the fileContent variable and the two regex replacement lines when making the change.
132-159: Consider combining the file read/write with the existing loop.The new transformation reads and writes each file (lines 132-159), then the existing nullish/nullable fix loop reads and writes the same files again (lines 161-337). This results in two disk I/O cycles per file.
For better efficiency, consider combining into a single loop that applies all transformations before writing once. This is a minor optimization since it's a build-time script.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@generate.js` around lines 132 - 159, The current generatedFiles for-loop reads each file, applies three .default()/ .optional()/.nullish() regex transforms and writes it back using fs.readFileSync/fs.writeFileSync, but a separate later nullish/nullable fix loop re-reads/writes the same files causing duplicate I/O; consolidate by moving the nullish/nullable fix logic into this same for (const file of generatedFiles) loop (use the same fileContent variable and apply all regex replaces — including the existing .nullish().default/.optional().default/.default(...) handler and the subsequent nullish/nullable fixes) and call fs.writeFileSync exactly once per file to write the final fileContent.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@generate.js`:
- Around line 137-140: The two regex replacements on fileContent (the patterns
using /\.nullish\(\)\.default\([^)]*\)/ and /\.optional\(\)\.default\([^)]*\)/)
do not handle default(...) values that contain nested parentheses; update
generate.js to either (a) add a clear comment above these replacements
documenting this limitation (that the regex won't match defaults with nested
parentheses like .default(someFn())) or (b) replace the simple regex with a more
robust parser/approach that matches balanced parentheses for the .default(...)
portion; reference the fileContent variable and the two regex replacement lines
when making the change.
- Around line 132-159: The current generatedFiles for-loop reads each file,
applies three .default()/ .optional()/.nullish() regex transforms and writes it
back using fs.readFileSync/fs.writeFileSync, but a separate later
nullish/nullable fix loop re-reads/writes the same files causing duplicate I/O;
consolidate by moving the nullish/nullable fix logic into this same for (const
file of generatedFiles) loop (use the same fileContent variable and apply all
regex replaces — including the existing
.nullish().default/.optional().default/.default(...) handler and the subsequent
nullish/nullable fixes) and call fs.writeFileSync exactly once per file to write
the final fileContent.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 93760839-a2b0-4843-8212-0e51bedee3f1
⛔ Files ignored due to path filters (17)
generated/Chat.tsis excluded by!**/generated/**generated/Collections.tsis excluded by!**/generated/**generated/Describe.tsis excluded by!**/generated/**generated/Extract.tsis excluded by!**/generated/**generated/Face_Detection.tsis excluded by!**/generated/**generated/Face_Match.tsis excluded by!**/generated/**generated/Files.tsis excluded by!**/generated/**generated/Frames.tsis excluded by!**/generated/**generated/Response.tsis excluded by!**/generated/**generated/Search.tsis excluded by!**/generated/**generated/Segmentations.tsis excluded by!**/generated/**generated/Segments.tsis excluded by!**/generated/**generated/Share.tsis excluded by!**/generated/**generated/Tags.tsis excluded by!**/generated/**generated/Transcribe.tsis excluded by!**/generated/**generated/Webhooks.tsis excluded by!**/generated/**generated/common.tsis excluded by!**/generated/**
📒 Files selected for processing (1)
generate.js
Summary
include_thumbnailsquery param togetDescribe,getExtract,getEntities, andgetMediaDescriptionswrapper methodsfill_gapsto shot segmentation config with updated max duration bounds (3600 → 600)Test plan
npm run buildpasses🤖 Generated with Claude Code
Summary by CodeRabbit
New Features
Chores