fix: restore public asset storage initialization - #9703
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
Included review availability: Your plan provides up to 10 included reviews per hour; 8 remain after this review. 📝 WalkthroughWalkthroughPublic asset download and upload endpoints now construct ChangesPublic asset storage
Estimated code review effort: 2 (Simple) | ~10 minutes Merge Risk: ⚪ Minimal · up to This restores existing public asset upload and download flows without changing storage modes or deployment behavior; no actionable merge-blocking risk remains beyond normal checks and review. Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ 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 |
Public asset upload and download routes pass an unsupported is_server keyword to S3Storage, so authenticated requests fail with HTTP 500 before a presigned URL can be generated. Use the existing request-only constructor consistently with adjacent asset routes and add autospecced API contract coverage for generic upload, generic download, and user server upload.
5016013 to
fa40ae9
Compare
Description
The public API asset routes currently instantiate
S3Storagewith an unsupportedis_serverkeyword.S3Storage.__init__has always accepted onlyrequest, so authenticated generic uploads, downloads, and server-backed user uploads fail with HTTP 500 before a presigned URL is generated.This removes the invalid keyword from all three call sites and uses the same request-aware constructor as the adjacent working asset routes. The regression tests autospec the real
S3Storagesignature, so future constructor/caller drift fails at the API contract boundary instead of being hidden by a permissive mock.This is intentionally narrower than #9114: it fixes the callers without adding a second storage mode or changing MinIO endpoint selection. Presigned URLs are returned to clients, so preserving the existing request-derived public endpoint behavior is the safer compatibility choice.
Type of Change
Screenshots and Media (if applicable)
Not applicable; this fixes public REST API responses.
Test Scenarios
TypeError: got an unexpected keyword argument 'is_server'before the fix.pytest plane/tests/contract/api/test_asset_storage.py plane/tests/contract/api/test_generic_asset.py -vv— 7 passed.ruff check plane/api/views/asset.py plane/tests/contract/api/test_asset_storage.py plane/tests/contract/api/test_generic_asset.py— passed.ruff format --check plane/tests/contract/api/test_asset_storage.py plane/tests/contract/api/test_generic_asset.py— passed.References
Fixes #8680
Fixes #9563
Related alternative: #9114
Summary by CodeRabbit
Bug Fixes
Tests