fix: use Object.hasOwn instead of in operator in usage bar translator#98139
fix: use Object.hasOwn instead of in operator in usage bar translator#98139zhangLei99586 wants to merge 2 commits into
Conversation
|
Codex review: needs changes before merge. Reviewed July 1, 2026, 5:14 AM ET / 09:14 UTC. Summary PR surface: Source 0, Tests +25. Total +25 across 2 files. Reproducibility: yes. Source inspection of current main and Review metrics: none identified. Root-cause cluster Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Risk before merge
Maintainer options:
Next step before merge
Security Review findings
Review detailsBest possible solution: Keep the Do we have a high-confidence way to reproduce the issue? Yes. Source inspection of current main and Is this the best way to solve the issue? Mostly yes. The production Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against f3ac874fd215. Label changesLabel justifications:
Evidence reviewedPR surface: Source 0, Tests +25. Total +25 across 2 files. View PR surface stats
Acceptance criteria:
What I checked:
Likely related people:
What the crustacean ranks mean
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics. How this review workflow works
|
zhangLei99586
left a comment
There was a problem hiding this comment.
@clawsweeper re-review
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. |
|
@clawsweeper review |
The 'in' operator checks the prototype chain, so keys like 'toString', 'valueOf', or 'constructor' would incorrectly match inherited properties on vocabulary alias tables and segment case tables. Replace with Object.hasOwn() which only checks own properties.
Add focused tests proving Object.hasOwn correctly distinguishes own properties from inherited Object.prototype keys (toString, constructor) in both alias vocabulary lookup and segment case table lookup.
c9d9f0e to
94a5d9b
Compare
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. |
|
@clawsweeper re-review |
|
@clawsweeper re-review |
1 similar comment
|
@clawsweeper re-review |
|
@clawsweeper re-review |
2 similar comments
|
@clawsweeper re-review |
|
@clawsweeper re-review |


Related: #98466
What Problem This Solves
key in tablechecks prototype chain —toString/constructormatchObject.prototypeinstead of fallthrough.Why This Change Was Made
Replace
key in tablewithObject.hasOwn(table, key)in alias + case table lookup (2 lines).User Impact
Fixes incorrect usage bar rendering when keys coincide with prototype names.
Evidence
Runtime terminal proof (Node v24.13.1):
translator.test.ts)renderUsageBar(tpl, {m:"toString"}) → "owned-value"— Object.hasOwn verified