Skip to content

fix(app): deduplicate diff summaries linearly#37414

Merged
Hona merged 1 commit into
anomalyco:devfrom
Hona:linear-diff-dedup
Jul 17, 2026
Merged

fix(app): deduplicate diff summaries linearly#37414
Hona merged 1 commit into
anomalyco:devfrom
Hona:linear-diff-dedup

Conversation

@Hona

@Hona Hona commented Jul 17, 2026

Copy link
Copy Markdown
Member

Summary

  • replace quadratic timeline diff-summary deduplication with a Set-backed reverse scan
  • preserve legacy filtering, ordering, last-duplicate selection, and object identity

Fixes #33106.

Verification

  • black-box differential check: 21,845 input sequences matched legacy output order and identity
  • focused unit tests pass
  • app typecheck passes
  • app build passes
  • 11,878 unique-diff benchmark: 494.9 ms to 1.2 ms
  • pre-push workspace typecheck passes

Full app unit run: 622 passed; the existing Arabic i18n parity failure remains outside the changed files.

Copilot AI review requested due to automatic review settings July 17, 2026 01:50
@Hona
Hona requested a review from Brendonovich as a code owner July 17, 2026 01:50
@Hona
Hona enabled auto-merge (squash) July 17, 2026 01:51

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 addresses a performance bottleneck in the app’s session timeline construction by replacing the prior quadratic diff-summary deduplication with a Set-backed linear reverse scan, matching the legacy behavior while avoiding renderer hangs on large summary.diffs payloads.

Changes:

  • Introduces uniqueSummaryDiffs() to deduplicate SnapshotFileDiff entries in linear time while preserving legacy ordering and “last diff wins” semantics.
  • Updates timeline row construction to use the new helper instead of inline reduceRight(... some(...)) logic.
  • Adds unit tests verifying filtering, ordering, and object identity preservation.

Reviewed changes

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

File Description
packages/app/src/pages/session/timeline/summary-diffs.ts Adds Set-backed linear deduplication helper for summary diffs with legacy-compatible ordering.
packages/app/src/pages/session/timeline/summary-diffs.test.ts Adds coverage for invalid entries, last-duplicate selection, display order, and identity preservation.
packages/app/src/pages/session/timeline/rows.ts Replaces inline quadratic dedup logic with uniqueSummaryDiffs() and removes the local type guard.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@Hona
Hona merged commit 3a1c6df into anomalyco:dev Jul 17, 2026
10 checks passed
avion23 pushed a commit to avion23/opencode that referenced this pull request Jul 17, 2026
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.

Desktop app hangs and crashes when rendering large session diff summary

2 participants