Skip to content

fix(hotreload): do not fork the solution for an add that changed nothing - #24617

Merged
dr1rrb merged 3 commits into
masterfrom
dev/dr/hotreload-noop-add-refresh
Sep 28, 2026
Merged

dr1rrb merged 3 commits into
masterfrom
dev/dr/hotreload-noop-add-refresh

Conversation

@dr1rrb

@dr1rrb dr1rrb commented Sep 23, 2026 •

Copy link
Copy Markdown
Member

Closes #24616
Closes https://github.com/unoplatform/uno.hotdesign/issues/8040

SolutionUpdater now tracks whether an add or a remove was applied, gates the analyzer-config
refresh on that, and compares config content before rewriting — the same content-level rule spec 055
R1 already applied to document texts.

Tests

  • Given_SolutionUpdater.When_AddedDocumentIsAlreadyInProject_Then_OriginalSolutionInstanceReturned
    fails without the fix (the solution is forked) and passes with it.
  • IRL_Case_002 records the field sequence in MetadataUpdateTests: edit, empty generation,
    edit -> NullReferenceException in DefinitionMap.GetPreviousPropertyHandle. Marked
    IsCrashingRoslyn, like the existing When_Page_Res_xBind_Remove, so it reports
    Inconclusive until HR fails when requesting an intermediate empty update dotnet/roslyn#79898 is fixed.
  • Uno.HotReload.Tests: 147/147.

Not addressed

The unrealized-text bypass of spec 055 R1 stays as-is: comparing an unrealized document would
re-read the file and could swallow a first edit. Closing it requires remembering what the current
compilation saw, which is a design change of its own.

A pass that mutates nothing must return the original solution instance, so the
manager takes its NoChanges short-circuit before reaching the EnC emit. Two
paths defeated that: the analyzer-config refresh rewrote every .editorconfig as
soon as the change set *requested* an add or a remove — including an add the
updater de-duplicates because the document is already in the project, which is
what a re-observed file creation looks like — and the removes were applied even
for an empty list. Both fork the snapshot, and a forked snapshot is emitted.

The refresh now runs only when an add or a remove was actually applied, and
compares content before rewriting, as the document texts already did.

The cost is not a wasted roundtrip. An update Roslyn resolves to `status: None`
corrupts the edit session's deleted-member bookkeeping, and the failure lands on
the *next* real edit as a NullReferenceException in
DefinitionMap.GetPreviousPropertyHandle (dotnet/roslyn#79898), leaving hot
reload dead for the rest of the session. IRL_Case_002 records that sequence in
the metadata-update scenarios: edit, empty generation, edit.
@github-actions

github-actions Bot commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @dr1rrb's task in 3m 39s —— View job


Review complete

  • Gather context (read diff, changed files, spec)
  • Understand the request (code review against AGENTS.md rules)
  • Review SolutionUpdater.cs changes
  • Review test changes (Given_SolutionUpdater.cs, IRL_Case_002 scenario)
  • Review spec.md update
  • Post inline comments for findings
  • Post summary

Verdict: solid, root-cause fix — minor nits only, no blockers.

The core change is a correct, root-cause fix rather than a guard: it distinguishes what the change-set requested (ChangeSet.HasAddOrRemove) from what the updater actually applied (appliedAddOrRemove), and gates both the analyzer-config refresh and its content-comparison on the latter — consistent with the existing spec 055 R1 pattern already used for document/additional-document text. The new regression test (When_AddedDocumentIsAlreadyInProject_Then_OriginalSolutionInstanceReturned) directly proves the fix (forks-before / reference-equal-after). The IRL_Case_002 scenario and its IsCrashingRoslyn marking follow the exact precedent already set by When_Page_Res_xBind_Remove for the same upstream dotnet/roslyn#79898 issue.

2 findings posted inline (both low severity, non-blocking):

  1. src/Uno.HotReload/Diffing/SolutionUpdater.cs:142 — ChangeSet.HasAddOrRemove is now dead code repo-wide; its only caller was replaced by the new appliedAddOrRemove local. Worth removing so a future add/remove-gating decision doesn't accidentally reach for the "requested" semantics this PR just moved away from.
  2. src/Uno.HotReload.Tests/Given_SolutionUpdater.cs:206 — test coverage only exercises the de-duplicated (skip) path for adds; there's no test proving a genuine add still flips appliedAddOrRemove and refreshes the analyzer-config content. A regression in that flag wouldn't be caught by anything in this suite.

No cross-cutting concerns: no async/cancellation issues (the existing retry-loop/ConfigureAwait discipline is untouched), no platform-targeting or DependencyProperty surface touched, no new allocations on a hot path beyond what spec 055 already established, and commit/PR conventions are followed (fix(hotreload): ..., references the closed issue).

Validation performed: code-review by inspection only (diff read in full, cross-referenced against specs/055-hotreload-noop-pass-dedup/spec.md and existing test conventions). I did not compile or run the test suite in this session — the PR description already reports Uno.HotReload.Tests: 147/147 passing, which I did not independently re-verify.

@github-actions github-actions Bot added area/code-generation Categorizes an issue or PR as relevant to code generation kind/documentation labels Sep 23, 2026
@unodevops

Copy link
Copy Markdown
Contributor

@unodevops

Copy link
Copy Markdown
Contributor

The gate moved from what the change set requested to what the updater actually
applied, and only the negative side was covered: a de-duplicated add must not
fork the solution. Nothing pinned the positive side, so a regression leaving the
flag false for a genuine add would silently stop refreshing analyzer configs —
the behaviour the gate exists to preserve.

Verified to bite: with the flag assignment removed from the add loop, the new
test fails on the config text still reading "is_global = true" instead of the
on-disk content.
@github-actions

github-actions Bot commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @dr1rrb's task in 1m 57s —— View job


Review complete

  • Gather context (read diff, changed files, spec)
  • Understand the request (re-review after dr1rrb's new commit addressing the prior test-gap finding)
  • Review SolutionUpdater.cs changes
  • Review test changes (Given_SolutionUpdater.cs, including new When_DocumentIsGenuinelyAdded_Then_AnalyzerConfigIsRefreshed test)
  • Review IRL_Case_002 scenario and spec.md update
  • Post inline comments for new findings
  • Post summary

Verdict: still solid — the previously-flagged coverage gap is now closed. 2 new low-severity, non-blocking findings, both in spec.md.

The new commit adds When_DocumentIsGenuinelyAdded_Then_AnalyzerConfigIsRefreshed, which directly proves the positive side of the gate: a genuine (non-duplicate) add still flips appliedAddOrRemove and refreshes the analyzer-config text from disk. Per the PR author's own note, this test was verified to bite (fails when appliedAddOrRemove = true is removed from the add loop). Combined with the earlier de-duplication regression test, both sides of the appliedAddOrRemove gate are now covered. SolutionUpdater.cs itself is unchanged since the last review pass.

2 findings posted inline (both low severity, non-blocking, both in specs/055-hotreload-noop-pass-dedup/spec.md):

  1. Line ~54 — the new paragraph cites unoplatform/uno.hotdesign#8040 by identifier as evidence for the Roslyn bug. AGENTS.md's mandatory spec rules forbid a public spec in this repo referencing a private issue/repo as normative context; uno.hotdesign reads like Uno Platform's commercial Hot Design product rather than an open-source sibling of unoplatform/uno, so this is worth confirming and, if private, rewording to a generic description.
  2. Line ~150 — the R1 test enumeration lists 6 tests but the same commit added a 7th (When_DocumentIsGenuinelyAdded_Then_AnalyzerConfigIsRefreshed); the list should mention it too so the spec doesn't undercount its own coverage.

Carried over from the previous review pass (still unresolved, still non-blocking): ChangeSet.HasAddOrRemove (src/Uno.HotReload/Diffing/ChangeSet.cs:29) remains dead code — its only prior caller was replaced by the local appliedAddOrRemove in this PR, and nothing else in src/ calls it (only spec.md prose references it). Not addressed in the new commit; still worth a follow-up removal so a future add/remove-gating decision doesn't reach for the "requested" semantics this PR moved away from.

No cross-cutting concerns: no async/cancellation issues, no platform-targeting or DependencyProperty surface touched, no new hot-path allocations, commit conventions followed (test(hotreload): ...).

Validation performed: code-review by inspection only (diff since the last-reviewed commit, cross-referenced against specs/055-hotreload-noop-pass-dedup/spec.md). I did not compile or run the test suite in this session; the PR author reports Uno.HotReload.Tests at 148/148 after adding the new test, which I did not independently re-verify.

@unodevops

Copy link
Copy Markdown
Contributor

@unodevops

Copy link
Copy Markdown
Contributor

… test

This repo is public; the field report it cited lives in a private tracker, and
AGENTS.md forbids a public spec from carrying a private issue identifier as
normative evidence. The observation that matters — the empty update sitting one
second before the crashing emit — is kept, without the reference.

The test plan also stopped at the de-duplicated add while the same branch added
the genuine-add test, so the spec was undercounting its own coverage.
@github-actions

github-actions Bot commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @dr1rrb's task in 1m 13s —— View job


Review complete

  • Gather context (read diff, changed files, spec)
  • Check whether the two spec.md fixes (private-repo reference, missing 7th test entry) were actually applied
  • Review any other changes since the last review pass
  • Post inline comments for new findings (none — nothing new to flag)
  • Post summary

Verdict: still solid — this pass confirms both previously-flagged findings are resolved. No new inline comments.

Since the last review, the only new commit is 6dc6199c (docs(spec 055): drop the private tracker identifier, list the seventh test), which addresses exactly the two findings from the prior pass:

  1. The unoplatform/uno.hotdesign#8040 identifier is gone from specs/055-hotreload-noop-pass-dedup/spec.md; the line now reads "reported from the field through an internal tracker," keeping the load-bearing observation (the empty update sitting one second before the crashing emit) without the private-repo reference. Correctly resolves the "Public Documentation and Spec References" concern from AGENTS.md.
  2. The R1 test enumeration now lists a 7th item for When_DocumentIsGenuinelyAdded_Then_AnalyzerConfigIsRefreshed, matching the test added in the prior commit.

The ChangeSet.HasAddOrRemove dead-code question from round 1 was addressed by discussion rather than code change: HasAddOrRemove is kept because ISolutionUpdater is implemented by an external consumer (Studio Live's AdhocSolutionUpdater) that this repo can't see via grep, so removing public API here would be a breaking change. spec.md R1 (line 89) now documents that HasAddOrRemove describes what was requested, not applied — the distinction this PR's bug was about — so a future add/remove-gating decision has the warning where it'll be read. That's a reasonable resolution, not a gap.

I confirmed the full PR diff (SolutionUpdater.cs, Given_SolutionUpdater.cs, the IRL_Case_002 scenario files, and spec.md) exactly matches the file list and line counts in the PR description (271 additions / 6 deletions across 12 files) — nothing outside what's already been reviewed twice.

No cross-cutting concerns. No blockers.

Validation performed: code-review by inspection only (diff since last review, cross-referenced against AGENTS.md and specs/055-hotreload-noop-pass-dedup/spec.md). I did not compile or run the test suite in this session; the PR author's last report was Uno.HotReload.Tests: 148/148.

@unodevops

Copy link
Copy Markdown
Contributor

@unodevops

Copy link
Copy Markdown
Contributor

@dr1rrb
dr1rrb merged commit 86e6e3d into master Sep 28, 2026
56 checks passed
@dr1rrb
dr1rrb deleted the dev/dr/hotreload-noop-add-refresh branch September 28, 2026 12:38
@agneszitte

Copy link
Copy Markdown
Member

@Mergifyio backport servicing/6.8 release/stable/6.7

@mergify

mergify Bot commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

backport servicing/6.8 release/stable/6.7

✅ Backports have been created

Details

agneszitte added a commit that referenced this pull request Oct 28, 2026
…r-24617

fix(hotreload): do not fork the solution for an add that changed nothing (backport #24617)
agneszitte added a commit that referenced this pull request Oct 28, 2026
…6.7/pr-24617

fix(hotreload): do not fork the solution for an add that changed nothing (backport #24617)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/code-generation Categorizes an issue or PR as relevant to code generation kind/documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Hot reload: a no-op pass still forks the solution and emits an empty EnC update

4 participants