Skip to content

fix(postprocess): enforce container provenance in stationary move check - #247

Merged
HarshK97 merged 1 commit into
mainfrom
fix/stationary-move-container-provenance
Oct 10, 2026
Merged

HarshK97 merged 1 commit into
mainfrom
fix/stationary-move-container-provenance

Conversation

@HarshK97

Copy link
Copy Markdown
Owner

Problem

  1. When deletions shift lines up, an item moved into a different container can land on the exact row and column where an old element used to sit.
  2. isStationaryMove only checked coordinates within the enclosing function. Because the line and column numbers matched, it assumed the node never moved and dropped the move highlight entirely.

What Changed

  • Check container provenance before treating matching coordinates as stationary. The destination container actually has to map back to an old container that held this node (and vice versa). If they're distinct containers, we keep the move.
  • Reorder checks in isStationaryMove so direct parent checks and stationary expression moves are evaluated in the right order.
  • Add a regression test in internal/postprocess/normalize_test.go where an item moves between two slice literals and lands on the exact same row and column coordinates.

When code deletions shift lines up, elements in a different container
can land on the exact row and column where an old element used to be.
isStationaryMove previously checked only row and column coordinates
within the enclosing scope, treating cross-container moves as stationary
and dropping their move highlights.

Require that dstParent's source mapping actually contained the node
(and vice versa) before treating matching coordinates as stationary.

- postprocess: check container provenance in isStationaryMove
- tests: add regression test for cross-container coordinate collision
@HarshK97
HarshK97 merged commit 47af101 into main Oct 10, 2026
17 checks passed
@HarshK97
HarshK97 deleted the fix/stationary-move-container-provenance branch October 10, 2026 14:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant