Skip to content

perf(worktrees): preserve no-op projection identity and skip unchanged evidence replay #806

Description

@Juliusolsson05

Confirmed problem

At main 5d64184, canonicalizeWorktreeActivity creates new state/context objects for identical catalogs. The renderer treats those references as changes and appends worktree_catalog_reconciled diagnostics for quiet sessions. LiveWorktreeReconciler.observe also replays up to 500 retained records for unrelated transcript batches.

Evidence

A production-module probe returned new projection references for 1000/1000 value-identical results. In a 120-second audit window, eight sessions each received ten reconciliation records with unchanged diagnostic payloads. A synthetic recorded-fixture benchmark measured approximately 2 ms per unrelated batch with 500 retained worktree events, versus approximately 0.003 ms with none. These are isolated costs, not an app-wide latency measurement.

Expected / acceptance

  • Identical canonical projections preserve references.
  • Unchanged catalog contents, baseline, cwd and retained evidence reuse the previous projection without replay.
  • Relevant evidence, catalog expansion/removal/branch changes and authoritative history replacement invalidate correctly.
  • Preserve stale-hydration contribution reversal, evidence eviction, failed-load retry, disposal and session cleanup behavior.
  • Add meaningful regression tests and reproducible before/after measurements using sanitized fixtures.

Scope is renderer worktree reconciliation and the shared canonicalizer. Main-process index persistence, #763/#762/#767, and A6 issues #802-805 remain separate increments. No lifecycle/readiness or raw terminal input changes.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions