Skip to content

Fix renamed Markdown preview comparisons - #180

Merged
SIkebe merged 4 commits into
mainfrom
sikebe-fix-preview-diff-count
Aug 18, 2026
Merged

Fix renamed Markdown preview comparisons#180
SIkebe merged 4 commits into
mainfrom
sikebe-fix-preview-diff-count

Conversation

@SIkebe

@SIkebe SIkebe commented Aug 18, 2026

Copy link
Copy Markdown
Owner

Summary

  • Fix Markdown comparison previews for renamed files so the parent side is loaded from its previous path instead of being treated as missing.
  • Analyze renamed Markdown files in the background and show Renamed plus No body changes in the file list before a preview is opened.
  • Resolve rename metadata from the bare clone with git diff --name-status --find-renames, while reusing the same source-loading and rendered-body analysis as the preview path.
  • Add regression coverage for rename parsing, pre-preview analysis, preview coordination, and the file-row labels.

Related Issues

N/A - no issue to close.

Scope

  • App UI / workflow
  • Core services / data model
  • Copilot SDK / agent behavior
  • Preview / WebView2
  • Documentation / release readiness
  • Tests / tooling
  • Other:

Validation

  • dotnet build RepoSyncRadar.sln -warnaserror
  • dotnet test RepoSyncRadar.sln --timeout 10m -- --filter-not-trait Category=Manual
  • Focused tests: dotnet test tests\RepoSyncRadar.Integrations.Tests\RepoSyncRadar.Integrations.Tests.csproj
  • Manual smoke / screenshots, if UI or WebView behavior changed; otherwise replace with N/A - no UI/WebView changes: selected commit 3de47bd and content/copilot/how-tos/copilot-integrations/integrate-cloud-agent-with-azure-boards.md in the running app. Before opening WebView2, the file row showed リネーム and 本文変更なし; no local preview target had been opened. Opening the preview still loaded the old path, reported no rendered body difference, and reported one frontmatter addition.

Risk And Rollback

  • User impact: Renamed docs pages now show their actual content changes, and reviewers can identify rename-only rendered content before opening WebView2. The GitHub line statistics remain authoritative, so the tested file continues to show +1/-0 while the file row explains that the rendered body is unchanged.
  • Operational risk: Low. Background analysis runs only for renamed Markdown files and does not start the preview server. Failures are logged and leave the optional summary absent without blocking the file list.
  • Rollback plan: Revert this PR to restore same-path-only comparison and remove the pre-preview file summaries.

Release Notes

  • User-facing change
  • Internal-only change
  • No release note needed

Release note draft:

Renamed documentation files now show whether their rendered body is unchanged before opening the Markdown comparison, and previews compare moved pages against their previous path.

Resolve the parent-side path from git rename metadata before rendering Markdown comparisons so moved pages are not treated as newly added files.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: d2c491b8-93bb-4880-bcfc-a3fd1f637b62
Copilot AI balanced review requested due to automatic review settings August 18, 2026 05:49

Copilot AI 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.

Pull request overview

Fixes renamed Markdown previews by resolving and rendering the parent file from its previous repository path.

Changes:

  • Detects renamed files using Git rename metadata.
  • Uses the former path for parent-side Liquid context and rendering.
  • Adds unit and integration regression coverage.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
src/RepoSyncRadar.Core/Services/Preview/DocsWorktreeManager.cs Resolves previous paths from Git rename metadata.
src/RepoSyncRadar.Core/Services/Preview/PreviewCoordinator.cs Loads renamed parent content from its former path.
tests/RepoSyncRadar.Integrations.Tests/Preview/DocsWorktreeManagerTests.cs Tests rename-status parsing.
tests/RepoSyncRadar.Integrations.Tests/Preview/PreviewCoordinatorTests.cs Tests end-to-end renamed-file comparison behavior.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Analyze renamed Markdown files in the background and surface rename and no-body-change labels in the file list before a preview is opened.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: d2c491b8-93bb-4880-bcfc-a3fd1f637b62
Copilot AI review requested due to automatic review settings August 18, 2026 07:09

Copilot AI 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.

Pull request overview

Copilot reviewed 9 out of 9 changed files in this pull request and generated no new comments.

Suppressed comments (2)

src/RepoSyncRadar.App/Components/CommitDetail.razor:562

  • This fan-out is unbounded, and every analysis that cannot read the new path at the parent calls ResolvePreviousPathAsync, which runs and parses the same whole-commit git diff --name-status again. A rename-heavy commit can therefore launch N duplicate diff processes plus N Liquid-context loads concurrently when merely selected, causing avoidable CPU/I/O spikes. Resolve/cache the rename map once per SHA pair and use bounded concurrency for the per-file body analysis.
            var analyses = files.Select(async file => new
            {
                file.Path,
                Summary = await coordinator.AnalyzeMarkdownFileChangeAsync(

src/RepoSyncRadar.Core/Services/Preview/PreviewCoordinator.cs:452

  • AnalyzeDetails only compares Liquid-expanded Markdown; it does not perform the path-dependent AUTOTITLE rewriting used by MarkdownPreviewRenderer. If an unchanged relative [AUTOTITLE](...) resolves to different target pages after moving directories, the before/after previews render different labels but this returns HasRenderedBodyChanges: false, so the file row incorrectly says “No body changes.” Include each side's file path when normalizing rendered content (or otherwise compare path-resolved AUTOTITLE labels) before setting this flag.
            var versionImpacts = DocsVersionImpactAnalyzer.AnalyzeDetails(
                sources.BeforeMarkdown,
                sources.BeforeLiquid,
                sources.AfterMarkdown,
                sources.AfterLiquid);

Reuse one rename map per commit, bound concurrent file analysis, and include path-dependent AUTOTITLE labels when deciding whether rendered body content changed.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: d2c491b8-93bb-4880-bcfc-a3fd1f637b62
Copilot AI review requested due to automatic review settings August 18, 2026 07:21

Copilot AI 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.

Pull request overview

Copilot reviewed 12 out of 12 changed files in this pull request and generated no new comments.

Suppressed comments (1)

src/RepoSyncRadar.Core/Services/Preview/PreviewCoordinator.cs:640

  • The old path is only supplied for the document currently being rendered; the comparison document still has no path of its own. ApplyRenderedMarkdownDiff therefore rewrites both sides' relative AUTOTITLE links with the current pane's repoPath (MarkdownPreviewRenderer.cs:2297-2301). For a path-only rename such as the new analyzer test, the analyzer reports a rendered-body change, but each pane compares both versions under one path and emits no rsr-rendered-diff-* marker. Pass the counterpart repo path through RenderDocument/ApplyRenderedMarkdownDiff (new path when rendering before, old path when rendering after) and cover this renamed-path renderer case.
            sources.BeforeFilePath,

Pass the counterpart repository path through Markdown diff rendering so relative AUTOTITLE labels changed by a rename receive visible diff markers.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: d2c491b8-93bb-4880-bcfc-a3fd1f637b62
Copilot AI review requested due to automatic review settings August 18, 2026 07:29

Copilot AI 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.

Pull request overview

Copilot reviewed 13 out of 13 changed files in this pull request and generated no new comments.

@SIkebe
SIkebe merged commit 6adbaf3 into main Aug 18, 2026
8 checks passed
@SIkebe
SIkebe deleted the sikebe-fix-preview-diff-count branch August 18, 2026 12:36
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