Make artifact and media metadata first-class server records
Artifact and media metadata were previously reconstructed from job result refs and JSON sidecar files. This change regularizes metadata into SQLite, keeps filesystem blobs in place, and preserves backward compatibility via lazy fallback and backfill from existing job refs and JSON metadata. Constraint: Blob storage remains on the local filesystem in this phase Rejected: Migrate blobs into SQLite | larger scope and worse operational profile for current media sizes Rejected: Hard cutover without fallback | unsafe for historical data already on the test server Confidence: medium Scope-risk: moderate Directive: Treat SQLite as the metadata source of truth; JSON sidecars are compatibility fallback only Tested: go test ./...; deployed to test server 101.42.99.35; verified /v1/artifacts, /v1/artifacts/:id, signed media URL 200, unsigned content 401 Not-tested: Full historical backfill sweep over all existing artifact rows under production-sized data volume
This commit is contained in:
+20
-13
@@ -90,19 +90,26 @@ type logEntry struct {
|
||||
}
|
||||
|
||||
type artifact struct {
|
||||
ID string `json:"id"`
|
||||
JobID string `json:"job_id"`
|
||||
MediaID string `json:"media_id,omitempty"`
|
||||
Filename string `json:"filename"`
|
||||
ContentType string `json:"content_type"`
|
||||
SizeBytes int64 `json:"size_bytes"`
|
||||
CreatedAt string `json:"created_at"`
|
||||
ExpiresAt string `json:"expires_at"`
|
||||
URL string `json:"url,omitempty"`
|
||||
Visibility string `json:"visibility,omitempty"`
|
||||
SHA256 string `json:"sha256,omitempty"`
|
||||
StorageStatus string `json:"storage_status,omitempty"`
|
||||
Ref resultRef `json:"-"`
|
||||
ID string `json:"id"`
|
||||
JobID string `json:"job_id"`
|
||||
ProjectID string `json:"project_id,omitempty"`
|
||||
MediaID string `json:"media_id,omitempty"`
|
||||
Filename string `json:"filename"`
|
||||
ContentType string `json:"content_type"`
|
||||
SizeBytes int64 `json:"size_bytes"`
|
||||
CreatedAt string `json:"created_at"`
|
||||
ExpiresAt string `json:"expires_at"`
|
||||
URL string `json:"url,omitempty"`
|
||||
Visibility string `json:"visibility,omitempty"`
|
||||
SHA256 string `json:"sha256,omitempty"`
|
||||
StorageStatus string `json:"storage_status,omitempty"`
|
||||
SourceSkillID string `json:"source_skill_id,omitempty"`
|
||||
SourceModelID string `json:"source_model_id,omitempty"`
|
||||
SourceRouteKey string `json:"source_route_key,omitempty"`
|
||||
SourceInput map[string]any `json:"source_input,omitempty"`
|
||||
PromptText string `json:"prompt_text,omitempty"`
|
||||
Usage map[string]any `json:"usage,omitempty"`
|
||||
Ref resultRef `json:"-"`
|
||||
}
|
||||
|
||||
type media struct {
|
||||
|
||||
Reference in New Issue
Block a user