Skip to content

tree: Fix bug with node existence revert constraint#27492

Open
alex-pardes wants to merge 2 commits into
microsoft:mainfrom
alex-pardes:revert-constraint-fix
Open

tree: Fix bug with node existence revert constraint#27492
alex-pardes wants to merge 2 commits into
microsoft:mainfrom
alex-pardes:revert-constraint-fix

Conversation

@alex-pardes
Copy link
Copy Markdown
Contributor

Description

Fixed a bug where if a node existence revert constraint was placed on a node moved in the same transaction, the revert constraint would be violated when rebasing over any change. This PR changes the implementation of the node existence revert constraint to detect violations during invert instead of during rebasing.

Copilot AI review requested due to automatic review settings June 5, 2026 01:33
@alex-pardes alex-pardes requested a review from a team as a code owner June 5, 2026 01:33
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 5, 2026

Hi! Thank you for opening this PR. Want me to review it?

Based on the diff (94 lines, 3 files), I've queued these reviewers:

  • Correctness — logic errors, race conditions, lifecycle issues
  • Security — vulnerabilities, secret exposure, injection
  • API Compatibility — breaking changes, release tags, type design
  • Performance — algorithmic regressions, memory leaks
  • Testing — coverage gaps, hollow tests

How this works

  • Adjust the reviewer set by ticking/unticking boxes above. Reviewer toggles alone don't trigger anything.

  • Tick Start review below to dispatch the review fleet.

  • After review finishes, tick Start review again to request another run — it auto-resets after each dispatch.

  • This comment updates as new commits land; your reviewer selections are preserved.

  • Start review

stack.unsubscribe();
});

it("inverse node existence constraint not violated by unrelated change on moved node", () => {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
it("inverse node existence constraint not violated by unrelated change on moved node", () => {
it("inverse node existence constraint on moved node not violated by unrelated change", () => {

const handler = getChangeHandler(this.fieldKinds, field.fieldKind);
for (const [nodeId, inputIndex, outputIndex] of handler.getNestedChanges(field.change)) {
for (const [nodeId, inputIndex, _outputIndex] of handler.getNestedChanges(
field.change,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like this was the only code path where the output index was used. You could remove it from the getNestedChanges contract (and all computations of it) as part of this PR, or we could do that in a separate PR, I don't mind.

@jason-ha jason-ha self-requested a review June 5, 2026 23:22
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.

3 participants