Skip to content

fix: improve session diff viewing infrastructure - #29

Merged
dylsteck merged 2 commits into
mainfrom
codex/diff-viewer-codeview
May 30, 2026
Merged

dylsteck merged 2 commits into
mainfrom
codex/diff-viewer-codeview

Conversation

@dylsteck

@dylsteck dylsteck commented May 30, 2026

Copy link
Copy Markdown
Owner

Summary

This PR improves the existing session right-sidebar Git tab diff infrastructure. It does not add a new review page, modal, or separate review surface.

  • Upgrades @pierre/diffs to ^1.2.5.
  • Replaces the per-file PatchDiff path with virtualized CodeView rendering.
  • Parses raw patches with parsePatchFiles instead of a regex splitter.
  • Enables Pierre's worker-pool rendering path for deferred syntax highlighting.
  • Versions parsed patch cache keys and controlled CodeView items from patch contents to avoid stale worker-rendered output.
  • Preserves the existing dark unified layout, wrapped lines, file status labels, additions/deletions, empty states, no-text-patch fallbacks, and truncated patch warning.

Backend

  • Keeps GET /chat/:sessionId/git/state response shape stable: diff.patch, diff.truncated, diff.files, diff.additions, diff.deletions.
  • Keeps local sandbox diffs on the existing git diff ... | head -c 250000 path.
  • Moves GitHub PR file/commit/diff collection into a focused helper module.
  • Fetches GitHub PR diff text through an Effect program with typed GitHubRepoError / StreamWriteError failures.
  • Bounds PR diff reads to MAX_PATCH_BYTES + 1, cancels the stream on truncation, and falls back to bounded response.text() when GitHub returns no stream body.
  • Continues using Octokit pulls.listFiles for file metadata and pulls.listCommits for commit rows.
  • Avoids logging patch contents or tokens.

Tests / Verification

  • Multi-agent review completed before staging; findings were addressed before commit.
  • pnpm --filter web test -- git-tab-diff-model.test.ts
  • pnpm --filter api test -- github-pr-diff.test.ts session-git-state.test.ts
  • pnpm --filter web typecheck
  • pnpm --filter api typecheck
  • pnpm build && pnpm lint && pnpm typecheck && pnpm test
  • pnpm openapi:check
  • pnpm sdk:generate:check

Reference with many learnings that were used to help shape this PR: https://pierre.computer/writing/on-rendering-diffs

@dylsteck dylsteck changed the title Improve session diff viewing infrastructure fix: improve session diff viewing infrastructure May 30, 2026
@dylsteck
dylsteck force-pushed the codex/diff-viewer-codeview branch from 133a9db to b796c9e Compare May 30, 2026 23:11
@dylsteck
dylsteck merged commit 6e94106 into main May 30, 2026
4 checks passed
@dylsteck
dylsteck deleted the codex/diff-viewer-codeview branch May 30, 2026 23:13
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.

1 participant