Skip to content

fix: prevent self-merge in consolidateDuplicates (issue #25)#26

Merged
tryweb merged 1 commit intomainfrom
ci/node-24-matrix
Mar 27, 2026
Merged

fix: prevent self-merge in consolidateDuplicates (issue #25)#26
tryweb merged 1 commit intomainfrom
ci/node-24-matrix

Conversation

@tryweb
Copy link
Copy Markdown
Owner

@tryweb tryweb commented Mar 27, 2026

Summary

  • Fix bug where consolidateDuplicates could produce self-referencing records
  • When two records have identical timestamps, they could be treated as merge candidates with themselves
  • Added ID check before merge to skip self-merge cases

Changes

const older = a.row.timestamp <= b.row.timestamp ? a.row : b.row;
const newer = a.row.timestamp <= b.row.timestamp ? b.row : a.row;

+// Skip self-merge: when timestamps are equal, both could reference the same record
+if (older.id === newer.id) {
+  continue;
+}

Fixes #25

@tryweb tryweb merged commit fb8235f into main Mar 27, 2026
9 checks passed
@tryweb tryweb deleted the ci/node-24-matrix branch March 27, 2026 10:18
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.

[Bug] consolidateDuplicates 發生自我合併 - mergedFrom 指向自己的 ID

1 participant