feat(storage): surface sys_file id on upload-complete — ADR-0104 D3 wave 2 (PR-1)#3466
Merged
Conversation
…ave 2 (PR-1) POST /api/v1/storage/upload/complete now returns the opaque sys_file id (data.fileId), and client.storage.upload() surfaces it on the returned FileMetadata. Previously the commit response omitted the id, so a caller could not learn which id to persist — a file field could never store a reference. Additive/non-breaking: new optional fileId on FileMetadataSchema; the client falls back to the presigned id against an older server. The enabling foundation for file-as-reference; the storage model is unchanged here. Tests: service-storage 99 green (complete-response fileId asserted); spec storage schemas green; client typecheck clean; generated storage reference doc regenerated. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SHpGw3GBA9aFpfwVArRWfd
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
📓 Docs Drift CheckThis PR changes 3 package(s): 110 hand-written doc(s) reference the affected code and may need an implementation-accuracy re-verification:
|
os-zhuang
marked this pull request as ready for review
July 24, 2026 15:50
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
ADR-0104 D3 wave 2(file-as-reference,搭 v17)的 PR-1——安全的附加地基。跟踪:#3459。
问题
POST /api/v1/storage/upload/complete的响应不含fileId(storage-routes.ts),client.storage.upload()明明手里有presigned.fileId却把它丢了、原样返回不含 id 的 complete 响应。结果:上传提交后调用方拿不到该存进文件字段的那个 id——文件字段永远无法存引用。这是 wave 2 一切下游的前置。改动(附加、非破坏)
FileMetadataSchema(object-storage.zod.ts)新增可选fileId。/upload/complete响应data带上fileId(= 已提交的sys_file.id)。client.storage.upload()在返回的FileMetadata上透出fileId;对旧服务端回退到presigned.fileId,所以新客户端连旧服务端也拿得到 id。存储模型本身未改——本 PR 只是补上"提交后能拿到 id"这一环。
测试
fileId已断言)object-storage参考文档已同步序列位置
PR-1/7。下一步 PR-2:读路径
fileId → FileValueSchema解析(批量、禁 N+1)+ 遗留内联 blob 双读归一。破坏性/不可逆步骤(PR-5 写切换+GC、PR-6 迁移)排最后,带 R4/R5/R6 门。🤖 Generated with Claude Code
https://claude.ai/code/session_01SHpGw3GBA9aFpfwVArRWfd
Generated by Claude Code