Skip to content

Fix coverage injection on new GitHub diff UI#83

Open
davehenton wants to merge 1 commit into
mainfrom
fix/diff-coverage-injection
Open

Fix coverage injection on new GitHub diff UI#83
davehenton wants to merge 1 commit into
mainfrom
fix/diff-coverage-injection

Conversation

@davehenton
Copy link
Copy Markdown
Member

Two bugs prevented coverage gutters from rendering on PR diffs:

  1. GitHub injects multiple U+200E (LRM) characters in file-path link text. The path normalizer used String#replace, which only strips the first occurrence, so a trailing LRM survived and the API request 404'd on path mismatch. Switched to replaceAll.

  2. tryInjectDiffCommitUI marked the root container as processed on first run, even when no gutter cells had rendered yet (the new React-based diff renders file-index links before grid cells). The MutationObserver guard then short-circuited every retry. Removed the root-level guard and moved the per-link processed flag to fire only after a successful injection, so the observer keeps retrying as cells appear.

Two bugs prevented coverage gutters from rendering on PR diffs:

1. GitHub injects multiple U+200E (LRM) characters in file-path link
   text. The path normalizer used String#replace, which only strips
   the first occurrence, so a trailing LRM survived and the API
   request 404'd on path mismatch. Switched to replaceAll.

2. tryInjectDiffCommitUI marked the root container as processed on
   first run, even when no gutter cells had rendered yet (the new
   React-based diff renders file-index links before grid cells).
   The MutationObserver guard then short-circuited every retry.
   Removed the root-level guard and moved the per-link processed
   flag to fire only after a successful injection, so the observer
   keeps retrying as cells appear.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@CLAassistant
Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@davehenton davehenton requested a review from marschattha May 1, 2026 16:24
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