feat(api): add S3 presign endpoints and expand episode/task detail APIs#27
feat(api): add S3 presign endpoints and expand episode/task detail APIs#27shark0F0497 merged 3 commits intomainfrom
Conversation
…tamp and improve episode ID handling
| // Shape matches GET /api/v1/episodes/:id (Episode): id is episodes.id (PK), episode_id is the human-readable column. | ||
| type TaskEpisodeDetail struct { | ||
| ID string `json:"id" db:"id"` | ||
| ID int64 `json:"id"` |
There was a problem hiding this comment.
WARNING: Breaking API change — ID type changed from string to int64
The JSON output for episode.id in task detail responses changes from "id": "123" to "id": 123. Any client parsing this field as a string will break. Consider using a string-typed field or documenting this as a breaking change.
| return bucket, path, true | ||
| } | ||
|
|
||
| func (h *EpisodeHandler) GetEpisodePresignedURL(c *gin.Context) { |
There was a problem hiding this comment.
WARNING: Missing authentication check
GetEpisodePresignedURL has no auth verification, unlike StorageHandler.PresignGetObject which validates a Bearer token via auth.ParseToken. The episode routes are registered under v1Routes with no middleware (see server.go:211), so each handler is responsible for its own auth. Without this check, any unauthenticated caller can obtain presigned S3 URLs for any episode by numeric ID.
| e.checksum, | ||
| COALESCE(e.qa_status, '') as qa_status, | ||
| COALESCE(e.qa_score, 0) as qa_score, | ||
| e.qa_score, |
There was a problem hiding this comment.
WARNING: Behavioral API change — qa_score null handling
Previously COALESCE(e.qa_score, 0) ensured episodes without a QA score returned "qa_score": 0. Now null database values propagate as "qa_score": null in the JSON response. This changes the API contract for any consumer expecting a numeric default.
Code Review SummaryStatus: 3 Issues Found | Recommendation: Address before merge Overview
Issue Details (click to expand)WARNING
Other Observations (not in diff)
Files Reviewed (6 files)
Incremental review: checked new commits since Fix these issues in Kilo Cloud Reviewed by glm-5 · 112,320 tokens |
Pull Request Checklist
Please ensure your PR meets the following requirements:
Summary
This PR adds UI-related backend enhancements including S3 presigned URL endpoints for frontend file access, expanded episode API with more metadata fields, improved task-episode linking, and batch task timestamp improvements.
Motivation
The frontend (synapse) requires access to MCAP and sidecar files stored in MinIO/S3 without exposing direct S3 credentials. Additionally, the episode and task detail APIs need richer data to display comprehensive information to operators and administrators.
Changes
Modified Files
assigned_atfield to task creation queries; fixed DATE_FORMAT template literalAdded Files
/storage/presignendpoint for generating S3 presigned URLsType of Change
Impact Analysis
Breaking Changes
None
Backward Compatibility
Fully backward compatible. New endpoints are additive. Existing API responses include additional fields but maintain backward compatibility.
Testing
Test Environment
Local development with MySQL and MinIO
Test Cases
Manual Testing Steps
GET /api/v1/episodes/:id/presign?kind=mcapreturns valid URLGET /api/v1/storage/presign?bucket=test&object=file.mcapreturns valid URLTest Coverage
Screenshots / Recordings
Performance Impact
Documentation
Related Issues
Additional Notes
KEYSTONE_AUTH_ALLOW_NO_AUTH_ON_DEVis enabledReviewers
@kilo-code-bot
Notes for Reviewers
Checklist for Reviewers