Skip to content

Fix getUniformRun - #28014

Merged
Craig Macomber (Microsoft) (CraigMacomber) merged 3 commits into
microsoft:mainfrom
CraigMacomber:getUniformRun
Aug 19, 2026
Merged

Fix getUniformRun#28014
Craig Macomber (Microsoft) (CraigMacomber) merged 3 commits into
microsoft:mainfrom
CraigMacomber:getUniformRun

Conversation

@CraigMacomber

Copy link
Copy Markdown
Contributor

Description

Fix a bug in buildNodeComparator where it mishandled optional fields.

This results in fixing a user facing bug in FormattedText.Members.getUniformRun.

Reviewer Guidance

The review process is outlined on this wiki page.

Copilot AI lite review requested due to automatic review settings August 19, 2026 07:16
@github-actions github-actions Bot added area: tools area: dds Issues related to distributed data structures area: repo Repo related work area: website area: dds: tree changeset-present base: main PRs targeted against main branch labels Aug 19, 2026
@github-actions

github-actions Bot commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

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

Based on the diff (117 lines, 4 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

---
Formatted text uniform runs now account for optional formatting fields

`FormattedText.Members.getUniformRun` now ends a uniform run when an optional formatting field is present on only one side of a character boundary.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I'd link this, but our API docs site is not up to date and FormattedText is missing. Seems like its multiple releases out of date?

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.

I'll investigate this later today.

Copilot AI left a comment

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.

Pull request overview

This PR fixes a comparison bug in buildNodeComparator that could treat nodes as equal even when their optional fields (or even node types) differ, which surfaced as incorrect behavior in FormattedText.Members.getUniformRun.

Changes:

  • Update buildNodeComparator to compare node types and to reject nodes with additional/missing fields (fixing optional-field handling).
  • Add targeted unit tests covering optional formatting fields and comparator correctness for type/field mismatches.
  • Add a changeset documenting the user-facing behavioral fix.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
packages/dds/tree/src/feature-libraries/cursorComparator.ts Fix comparator logic to account for type and optional/extra fields (hot-path optimized).
packages/dds/tree/src/test/feature-libraries/cursorComparator.spec.ts Add regression tests for type mismatch and additional-field rejection.
packages/dds/tree/src/test/text/textDomainFormatted.spec.ts Add regression test for getUniformRun behavior when optional format fields differ across a boundary.
.changeset/fix-formatted-text-uniform-runs.md Document the behavior change in release notes.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread packages/dds/tree/src/feature-libraries/cursorComparator.ts
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@github-actions

Copy link
Copy Markdown
Contributor

Bundle size comparison

Base commit: 4b2f54d10f10a46d9ef1c09b5b89f8e9adc2c9cb
Head commit: c40bb42286a64a5e8e0cebc258e3e3837ea1ba41

Pending — Build - client packages is running. Results will appear here when the build completes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: dds: tree area: dds Issues related to distributed data structures area: repo Repo related work area: tools area: website base: main PRs targeted against main branch changeset-present

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants