[JsRuntimeHost] Hermes: two upstream conformance gaps worked around in the unit tests (for...in shadowing, napi ToObject)
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 25/100
- Issue 类型
- 缺陷
- 描述清晰度
- 基本清楚
- 活跃度
- 冷清
- 技术栈
- cpp, javascript
- 领域
- testing
调研方向
Start with the forInHonoursShadowing probe and the napiEngine === "Hermes" skips in Tests/UnitTests/Scripts/tests.ts. The upstream defects are in lib/VM/JSObject.cpp (appendAllPropertyKeys) and API/napi/hermes_napi_object.cpp, so you need a local Hermes build at the pinned SHA to reproduce them. Done means both repros are confirmed on that build, with the workaround state recorded, before anything is filed upstream.
由索引模型根据 Issue 内容生成。
描述
[Filed by Copilot on behalf of @bghgary]
Tracks two distinct Hermes conformance gaps that BabylonJS/JsRuntimeHost#218 works around in Tests/UnitTests/Scripts/tests.ts. They are in different layers of Hermes and neither is fixable here — this issue exists so the workarounds have a referent and can be removed when upstream fixes them.
Hermes is pinned in the top-level CMakeLists.txt to facebook/hermes static_h at 348582831f50954895da8e80cc91112d51036c69 (tip as of 2026-06-03).
1. for...in reports a property shadowed by a non-enumerable own property
Layer: Hermes VM (lib/VM/JSObject.cpp)
Per spec, for...in adds every own key to its visited set regardless of enumerability, but only emits the enumerable ones. A non-enumerable own property must therefore hide a same-named enumerable inherited one.
const parent = { shared: 1 };
const child = Object.create(parent);
Object.defineProperty(child, "shared", { value: 2, enumerable: false });
const keys = [];
for (const k in child) { keys.push(k); }
// expected: [] (child.shared is 2; the inherited 1 is unreachable)
// Hermes: ["shared"]
Multi-level, same cause:
const gp = { deep: 0 };
const mid = Object.create(gp);
mid.middle = 1;
Object.defineProperty(mid, "deep", { value: 9, enumerable: false });
const leaf = Object.create(mid);
leaf.own = 3;
// expected: ["own", "middle"]
// Hermes: ["own", "middle", "deep"]
Plain inheritance with no shadowing behaves correctly, so this is specific to the shadowing rule rather than enumeration generally.
Cause, from appendAllPropertyKeys in lib/VM/JSObject.cpp at the pinned SHA: own keys are collected with OwnKeysFlags().plusIncludeNonSymbols().plusKeepSymbols() — no IncludeNonEnumerable — so enumerableProps holds only enumerable own properties. The dedup set is populated exclusively by addToDedup, which is called only after a property has been pushed. A non-enumerable own property is therefore never collected and never deduped, so the inherited one is emitted.
Notably Hermes' own Node-API implementation gets this right, and deliberately — API/napi/hermes_napi_object.cpp sets okFlags.plusIncludeNonEnumerable() with the comment "Always include non-enumerable so we can post-filter uniformly", and inserts into seenKeys before applying the enumerable filter. So the two enumeration paths inside Hermes disagree with each other.
Impact here: none on our behaviour — napi_get_property_names is correct on Hermes. It only means Hermes' for...in cannot be used as a test oracle. BabylonJS/JsRuntimeHost#218 handles this with a runtime probe (forInHonoursShadowing) rather than naming the engine, so it self-heals if upstream fixes it.
Evidence: source inspection at the pinned SHA, plus an empirical repro on the prebuilt Hermes CLI v0.13.0, which reproduces both cases above (V8 is correct on both). See the caveat below.
2. napi_get_property_names rejects primitives instead of applying ToObject
Layer: Hermes Node-API (API/napi/hermes_napi_object.cpp)
Node-API specifies the argument is coerced with ToObject, so a primitive is wrapped and its properties reported — napi_get_property_names("ab") should yield ["0", "1"]. V8 does this via CHECK_TO_OBJECT.
Hermes' napi_get_all_property_names (which napi_get_property_names delegates to) instead does:
RETURN_STATUS_IF_FALSE(
env, objPhv != nullptr && objPhv->isObject(), napi_object_expected);
so any non-object is rejected outright with no coercion path.
Impact here: the primitive-wrapping cases in BabylonJS/JsRuntimeHost#218's argument coercion block are skipped on Hermes.
Evidence: source inspection at the pinned SHA only — see below.
Before filing upstream
facebook/hermes is actively maintained and responsive, but two recent issues were closed as suspected AI-generated spam specifically for lacking a minimal repro, and maintainers routinely distinguish between stable, static_h and V1 when triaging. So neither of these should be filed upstream until:
- Issue 1 is reproduced against the pinned
static_hSHA, not just v0.13.0. The current repro is roughly two years older than the pin; inspection at the pin shows the same defect, but that is not the same as running it. - Issue 2 has any runnable repro. It is a Node-API entry point and is not reachable from the
hermes.exeCLI, so there is currently no empirical evidence at all.
Building this repo's Hermes leg locally satisfies both: it uses the exact pinned SHA and exposes the Node-API surface.
Removing the workarounds
Both live in Tests/UnitTests/Scripts/tests.ts:
- Issue 1 — the
forInHonoursShadowingprobe. Nothing to do; it starts usingfor...inas an oracle again once upstream is fixed. - Issue 2 — the
napiEngine === "Hermes"skip on the primitive cases. Un-skip once upstream appliesToObject.
- 主要语言
- C++
- 星标
- 931
- 派生
- 169
- 平均合并
- 2 天 17 小时
- 30 天内合并 PR
- 66
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
BabylonJS/BabylonNative 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 72/100
BabylonJS/BabylonNative#2138 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 78/100
BabylonJS/BabylonNative#2042 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 70/100
BabylonJS/BabylonNative#2052 ·
维护者通常 1 天内回复
-
testing
难度 4/5 3-5 天 新手友好度 45/100
BabylonJS/BabylonNative#2136 ·
维护者通常 1 天内回复
-
Support useNDCHalfZRange (half-range NDC depth) so Babylon.js half-range depth visual tests can run可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭
难度 4/5 3-5 天 新手友好度 48/100
BabylonJS/BabylonNative#2134 ·
维护者通常 1 天内回复
查看 BabylonJS/BabylonNative 的全部 Issue
相似的 Issue
-
Make the HTTP server's keep-alive and headers timeouts configurable可能已有人在做 @mattgodbolt 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 76/100
compiler-explorer/compiler-explorer#9902 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 72/100
Nixtla/statsforecast#1371 ·
维护者通常 1 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复
-
[Bug]: pip install -U cudaq-qec fails with a conflict that names cudaq-qec itself可能已有人在做 @fedonman 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 72/100
维护者通常 1 天内回复
-
task
难度 2/5 1-3 小时 新手友好度 76/100
SparseLinearAlgebra/spla#316 · 1 条评论 ·
维护者通常 1 天内回复