Skip to content
Source
Sign inSign up
pingdotgg/t3code

chore(deps): upgrade @pierre/diffs to 1.5.2 and @pierre/trees to beta.6 #16644

Mergedjuliusmarmingemerged 1 commit intomain fromrefs/pull/16644/headmerged by juliusmarminge View on GitHub

juliusmarmingecommented

Problem

We pinned @pierre/diffs at 1.3.0-beta.10 with a five-hunk local patch, and @pierre/trees at 1.0.0-beta.4. Since then Pierre shipped 1.3 through 1.5.2, with parser, worker and virtualization fixes. 1.4 also replaced the editor API that the editable Files panel uses.

Bumping it directly causes two regressions:

  • Since 1.3.6, Pierre highlights an active edit session on the main thread. Our Files panel is always in edit mode, so opening ChatView.tsx (11.7k lines) froze the UI for 3.9–4.4 s (#8356 again).
  • The wrapped-row height fix from #10018 is not upstream. Without it, the scroll jump in #7907 returns.

Change

  • Bump: @pierre/diffs 1.5.2 and @pierre/trees 1.0.0-beta.6.
  • Files editor: moved to the 1.4 edit API (@pierre/diffs/edit, edit, onEditChange, EditProvider createEditor).
    • The panel stays read-only until the worker's highlight has painted, then attaches the editor. The editor reuses that result, so no file is highlighted on the main thread.
    • Plain text, files past Pierre's tokenize limit, and failed worker highlights become editable immediately, as before.
    • The editor owns the draft. Our own saves echoing back keep the file's identity; a change from elsewhere replaces it.
  • Patch: cut from five hunks to two.
    • Upstream now covers the stale-highlight discard (#9902), grammar readiness (#9947), and the editor option forcing.
    • What remains: the three subpath exports that mobile and the web diff parser import, and the wrapped-row height retention (#10018). The latter is re-ported to 1.5.2.
  • Quoted file names: the parser now decodes git-quoted names itself, including ---/+++-only patches. So resolveFileDiffPath and mobile reviewModel no longer unquote a second time. That second pass turned back\slash.txt into backslash.txt.

Upstream changes that come with the bump:

  • src/Dockerfile, build/Makefile, tools/BUILD, .star and .odin files get syntax highlighting.
  • Hunk counts in truncated patches are repaired.
  • A worker that fails to start gives up after 10 s instead of loading forever.

Scope and approval

Maintainer-requested dependency bump (Julius). It touches web and mobile only because they import the same Pierre packages. #10508 edits the old patch file and will need rebasing onto this one.

Verification

Main-thread time while opening the 11.7k-line ChatView.tsx in the Files panel. Measured with a longtask observer, same scratch repo, headless Chromium, three runs each.

BuildLongest task while openingBecomes editable after click
main (beta.10)228, 118, 110 msimmediately; highlight lands ~2 s later
this PR, editor attached on open4403, 3868 ms~4.5 s
this PR156, 118, 109 mswhen the highlight paints, ~2.2 s

Highlighting for a nested docker/Dockerfile. Same file and viewport.

Before (main)After
Before: docker/Dockerfile renders as plain textAfter: docker/Dockerfile is syntax highlighted

Real browser, scratch repo (no real files edited), with no console errors:

  • Typing saves to disk and focus stays in the editor.
  • An external edit on disk is adopted without a manual refresh.
  • Undo walks back the in-app edits and stops at the external change.
  • A review comment on L5–L7 follows its lines when lines are inserted above it, and the composer gets the matching chip.

Tests:

  • fileEditorVirtualization.test.ts: 29/29 pass with the patch; 15 fail without its wrapped-row hunks.
  • diffRendering.test.ts adds a literal-backslash case.
  • StyledDiffCodeView.test.tsx now expects Pierre's 10 s worker-start timeout for a held pool.
  • fileEditorHighlight.test.ts and fileEditorLanguageReadiness.test.ts are deleted. They exercised the two patch hunks upstream now owns, by driving renderer internals that 1.5 replaced.
  • Focused run: 104 tests across the 8 touched files pass. Web and mobile typecheck pass, the web production build passes, and no new lint warnings.

Not verified:

  • Mobile on a device. Covered only by typecheck and reviewModel/shikiReviewHighlighter tests.
  • A recording of the freeze. I couldn't capture one reliably headless, so the long-task table stands in for it.

Behavior change: the undo history no longer survives closing a file and reopening it; edits within a session undo as before.

🤖 Generated with Claude Code — Claude Opus 5.5 (1M context)


Devin Review
    1. github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:trusted

    2. juliusmarminge added labelsmacroscope-review

    3. Approvability

      Verdict: Not approved

      Macroscope's review found this PR not approvable — This dependency upgrade also rewires the production file editor and diff renderer, including worker-highlight readiness, edit synchronization, virtualization, and cache behavior. The changes span user-facing web and mobile review paths and are broader than routine dependency maintenance.

      You can add or adjust custom eligibility rules. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).
    4. Thread transfer impact

      ✅ Thread transfer remains within every enforced ceiling.

      ProviderMetricMain baselineThis PRImpactPR ceiling
      CodexTotal thread wire5.0 KiB5.0 KiB0 B (0.0%)6.8 KiB✅
      CodexThread snapshot wire3.8 KiB3.8 KiB0 B (0.0%)4.9 KiB✅
      CodexLive turn WebSocket wire1.2 KiB1.2 KiB0 B (0.0%)2.0 KiB✅
      CodexLive turn WebSocket decoded20.9 KiB20.9 KiB0 B (0.0%)29.3 KiB✅
      CodexLive turn messages220 (0.0%)8✅
      ClaudeTotal thread wire5.0 KiB5.0 KiB−24 B (−0.5%)6.8 KiB✅
      ClaudeThread snapshot wire3.8 KiB3.8 KiB0 B (0.0%)4.9 KiB✅
      ClaudeLive turn WebSocket wire1.2 KiB1.2 KiB−24 B (−2.0%)2.0 KiB✅
      ClaudeLive turn WebSocket decoded21.2 KiB21.2 KiB−41 B (−0.2%)29.3 KiB✅
      ClaudeLive turn messages21−1 (−50.0%)8✅

      Baseline: 517188b · PR result: 799d365 · Source CI: success

      Scenario and decoded snapshot size

      10 historical turns, 5 command tools per turn, 878.9 KiB retained MCP result per historical turn, and a 1.05 MiB retained result in the measured turn.

      • Codex decoded thread snapshot: 108.5 KiB
      • Claude decoded thread snapshot: 108.8 KiB

      Updated in place by a trusted workflow. PR artifacts are strictly validated and never executed.

    5. Review in Change Stack →

      No actionable comments were generated in the recent review. 🎉

      ℹ️ Recent review info
      ⚙️ Run configuration
      • Configuration used: Path: .coderabbit.config.ts
      • Review profile: CHILL
      • Plan: Team
      • Run ID: 22351285-37c9-441d-a84b-bb0c4958b680
      📥 Commits

      Reviewing files that changed from the base of the PR and between 517188b3caa135bc09ec0a4f93474ef17c8b5c4f and 799d36569e149ec994ea3f658604cda71ee239f7.

      ⛔ Files ignored due to path filters (1)
      • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
      📒 Files selected for processing (21)
      • apps/mobile/package.json
      • apps/mobile/src/features/review/reviewModel.ts
      • apps/web/package.json
      • apps/web/src/components/diffs/AnnotatableCodeView.tsx
      • apps/web/src/components/diffs/StyledDiffCodeView.test.tsx
      • apps/web/src/components/diffs/StyledDiffCodeView.tsx
      • apps/web/src/components/files/FilePreviewPanel.tsx
      • apps/web/src/components/files/ReadOnlySourcePreview.tsx
      • apps/web/src/components/files/fileContentRevision.test.ts
      • apps/web/src/components/files/fileContentRevision.ts
      • apps/web/src/components/files/fileEditorHighlight.test.ts
      • apps/web/src/components/files/fileEditorLanguageReadiness.test.ts
      • apps/web/src/components/files/fileEditorVirtualization.test.ts
      • apps/web/src/components/files/projectFilesQueryState.ts
      • apps/web/src/components/pullRequest/PullRequestCodeTab.tsx
      • apps/web/src/lib/diffRendering.test.ts
      • apps/web/src/lib/diffRendering.ts
      • apps/web/vite.config.ts
      • patches/@pierre%2Fdiffs@1.3.0-beta.10.patch
      • patches/@pierre%2Fdiffs@1.5.2.patch
      • pnpm-workspace.yaml
      💤 Files with no reviewable changes (4)
      • apps/web/src/components/files/fileEditorHighlight.test.ts
      • apps/web/src/components/files/fileContentRevision.ts
      • apps/web/src/components/files/fileEditorLanguageReadiness.test.ts
      • patches/@pierre%2Fdiffs@1.3.0-beta.10.patch

      Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 6 remain after this review.


      📝 Walkthrough

      Walkthrough

      The PR upgrades Pierre packages and updates their local diff patch. It migrates editable file previews to the edit API, updates diff viewer types, and changes mobile and web review path mapping to use parser-provided names directly.

      Changes

      Pierre editor and diff integration

      Layer / File(s)Summary
      Upgrade Pierre packages and patch
      apps/mobile/package.json, apps/web/package.json, pnpm-workspace.yaml, patches/*, apps/web/vite.config.ts, apps/web/src/components/files/fileEditorVirtualization.test.ts
      The @pierre/diffs catalog version changes to 1.5.2, and its local patch is updated with partial layout-cache invalidation, resize reconciliation, and package exports. The app dependency and Vite entry point are updated. Virtualization tests use the new edit API.
      Update diff viewer types and tests
      apps/web/src/components/diffs/*, apps/web/src/components/files/ReadOnlySourcePreview.tsx, apps/web/src/components/pullRequest/PullRequestCodeTab.tsx
      Diff viewer props, handles, and callback types specify undefined as the second generic argument. The worker initialization timeout test expects a rejection.
      Migrate editable file previews
      apps/web/src/components/files/FilePreviewPanel.tsx, apps/web/src/components/files/projectFilesQueryState.ts, apps/web/src/components/files/fileContentRevision*, apps/web/src/components/files/fileEditor*Readiness.test.ts, apps/web/src/components/files/fileEditorHighlight.test.ts
      FilePreviewPanel uses the edit API and tracks editor changes and highlight readiness. Query state exposes the current project file contents. The editor-specific cache-key helper and two editor test files are removed.
      Preserve parser-provided Git paths
      apps/mobile/src/features/review/reviewModel.ts, apps/web/src/lib/diffRendering.ts, apps/web/src/lib/diffRendering.test.ts
      Mobile and web path mapping no longer unquotes parser-provided names. A web test checks that a quoted path containing an escaped backslash resolves with a literal backslash.

      Priority: ➖ Normal

      Estimated code review effort: 3 (Moderate) | ~25 minutes

      Change: Other

      Sequence Diagram(s)

      sequenceDiagram
        participant FilePreviewPanel
        participant WorkerPool
        participant FileRenderer
        participant ProjectFileQuery
        participant SaveQueue
        FilePreviewPanel->>WorkerPool: Prime highlighting
        WorkerPool->>FilePreviewPanel: Return highlight result
        FilePreviewPanel->>FileRenderer: Provide file contents and edit readiness
        FileRenderer->>FilePreviewPanel: Send editor change
        FilePreviewPanel->>ProjectFileQuery: Update optimistic contents
        FilePreviewPanel->>SaveQueue: Queue changed contents

      Suggested reviewers: t3dotgg, maria-rcks

      Merge Risk: ⚪ Minimal · up to 799d3

      No actionable merge-blocking issue remains after the reviewed changes and normal checks.

      🚥 Pre-merge checks | ✅ 4
      ✅ Passed checks (4 passed)
      Check nameStatusExplanation
      Title check✅ PassedThe title clearly and concisely identifies the dependency upgrades, which are the primary changes in the pull request.
      Description check✅ PassedThe description covers the problem, changes, scope and approval, verification results, unverified items, and the undo-history behavior change. It provides focused test and build results and includes U…
      Linked Issues check✅ PassedCheck skipped because no linked issues were found for this pull request.
      Out of Scope Changes check✅ PassedCheck skipped because no linked issues were found for this pull request.
      ✨ Finishing Touches
      📝 Generate docstrings
      • Commit to this branch
      • Create a new PR
      🧪 Generate unit tests (beta)
      • Commit to this branch
      • Create a new PR
      • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

      Comment `@coderabbitai help` to get the list of available commands.
    6. juliusmarminge merged thisf8ed2a0

    7. juliusmarminge closed this

Sign in to join this conversation.