Expansion drops Annotations that carry multiple bodies
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 48/100
- Issue 类型
- 缺陷
- 描述清晰度
- 基本清楚
- 活跃度
- 冷清
- 技术栈
- javascript
调研方向
从 controllers/crud.js 和 assertionsFrom() 开始,然后检查 controllers/gog.js 中的 expand()、findLeafAnnotationsFor() 以及 Annotations-Merged 响应处理。明确应如何处理数组 body 和多键对象 body,并确保展开结果与 merge 计数一致;payload 未指定测试路径,因此完成时应包含对所述行为的覆盖。
由索引模型根据 Issue 内容生成。
描述
Split out of the static review of #286 so it does not block that PR.
What happens now
assertionsFrom() in controllers/crud.js returns early on an Array body:
if (!body || typeof body !== "object" || Array.isArray(body)) return assertions
An Annotation carrying multiple bodies is still gathered by findLeafAnnotationsFor() and still counted in the Annotations-Merged response header, but contributes nothing to the expanded entity. From the client's side that reads as a nonzero merge count with no merged data.
expand() in controllers/gog.js now skips them explicitly too (added in #286 — previously a one element Array body merged onto the entity under the key "0").
Why it matters
The W3C model explicitly allows multiple bodies, and each element is usually an ordinary single-key assertion rather than a structural construct. Real examples already in annotationStore.alpha:
[{"contributor":{"label":"Dunbar, Paul Laurence","id":"http://viaf.org/viaf/76335432"}},
{"issued":"1895-04-17"},
{"identifier":"Box 1, F1"},
{"uri":"https://udspace.udel.edu/handle/..."}]
Current impact: none
Measured against production at the time of the #286 review:
- 911 leaf Annotations have an Array
body - 0 of them target a
rerum.io/v1/id/URI under any of the six keys inTARGET_KEYS
Since /v1/id/:_id/expanded only expands RERUM-stored entities, nothing reachable through the endpoint is affected today. This is a gap that surfaces the first time an app writes a multi-body Annotation onto a RERUM entity.
Possible approach
Each element is typically itself a single assertion, so the existing logic handles them if it recurses:
if (Array.isArray(body)) {
for (const one of body) assertions.push(...assertionsFrom({ body: one }))
return assertions
}
Worth deciding at the same time:
- whether
Annotations-Mergedshould count Annotations gathered or Annotations that actually contributed an assertion - whether
controllers/gog.jsexpand()should follow, or stay on single-body-only for its DEER-shapedvalueObjectwrapping
Related
Multi-key object bodies (not Arrays) are also dropped whole rather than partially, by the keys.length !== 1 check. Only 1 such document exists in production, so it was not worth acting on separately, but it is the same design question.
Reference
- W3C Web Annotation Data Model, multiple bodies: https://www.w3.org/TR/annotation-model/#multiple-bodies
- 主要语言
- JavaScript
- 星标
- 3
- 派生
- 6
- 平均合并
- 4 天 9 小时
- 30 天内合并 PR
- 5
环境准备
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
CenterForDigitalHumanities/rerum_server_nodejs 的其他 Issue
-
bug documentation
难度 2/5 1-3 小时 新手友好度 88/100
-
backend dependencies easy
难度 2/5 1-3 小时 新手友好度 84/100
-
难度 2/5 1-3 小时 新手友好度 82/100
CenterForDigitalHumanities/rerum_server_nodejs#290 · 1 条评论 ·
-
难度 4/5 3-5 天 新手友好度 50/100
-
难度 3/5 1-2 天 新手友好度 74/100
查看 CenterForDigitalHumanities/rerum_server_nodejs 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 68/100
-
难度 2/5 1-3 小时 新手友好度 74/100
solana-foundation/solana-com#2202 ·
维护者通常 1 天内回复
-
难度 1/5 1 小时以内 新手友好度 92/100
yegor256/copyrights-action#216 ·
-
[BUG] onScroll never refreshes the window container's height after a vertical-only viewport resize未关闭
难度 2/5 1-3 小时 新手友好度 88/100
juliangarnier/anime#1192 ·
-
难度 2/5 1-3 小时 新手友好度 84/100
PedestrianDynamics/pyFDS-Evac#226 ·
维护者通常 1 天内回复