Skip to content

Add thumbnail support and fill_gaps param for API spec v0.6.5#96

Merged
kdr merged 2 commits into
mainfrom
kdr-thumbnail-and-fill-gaps-support
Mar 9, 2026
Merged

Add thumbnail support and fill_gaps param for API spec v0.6.5#96
kdr merged 2 commits into
mainfrom
kdr-thumbnail-and-fill-gaps-support

Conversation

@kdr

@kdr kdr commented Mar 9, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Update generated clients from OpenAPI spec v0.6.5
  • Add include_thumbnails query param to getDescribe, getExtract, getEntities, and getMediaDescriptions wrapper methods
  • Add fill_gaps to shot segmentation config with updated max duration bounds (3600 → 600)
  • Bump version to 0.7.2

Test plan

  • npm run build passes

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features

    • Added optional thumbnail support to describe, collections, extract, and related data retrieval endpoints.
  • Chores

    • Updated submodule pointer.
    • Bumped package version to 0.7.2.
    • Adjusted code generation output to simplify schema defaults in generated TypeScript.

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>
@coderabbitai

coderabbitai Bot commented Mar 9, 2026

Copy link
Copy Markdown
📝 Walkthrough

Walkthrough

Bumps 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

Cohort / File(s) Summary
Version & Spec
package.json, spec
Version bump to 0.7.2 and submodule pointer update.
API Parameter Extensions
src/api/collections.api.ts, src/api/describe.api.ts, src/api/extract.api.ts
Added optional include_thumbnails?: boolean to method signatures and propagated it to outgoing API queries for getEntities, getMediaDescriptions, getDescribe, and getExtract. No control-flow or error-handling changes.
Codegen Post-processing
generate.js
New transformation removing .default(...) from generated Zod schemas: converts .nullish().default(...).nullish(), .optional().default(...).optional(), and other .default(...).optional() when appropriate; updates all generated .ts files accordingly.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Suggested reviewers

  • amyxst

Poem

🐰 I fixed some defaults and bumped the name,
I tucked in thumbnails — a tiny change, tame.
I hop through schemas, tidy and neat,
Default calls trimmed, the output’s complete.
A soft little thump — release is on its feet. 🥕

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title directly references the main change: adding thumbnail support and fill_gaps param for API spec v0.6.5. It accurately summarizes the primary objectives of the changeset.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ 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 kdr-thumbnail-and-fill-gaps-support

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_thumbnails query parameter
  • Addition of fill_gaps to 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: waitForReady doesn't forward include_thumbnails to final response.

The waitForReady method only forwards response_format when calling getDescribe (line 94). If callers want thumbnails in the final returned job object, they would need to call getDescribe separately after waitForReady completes.

This is likely acceptable since polling typically only checks status, but you may want to consider supporting include_thumbnails in WaitForReadyOptions for 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

📥 Commits

Reviewing files that changed from the base of the PR and between a3e4bef and d3179d6.

⛔ Files ignored due to path filters (6)
  • generated/Collections.ts is excluded by !**/generated/**
  • generated/Describe.ts is excluded by !**/generated/**
  • generated/Extract.ts is excluded by !**/generated/**
  • generated/Segments.ts is excluded by !**/generated/**
  • generated/common.ts is excluded by !**/generated/**
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (5)
  • package.json
  • spec
  • src/api/collections.api.ts
  • src/api/describe.api.ts
  • src/api/extract.api.ts

Comment thread spec
@@ -1 +1 @@
Subproject commit f1fb4bacd98af31e26e921e74963008ed8a1ac5b
Subproject commit c37a268a65fc331352f2504953c1051a3190d0b6

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

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>

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 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

📥 Commits

Reviewing files that changed from the base of the PR and between d3179d6 and 42656fc.

⛔ Files ignored due to path filters (17)
  • generated/Chat.ts is excluded by !**/generated/**
  • generated/Collections.ts is excluded by !**/generated/**
  • generated/Describe.ts is excluded by !**/generated/**
  • generated/Extract.ts is excluded by !**/generated/**
  • generated/Face_Detection.ts is excluded by !**/generated/**
  • generated/Face_Match.ts is excluded by !**/generated/**
  • generated/Files.ts is excluded by !**/generated/**
  • generated/Frames.ts is excluded by !**/generated/**
  • generated/Response.ts is excluded by !**/generated/**
  • generated/Search.ts is excluded by !**/generated/**
  • generated/Segmentations.ts is excluded by !**/generated/**
  • generated/Segments.ts is excluded by !**/generated/**
  • generated/Share.ts is excluded by !**/generated/**
  • generated/Tags.ts is excluded by !**/generated/**
  • generated/Transcribe.ts is excluded by !**/generated/**
  • generated/Webhooks.ts is excluded by !**/generated/**
  • generated/common.ts is excluded by !**/generated/**
📒 Files selected for processing (1)
  • generate.js

@kdr kdr requested a review from amyxst March 9, 2026 06:37
@kdr kdr merged commit bada501 into main Mar 9, 2026
1 check passed
@kdr kdr deleted the kdr-thumbnail-and-fill-gaps-support branch March 9, 2026 20:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants