An id-less top level script: entry parses to a synthetic location (script_<index>), and _upsert_top_level_list matches list items by their id field, so a replace aimed at that synthetic id matches nothing and appends a duplicate instead. The guarded path (#2788, save or expected) refuses this after the fact; the editor's auto-apply path is unguarded by design (parse free per keystroke) and returns a success diff with the duplicate.
Fix belongs in the writer: resolve a synthetic script_<index> location positionally when no item carries that id, the way _require_instance already falls back to the parser's positional label for id-less component instances, so the replace lands on the row the parser listed.
Raised by esphbot on #2788.
An id-less top level
script:entry parses to a synthetic location (script_<index>), and_upsert_top_level_listmatches list items by theiridfield, so a replace aimed at that synthetic id matches nothing and appends a duplicate instead. The guarded path (#2788,saveorexpected) refuses this after the fact; the editor's auto-apply path is unguarded by design (parse free per keystroke) and returns a success diff with the duplicate.Fix belongs in the writer: resolve a synthetic
script_<index>location positionally when no item carries that id, the way_require_instancealready falls back to the parser's positional label for id-less component instances, so the replace lands on the row the parser listed.Raised by esphbot on #2788.