Skip to content

Settle divergence banners through islands instead of page morphs - #132

Merged
fgilio merged 2 commits into
mainfrom
claude/rfa-pr-104-review-o8mcul
Jul 3, 2026
Merged

Settle divergence banners through islands instead of page morphs#132
fgilio merged 2 commits into
mainfrom
claude/rfa-pr-104-review-o8mcul

Conversation

@fgilio

@fgilio fgilio commented Jul 3, 2026

Copy link
Copy Markdown
Owner

Summary

Implements the one presently actionable proposal from #104: divergence chrome now settles through explicit Livewire islands instead of full-page morphs.

  • A HEAD-divergence transition from the poller used to re-render the whole review page, re-hydrating every diff-file child (the 1+N cost the page avoids everywhere else) even when only banner chrome changed. The header marker and the missing-target bar now live in divergence-marker / divergence-missing-bar islands that checkHeadDivergence refreshes under skipRender(), mirroring the reviewed-state settle pattern.
  • The page still morphs for the two transitions that need it: an auto-follow that rehydrated the file list, and an empty file list, whose divergence empty-state message lives outside the islands (that morph is cheap: no children to re-hydrate).
  • Comment writes now re-check divergence through recheckDivergenceDuringCommentWrite(), which leaves the page-render decision to the mutation's flags. That fixes two latent defects:
    1. A divergence transition caught mid-write painted nothing (the mutation's skipRender suppressed it), and the poller then saw the state as already applied and never repainted, stranding a stale banner until an unrelated full render.
    2. The unchanged-divergence path latched skipRender() over mutations whose flag asked for a render, so the flag was never effective.
  • ReviewCommentMutation::deleted() / cleared() / restored() now declare skipsRender: true, matching their tested and shipped behavior (the ReviewPageTest "skips render" tests and the CLAUDE.md skipRender table); their previous false flag was always overridden by that latch, and no parent-rendered markup depends on comment state.

Why the other five #104 proposals are not implemented

Each is conditional on a trigger that does not exist yet, or its concern is already covered: applySelection is already the server authority and rejects stale snapshotKeys; expand-context/expand-gap have no batching or keyboard-repeat controls and Livewire serializes same-component calls; bulk copy-paths is already server-computed (copyVisiblePaths); the context-page comment bridge and the review-page comment burst queue are gated on comment controls moving into islands or burst-firing toolbars, which has not happened. Building those queues and coordinators now would add mechanisms nothing exercises.

Validation

  • vendor/bin/pint --dirty --format agent
  • composer test:types (PHPStan, clean)
  • composer test — 1650/1653 pass; the 3 failures are PatchNativeServerTest vendored-NativePHP assertions that also fail on clean main in this environment
  • New/updated coverage in ReviewPageBranchDivergenceTest: banner-only transition paints islands and skips the parent render, unchanged divergence paints nothing, auto-follow and empty-file-list transitions still morph the page, a transition caught during a comment write paints the islands, and comment deletion skips via its mutation flag

🤖 Generated with Claude Code

https://claude.ai/code/session_01G5BYb5cTR149b9ahJFYNTm


Generated by Claude Code

Summary by CodeRabbit

  • New Features

    • Review page divergence indicators now update more smoothly, with banner and missing-target states refreshing independently when possible.
    • Comment actions can now update the review view without a full page rerender in more cases.
  • Bug Fixes

    • Improved handling of branch divergence changes so the page fully refreshes only when needed.
    • Fixed mid-write comment updates so divergence notices stay current during transitions.
  • Documentation

    • Updated review-page behavior notes to reflect the new update flow.

A HEAD-divergence transition from the poller re-rendered the whole
review page, re-hydrating every diff-file child (the 1+N cost the
page avoids everywhere else) even when only banner chrome changed.
The header marker and the missing-target bar now live in explicit
islands that checkHeadDivergence refreshes under skipRender. The
page still morphs when auto-follow rehydrates the file list, or
when the list is empty: the divergence empty-state message lives
outside the islands and that morph has no children to re-hydrate.

Comment writes re-check divergence through a variant that leaves
the render decision to the mutation's flags. That fixes two latent
defects: a transition caught mid-write painted nothing (the poller
then saw the state as already applied and stranded a stale banner),
and the unchanged-divergence path latched skipRender over mutations
that declared a render. The deleted/cleared/restored mutations now
declare skipsRender: true, matching their tested and shipped
behavior; their previous false flag was always overridden by
that latch.

Implements the one presently actionable proposal from #104.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01G5BYb5cTR149b9ahJFYNTm
@coderabbitai

coderabbitai Bot commented Jul 3, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@fgilio, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 50 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: c07adb50-5e4d-44e8-bf60-19d3616e9306

📥 Commits

Reviewing files that changed from the base of the PR and between 39fe25b and 7af01c8.

📒 Files selected for processing (5)
  • resources/CLAUDE.md
  • resources/views/components/divergence/marker.blade.php
  • resources/views/components/divergence/missing-bar.blade.php
  • resources/views/pages/⚡review-page.blade.php
  • tests/Unit/Livewire/ReviewPageBranchDivergenceTest.php
📝 Walkthrough

Walkthrough

The divergence-transition flow in the review page trait now decides between a full page re-render and targeted "divergence island" updates. Comment mutation flags for delete/clear/restore switch to skip the parent render. Templates wrap divergence UI in Livewire islands, with documentation and tests updated accordingly.

Changes

Divergence Islands and Render-Skip Flow

Layer / File(s) Summary
Divergence transition logic and full-render decision
app/Concerns/ReviewPage/ReviewsBranchDivergence.php
checkHeadDivergence() now snapshots the prior target branch and conditionally renders fully or via islands; new recheckDivergenceDuringCommentWrite(), divergenceNeedsFullRender(), and renderDivergenceIslands() helpers added.
Comment mutation skipsRender flags
app/DTOs/ReviewCommentMutation.php, tests/Unit/Actions/ReviewCommentWorkflowActionTest.php
Deleted, cleared, and restored mutations now set skipsRender: true, with docblocks and corresponding action tests updated to match.
Template island wrapping and comment-write divergence call
resources/views/pages/⚡review-page.blade.php, resources/CLAUDE.md
Comment-mutation handler switches to recheckDivergenceDuringCommentWrite; divergence marker and missing-target bar wrapped in @island blocks; docs table updated with checkHeadDivergence behavior.
Divergence island and render-skip tests
tests/Unit/Livewire/ReviewPageBranchDivergenceTest.php
Adds divergenceIslandFragments helper and tests for banner-only, unchanged, auto-follow, no-files, delete-comment, and write-time divergence transitions.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant ReviewPage
  participant ReviewsBranchDivergence
  participant DivergenceIslands
  participant CommentMutation

  CommentMutation->>ReviewPage: applyCommentMutation(mutation)
  alt mutation.checksDivergence
    ReviewPage->>ReviewsBranchDivergence: recheckDivergenceDuringCommentWrite()
    ReviewsBranchDivergence->>ReviewsBranchDivergence: divergenceNeedsFullRender()
    alt target branch changed or files empty
      ReviewsBranchDivergence->>ReviewPage: forceRender()
    else divergence-only change
      ReviewsBranchDivergence->>DivergenceIslands: renderDivergenceIslands()
      DivergenceIslands-->>ReviewPage: repaint divergence-marker, divergence-missing-bar
    end
  else
    ReviewPage->>ReviewPage: apply mutation with skipsRender flag
  end
Loading

Possibly related PRs

  • fgilio/rfa#47: Both PRs modify the review page's head-divergence transition flow that triggers checkHeadDivergence().
  • fgilio/rfa#101: This PR extends the same ReviewsBranchDivergence and ReviewCommentMutation skip-render/divergence-island behavior introduced in #101.
  • fgilio/rfa#116: Changes the same divergence marker/missing-target banner UI now repainted via divergence islands in this PR.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and accurately summarizes the main change: divergence banners now update through islands instead of full page morphs.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

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

Copy link
Copy Markdown

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: 39fe25b601

ℹ️ 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 resources/views/pages/⚡review-page.blade.php
The divergence marker and missing-target bar now live inside islands,
where a wire:click scopes its render to that island. Their buttons
(switch review, keep reviewing, dismiss) all settle more than the
banner they were clicked in: switchReviewToHead rehydrates the file
list, and keep/dismiss can swap the divergence empty-state message.
The buttons now $dispatch bubbling rfa-* window events that the
page-root Alpine forwards to $wire, matching the existing
reviewed-state bridge pattern.

Addresses the Codex review finding on PR #132.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01G5BYb5cTR149b9ahJFYNTm
@fgilio
fgilio merged commit fd1c6e2 into main Jul 3, 2026
15 checks passed
@fgilio
fgilio deleted the claude/rfa-pr-104-review-o8mcul branch July 3, 2026 09:59
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.

2 participants