Skip to content

🤖 fix: gate immersive review diff hydration#3446

Open
ammar-agent wants to merge 1 commit into
mainfrom
immersive-review-hydration-stability
Open

🤖 fix: gate immersive review diff hydration#3446
ammar-agent wants to merge 1 commit into
mainfrom
immersive-review-hydration-stability

Conversation

@ammar-agent
Copy link
Copy Markdown
Collaborator

@ammar-agent ammar-agent commented Jun 3, 2026

Summary

Prevents Immersive Review from painting unpositioned diff geometry while compact hunk overlays hydrate into full-file context. The reveal gate now keys on the rendered overlay identity instead of file path alone, so file switches, hydration swaps, and filtered hunk-content swaps stay hidden until the selected hunk has been scrolled into place.

Background

PR #3442 fixed hunk-to-hunk scroll thrash and assisted-banner reflow, but the remaining flash came from a different invariant: while full-file content loaded asynchronously, the visible diff could swap from a compact hunk-only overlay to a much taller full-file overlay. That changes row indices and minimap geometry even when the selected hunk is unchanged.

Implementation

  • Gate reveal by { filePath, overlayData.content }, not just file path.
  • Keep both the diff stage and minimap stage invisible while a geometry-changing overlay is pending.
  • During pending reveal, scroll using the selected hunk's resolved line in the new overlay, ignoring stale compact-overlay cursor indices.
  • Only preserve an out-of-hunk context cursor when the overlay content is unchanged; compact → full-file hydration remaps the cursor back into the selected hunk.
  • Force a hidden minimap redraw after parent scroll positioning and before the reveal RAF opens the stage, so the thumb/active marker read the final scrollTop.
  • Move minimap canvas redraw to a layout effect because canvas pixels are visible layout state.
  • Pin the ai package to the already-locked 6.0.175 release so lockfile-free static checks avoid the currently broken 6.0.196 tarball.

Validation

  • bun test src/browser/features/RightSidebar/CodeReview/ImmersiveReviewView.test.tsx src/browser/features/RightSidebar/CodeReview/ImmersiveMinimap.test.tsx
  • make typecheck
  • make lint
  • git diff --check
  • make static-check
  • make static-check-full
  • Re-ran targeted tests + make static-check after rebasing onto latest origin/main.
  • Read-only review sub-agent audited the final design and found no remaining plausible hydration/minimap flash path.

Risks

Moderate, localized to Immersive Review diff/minimap reveal behavior. The main user-visible tradeoff is that geometry swaps may briefly show the existing loading scrim instead of painting an unanchored diff. The code intentionally keeps normal same-file hunk navigation out of the reveal gate unless the overlay content changes.

The ai dependency pin narrows the package range to the version already resolved in bun.lock; this is intended to make lockfile-free package checks deterministic while npm metadata advertises a latest tarball that returns 404.


Generated with mux • Model: openai:gpt-5.5 • Thinking: xhigh • Cost: $71.64

@ammar-agent
Copy link
Copy Markdown
Collaborator Author

@codex review

Please review the hydration reveal-gate fix, especially the overlay identity invariant, stale compact cursor remapping, and minimap redraw ordering.

@chatgpt-codex-connector
Copy link
Copy Markdown

Codex Review: Didn't find any major issues. You're on a roll.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@ammar-agent ammar-agent force-pushed the immersive-review-hydration-stability branch from 705e1fd to e4ffaa6 Compare June 3, 2026 19:55
@ammar-agent
Copy link
Copy Markdown
Collaborator Author

@codex review

Pushed a follow-up to replace the flaky scrollIntoView-based stale-cursor test with a deterministic active-line data contract while keeping the hydration cursor remap behavior covered.

@ammar-agent ammar-agent force-pushed the immersive-review-hydration-stability branch from e4ffaa6 to 5caf31d Compare June 3, 2026 20:05
@ammar-agent
Copy link
Copy Markdown
Collaborator Author

@codex review

Replaced the CI-flaky DOM/scroll stale-cursor regression with a pure cursor-preservation contract test. Local targeted tests, typecheck, lint, diff-check, and static-check pass.

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 5caf31d12c

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@ammar-agent ammar-agent force-pushed the immersive-review-hydration-stability branch from 5caf31d to 0214ac4 Compare June 3, 2026 20:09
@ammar-agent
Copy link
Copy Markdown
Collaborator Author

@codex review

Pushed final stabilization: replaced the flaky DOM cursor test with a pure cursor-preservation helper contract, and pinned ai to the already-locked 6.0.175 version because remote make static-check-full was resolving the broken 6.0.196 tarball. Local targeted tests, static-check, and static-check-full pass.

@ammar-agent ammar-agent force-pushed the immersive-review-hydration-stability branch from 0214ac4 to 49d1cfc Compare June 3, 2026 20:13
@ammar-agent
Copy link
Copy Markdown
Collaborator Author

Addressed Codex finding PRRT_kwDOPxxmWM6G4LIX / "Preserve the minimap's stretched height": the minimap reveal wrapper now keeps h-full self-stretch, the minimap root itself has h-full, and tests assert both the wrapper/root height contracts. Re-requesting review after this push.

@codex review

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 49d1cfc29e

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread package.json
Keep geometry-changing immersive review overlay swaps hidden until the new diff/minimap have been positioned, including same-file hydration from hunk-only overlays to full-file context.

---

_Generated with `mux` • Model: `openai:gpt-5.5` • Thinking: `xhigh` • Cost: `$71.64`_

<!-- mux-attribution: model=openai:gpt-5.5 thinking=xhigh costs=71.64 -->
@ammar-agent ammar-agent force-pushed the immersive-review-hydration-stability branch from 49d1cfc to 81ee968 Compare June 3, 2026 20:19
@ammar-agent
Copy link
Copy Markdown
Collaborator Author

Addressed Codex finding PRRT_kwDOPxxmWM6G4W0G / "Update the lockfile for the pinned ai dependency": bun.lock now matches the exact ai package spec, and bun install --frozen-lockfile plus make static-check-full pass locally.

@codex review

@chatgpt-codex-connector
Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Hooray!

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

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