Skip to content

fix(property-changeset): don't throw on a duplicate identical insert into an indexed collection#27702

Open
arafat-java wants to merge 1 commit into
microsoft:mainfrom
arafat-java:fix/property-changeset-duplicate-insert-nop
Open

fix(property-changeset): don't throw on a duplicate identical insert into an indexed collection#27702
arafat-java wants to merge 1 commit into
microsoft:mainfrom
arafat-java:fix/property-changeset-duplicate-insert-nop

Conversation

@arafat-java

Copy link
Copy Markdown
Contributor

Description

ChangeSetIndexedCollectionFunctions's merge logic throws CS-003: Internal error: Added an already existing entry: <key> whenever an incoming insert's key already has an insert recorded in the base ChangeSet — even when the two inserts are identical (e.g. from a duplicated or replayed op). Since this runs on the normal op-processing path (SharedPropertyTree._applyRemoteChangeSetprocessMessage), a duplicate op can put a document's summarizer into a crash-loop.

This PR treats an insert that exactly matches the already-recorded insert for the same key as a safe no-op, for both primitive and typed/polymorphic collections. A mismatched value for the same key is still treated as a genuine conflict and continues to throw.

To reproduce: apply a ChangeSet insert for a key to a base ChangeSet that already has an identical insert for that same key (see the new test cases in indexedCollection.spec.ts for a minimal repro). Before this change that throws; after, it's a no-op.

Reviewer Guidance

I haven't been able to run this package's own test suite locally yet (environment setup issue unrelated to this change — Azure DevOps Artifacts feed auth). The two new test cases closely follow this file's existing patterns, and the equivalent fix (applied to the compiled/patched form of this exact function) has been running against a real local Fluid server with 113 passing tests in a downstream consumer — but I'd like CI/a reviewer to confirm this package's own suite passes before merging. Opening as a draft until I can confirm locally.

…into an indexed collection

Merging a ChangeSet into an indexed (set/map-typed) collection throws
"CS-003: Internal error: Added an already existing entry" whenever the
incoming insert's key already has an insert recorded in the base
ChangeSet — even when the two inserts are identical, e.g. from a
duplicated or replayed op. Since this runs on the normal op-processing
path, a duplicate op can crash-loop a document's summarizer.

Treat an insert that exactly matches the already-recorded insert for
the same key as a safe no-op, for both primitive and typed/polymorphic
collections. A mismatched value for the same key is still a genuine
conflict and continues to throw.
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
1 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

@arafat-java
arafat-java marked this pull request as ready for review July 16, 2026 13:39
@arafat-java
arafat-java requested a review from a team as a code owner July 16, 2026 13:39
Copilot AI review requested due to automatic review settings July 16, 2026 13:39
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
1 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

@github-actions

Copy link
Copy Markdown
Contributor

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

Based on the diff (68 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

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.

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

@dannimad dannimad 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.

Do not merge until the release process is complete

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