perf(worker): 附件内容 hash 去重(#387)#393
Merged
Merged
Conversation
之前上传 object 用随机 uuid 命名,同一文件重复上传就在 R2 里存多份。改成按内容 sha256 命名:object key = <slug>/<sha256>/<filename>。同频道内同内容+同名重复上传落 到同一 key,先 head 检查命中就跳过 put——省 R2 存储 + 上行带宽;hash 即完整性锚。 key 前缀仍锚定 slug 做跨频道隔离(安全边界不动)。旧 uuid-key 的存量附件照常解析 (key 存在引用里,下载不受影响),向后兼容。 验证:worker 全量 + 附件 round-trip 测试全过(新增去重断言:同内容同名→同 key、 不同内容→不同 key、去重命中后仍可下载)、tsc 干净。 Closes #387 Claude-Session: https://claude.ai/code/session_01PgxkZeqJmDge3dYe9W2tPZ
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
PR Code Suggestions ✨Explore these optional code suggestions:
|
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.
附件 object 之前用随机 uuid 命名,同文件重复上传在 R2 存多份。改成按内容 sha256 命名:key =
<slug>/<sha256>/<filename>。同频道同内容+同名重复上传落同一 key,head 命中就跳过 put——省存储+带宽,hash 即完整性锚。key 前缀仍锚定 slug(跨频道隔离不动);旧 uuid-key 存量附件照常解析,向后兼容。
worker 全量 + 附件 round-trip 全过(新增去重断言)、tsc 干净。
Closes #387