Repository navigation
fix(core-ai): validate video fps and duration, and map aborted video calls to AbortError - #348
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.
|
No actionable comments were generated in the recent review.
|
| Layer / File(s) | Summary |
|---|---|
Video input validation packages/core-ai/ios/CoreAIVideoGeneration.swift |
makeConfiguration rejects nonpositive FPS. When deriving frame count from duration, it rejects nonfinite, nonpositive, and greater-than-3600-second values. |
Video generation abort handling packages/core-ai/src/ai-sdk.ts, packages/core-ai/src/__tests__/ai-sdk.test.ts |
CoreAIVideoModel.generate converts errors to AbortError when the signal is aborted and rethrows other errors unchanged. Tests cover both outcomes. |
Apple VLM Documentation
| Layer / File(s) | Summary |
|---|---|
Apple VLM generation guidance website/src/docs/core-ai/generating.md |
The documentation states that Apple’s VLM engine rejects structured output with CORE_AI_UNSUPPORTED_CAPABILITY. It also says createSession() rejects vision language models and directs callers to generateText or streamText. |
Priority:
Estimated code review effort: 2 (Simple) | ~10 minutes
Change: Bug fix
Possibly related issues
- Issue 344 asks for video generation to stop when the caller aborts. This change maps failures from aborted video generation to
AbortError; it does not implement the issue’s progress reporting requirement.
Possibly related PRs
- callstackincubator/ai#309 — This PR adds
CoreAIVideoModeland the iOS configuration path that this change updates. - callstackincubator/ai#340 — This PR changes the same video configuration path and adds early abort handling.
Merge Risk: 
Minimal · up to 02ffb
-
No merge-blocking correctness, availability, security, or documentation issue is established.
Security architecture risk: 
Minimal · up to 02ffb
-
The change tightens existing input validation and normalizes cancellation failures without expanding access or privileges. No material security risk introduced or worsened by this PR was identified.
Retained concerns
No architecture-level concerns identified.Security review details
-
Security Blast Radius
- inferred — The changed path affects callers that already possess access to the native video API and the application process performing generation. The comparison shows no new entrypoint, credential use, cross-service access or higher-privilege sink. Existing native generation and temporary-file effects remain reachable through the same call path.
Trust Boundaries and Controls
- observed — The new numeric checks execute in native configuration before the existing duration-to-frame conversion and video generation. They execute after pipeline loading, so they are not a pre-load resource control or comprehensive validation of every numeric option.
-
Pre-merge checks: 
5
-
Full details: Title check
-
Explanation
The title matches the main change. The PR adds fps and duration validation to CoreAIVideoGeneration.swift and maps aborted video calls to AbortError in ai-sdk.ts, as the objectives and file summaries describe. The title is specific and follows the conventional-commit style, and it covers both parts of the change. It is somewhat long at 88 characters, but this does not make it unclear.
Full details: Docstring Coverage
-
Explanation
Docstring coverage is 100.00% which is sufficient. The required threshold is 50.00%. Docstring coverage is scoped to functions touched by this diff. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 1 functions across 3 files. (1 skipped: 1 unsupported.)
-
Finishing Touches
-
📝 Generate docstrings
-
- Commit to this branch
- Create a new PR
🧪 Generate unit tests (beta)
-
- Commit to this branch
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Comment @coderabbitai help to get the list of available commands.
…calls to AbortError A NaN, infinite or huge duration trapped in the frame count conversion and stopped the app, and fps of 0 or below reached the MP4 writer. Both now reject with CORE_AI_INVALID_INPUT. Native errors after an abort now reach callers as an AbortError, as in the language model. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ut and sessions Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ceae07d to
02ffbc5
Compare
Fixes the CodeRabbit findings from the re-review of #315 and #326 that still apply to
main. GitHub retargeted those PRs tomainafter the stack merged, so CodeRabbit re-reviewed code from the whole old stack under them.CoreAIVideoGeneration.swift:fpsof 0 or below, and a NaN, infinite or very largeduration, now reject withCORE_AI_INVALID_INPUT. Before,Int(...)trapped on the duration and stopped the app.coreAI.videoModel(...): a native error after the signal aborts reaches callers as anAbortError, as in the language model.Already fixed on
main(by #340), so not changed here:tileSize,tileOverlap,topK,meanandstdvalidation, andcreateTensorwith plain number arrays for half-precision and 64-bit types.packages/core-ai/docs/getting-started.mdmoved to the website in #312.Testing: 69 unit tests pass, typecheck and lint pass, and the iOS app compiles. Not run on the device, since the phone is in use for benchmarks.
🤖 Generated with Claude Code
Summary by CodeRabbit
generateTextorstreamTextwith vision-language models.