raise video import limit to 800 MiB - #2
Conversation
|
Caution The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased. |
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (3)
📝 WalkthroughWalkthrough视频大小上限由 500 MiB 提高至 800 MiB,核心常量、媒体契约和视频校验测试同步更新。 Changes视频大小限制更新
Estimated code review effort: 2 (Simple) | ~10 minutes ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
|
Caution The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased. |
PR Summary by QodoRaise MP4 import limit to 800 MiB
AI Description
Diagram
High-Level Assessment
Files changed (3)
|
Code Review by Qodo
1. Huge truncate in test
|
| const root = await fs.mkdtemp(path.join(os.tmpdir(), "bc-video-limit-")); | ||
| try { | ||
| const oversized = path.join(root, "oversized.mp4"); | ||
| await fs.writeFile(oversized, mp4Fixture()); | ||
| await fs.truncate(oversized, MAX_VIDEO_BYTES + 1); | ||
| await assert.rejects( | ||
| () => validateVideoFile(oversized), | ||
| /no larger than 838860800 bytes/, | ||
| ); |
There was a problem hiding this comment.
1. Huge truncate in test 🐞 Bug ☼ Reliability
The new regression test expands a temp MP4 to MAX_VIDEO_BYTES+1 (838,860,801 bytes) via fs.truncate, which assumes the filesystem makes this enlargement sparse/cheap. On environments that allocate/reserve blocks for such truncation, this can consume ~800 MiB and make the test suite slow or fail due to disk/quota limits.
Agent Prompt
### Issue description
`packages/core/test/media-validation.test.js` creates an oversized MP4 by truncating it to `MAX_VIDEO_BYTES + 1` (an 800 MiB+ logical file). This test relies on filesystem behavior that may not be consistent across CI runners (sparse vs. fully allocated truncation), which can lead to slow/flaky tests or disk/quota failures.
### Issue Context
`validateVideoFile()` rejects oversized inputs based on `stat.size` before hashing/reading the file, so the regression can be tested without requiring a huge logical file.
### Fix Focus Areas
- packages/core/test/media-validation.test.js[81-96]
### Suggested fix approach
- Keep the configuration assertion (`MAX_VIDEO_BYTES === 800 * 1024 * 1024`).
- For the oversized rejection behavior, prefer a small file and pass a small `maxBytes` override to `validateVideoFile(..., { maxBytes: <small> })` to exercise the same rejection branch and error formatting without creating an 800 MiB+ file.
- If you must specifically test the *default* path, consider refactoring validation to allow injecting a `stat` provider in tests (so size can be simulated) rather than creating very large files.
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
What changed
Why
Users can import larger local background videos without changing the existing streaming, validation, or saved-theme storage behavior.
Impact
Accepted MP4 files may now be up to 800 MiB. The 2 GiB saved-theme storage quota remains unchanged.
Validation
npm test(43 tests passed)npm run typecheckgit diff --checkSummary by CodeRabbit
功能改进
文档