feat(objectql): resolve file-field id references on read — ADR-0104 D3 wave 2 (PR-2)#3473
Merged
Conversation
…3 wave 2 (PR-2)
The engine read path resolves a file/image/avatar/video/audio value stored as
an opaque sys_file id into its expanded FileValueSchema form
({id,name,size,mimeType,url}; url derived from /files/:fileId, never stored),
via one batched sys_file `id $in […]` read (no N+1), mirroring lookup-$expand.
Dual-mode safe: inline-blob objects pass through; only an id-shaped token
(uuid/nanoid, never url-shaped) is a reference — a https//api//data:/blob:
value a file field legitimately holds is never looked up (regression-tested).
Fires zero reads unless a file field holds an id token, and no-ops when sys_file
is unregistered — so the always-on step is free for objects that have not
adopted references.
Tests: 5 new engine cases (resolution, one-batched-query/no-N+1, blob+url
dual-mode passthrough, url/data-URI never queried, non-committed skip);
objectql 1068 green; field-zoo dogfood roundtrip green (12.6s, no bogus
sys_file queries).
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 1 package(s): 13 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 17:01
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 的 PR-2——读路径把文件字段的
sys_fileid 引用解析成展开形态。承接 PR-1(#3466,上传提交返回 fileId)。跟踪:#3459。改动
引擎读路径新增一步:
file/image/avatar/video/audio字段若存的是sys_file的 opaque id,读取时原地解析成展开形态{ id, name, size, mimeType, url }——url由稳定解析器/api/v1/storage/files/:fileId派生、永不落库。一次批量sys_fileid $in […]读(禁 N+1),沿用 lookup-$expand的批量模式。双模式安全(关键)
https://…、/api/…、data:…、blob:…)——这些一律不查。sys_file未注册 → 整步 no-op。所以这个 always-on 步骤对尚未采用引用的对象是免费的。测试
sys_file查询——证明真机读路径无回归)序列位置
PR-2/7。下一步 PR-3:字段引用行(泛化
sys_attachment计数)。破坏性/不可逆步骤(PR-5 写切换+GC、PR-6 迁移)排最后,带 R4/R5/R6 门,等你明确点头。🤖 Generated with Claude Code
https://claude.ai/code/session_01SHpGw3GBA9aFpfwVArRWfd
Generated by Claude Code