Skip to content

Comments

Fix double HTML encoding in /diff view#191

Open
StephaneDelcroix wants to merge 2 commits intomainfrom
fix/when-using-diff-i-have-the-feeling-that-20260223-0940
Open

Fix double HTML encoding in /diff view#191
StephaneDelcroix wants to merge 2 commits intomainfrom
fix/when-using-diff-i-have-the-feeling-that-20260223-0940

Conversation

@StephaneDelcroix
Copy link
Collaborator

Problem

When using /diff, characters like <, >, and " were displayed as &lt;, &gt;, &quot; — making diffs of HTML/XML/generic code unreadable.

Root Cause

DiffView.razor called HttpUtility.HtmlEncode() on line content before passing it to Blazor's @() expression. Since Blazor's @() already HTML-encodes output, characters were double-encoded:

  1. HtmlEncode("<div>")&lt;div&gt;
  2. Blazor @() encodes again → &amp;lt;div&amp;gt;
  3. Browser displays: &lt;div&gt; (literal entity names)

Fix

Removed the explicit HtmlEncode() call and let Blazor handle encoding natively. Also removed the unused System.Web using directive.

Tests

Added two regression tests to DiffParserTests.cs:

  • Parse_SpecialHtmlCharacters_PreservedInContent — verifies <, >, ", & are preserved raw in parsed content
  • Parse_AngleBracketsInCode_NotEncoded — verifies generic type parameters like List<string> are not encoded

StephaneDelcroix and others added 2 commits February 23, 2026 10:42
DiffView.razor was calling HtmlEncode() on line content before passing
it to Blazor's @() expression, which already HTML-encodes output. This
caused characters like <, >, and " to appear as &lt;, &gt;, &quot; in
the diff viewer.

Fix: Remove the explicit HtmlEncode() call and let Blazor handle
encoding natively. Add regression tests verifying the parser preserves
raw HTML characters.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Remove unused `using System.Web;` from DiffParser.cs (the HtmlEncode
  call it supported was in DiffView.razor, not the parser)
- Update misleading test comments: tests validate that DiffParser
  preserves raw characters (a parser invariant), not the DiffView
  render path where the double-encoding bug lived

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
PureWeen added a commit that referenced this pull request Feb 23, 2026
## Summary

Two changes to improve the Squad-based PR review workflow.

### How to use

1. Click **+** in the sidebar → select **PR Review Squad** from "📂 From
Repo"
2. Click the **orchestrator** session
3. Send: `Review PRs #194, #193, #191, #192, #190`
4. The orchestrator assigns 1 PR per worker, each worker dispatches 5
sub-agents across different models, and the orchestrator produces a
summary table with verdicts

The mode is automatically set to **Orchestrator** via `mode:
orchestrator` in `team.md` — no manual mode selection needed.

### Example output

The orchestrator produces a summary table like:

| PR | Verdict | Key Issues |
|----|---------|------------|
| #194 | ⚠️ Needs changes | cursor:pointer without click handler,
brittle test regex |
| #193 | ⚠️ Needs changes | Incomplete state sync → infinite unthrottled
renders |
| #191 | ✅ Ready to merge | Clean — concerns were pre-existing patterns
|
| #192 | ⚠️ Needs changes | GC-finalization test unreliable, flaky IP
test |
| #190 | ⚠️ Needs changes | Tests don't guard actual regression |

Each worker's detailed report includes only issues flagged by 2+ models
(consensus filter), with file:line references and severity ratings.

---

### 1. Restructure PR Review Squad for multi-model consensus

Replaces 5 specialized reviewers (bug-hunter, security-analyst, etc.)
with 5 generic reviewers that each independently perform a full
multi-model consensus review.

Each worker:
1. Fetches the PR diff via `gh pr diff` / `gh pr view`
2. Dispatches 5 parallel sub-agent reviews across different models:
   - 2× `claude-opus-4.6` (deep bug analysis + architecture review)
   - 1× `claude-sonnet-4.6` (correctness + edge cases)
   - 1× `gemini-3-pro-preview` (security focus)
   - 1× `gpt-5.3-codex` (code quality + logic errors)
3. Synthesizes findings using a consensus filter (2+ models must flag an
issue)
4. Produces a severity-ranked report with file:line references and a
verdict

### 2. Support `mode:` field in team.md

`SquadDiscovery` now reads an optional `mode:` line from `team.md` to
set the multi-agent mode automatically. Previously hardcoded to
`OrchestratorReflect`.

Supported values: `broadcast`, `sequential`, `orchestrator`,
`orchestrator-reflect`

```markdown
# My Team
mode: orchestrator
```

### Tests
- 6 new tests for `ParseMode` covering all modes + case insensitivity +
default behavior
- All tests pass

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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