Backtestsvuerun-20261001-022054#12124
defineCustomElement can accidentally override members of the Element prototype
Better
Our patch was judged better than the merged fix.
In this judgment, Patch A = our agent, Patch B = the merged fix.
Both patches add a dev warning for prop names that collide with inherited element members. Patch A goes further and fixes the harmful part of the issue: when the colliding native member is read-only (e.g. `tagName`), it skips defining the accessor, so `Element.prototype.tagName` semantics are preserved. Its descriptor walk in `_isReadonlyNativeProp` decides this. The prop still works in both directions. The `tag-name` attribute maps to the prop, and Vue-rendered vnode props are routed through `_setProp` in `patchDOMProp`, so setting a getter-only property never fails. Writable conflicts such as `title` still get the accessor, with a warning. Patch A's tests cover the attribute path, the vnode-prop path (including no 'Failed setting prop' warning), and the writable-property case; each would fail before the change. Patch B only emits a warning and keeps overwriting. Its own test asserts `e.tagName === 'foo'`, which codifies the broken behavior the issue complains about: code relying on `tagName` breaks silently in production, where the warning is stripped. The issue does list a warning as an acceptable outcome, so B is minimally responsive. A is more invasive: it adds a per-call check in `patchDOMProp` for Vue CEs and a helper that scans `_def.props`. That cost is modest, well-gated by `_isVueCE` and the read-only check, and buys a real fix at the root cause rather than just surfacing the symptom. On correctness, A is clearly stronger.
The judge saw only the two patches, labelled A and B in random order, with issue links and version numbers removed. The reasoning above is shown verbatim.
Solve
7m 34s16 turns
Wall-clock time in the container
Full test suite
No new failures
3,667 passed · 6 skipped · 3,673 total
Contamination audit
Clean
No sign the agent saw the real fix
Patch size
131vs 79 merged
Changed lines, ours vs merged
The issue
View on GitHubVue version
3.4.5
Link to minimal reproduction
https://stackblitz.com/edit/vitejs-vite-aob5zf?file=index.html
Steps to reproduce
I defined a Vue component with tagName as a property, and used that, together with defineCustomElement to define the hello-world webcomponent.