Skip to content

feat(winui-sync): Copy verbatim files without an agent - #26481

Merged
MartinZikmund merged 3 commits into
masterfrom
dev/mazi/winui-sync-mirror
Nov 14, 2026
Merged

MartinZikmund merged 3 commits into
masterfrom
dev/mazi/winui-sync-mirror

Conversation

@MartinZikmund

Copy link
Copy Markdown
Member

GitHub Issue: closes #26480

PR Type:

  • 🤖 Project automation

What changed? 🚀

Follow-up to #26474 and #26478. Uno.UI's Generic.xaml is WinUI's generic.xaml verbatim, so syncing it is a plain copy and replace, not a port. This adds that as a first-class sync mode and switches the genericxaml area to it.

Mirrored files (mirror: [{ upstream, uno }] in areas.json), handled like the Strings folder:

  • Detection compares each Uno copy with upstream at the target tag, ignoring line endings, BOM and the Uno file's MUX Reference line. A difference selects the area (status copied files changed). Mirrored files are never part of the code diff, so the port job (the agent) does not run for them.
  • Publish replaces the Uno file with upstream's version but keeps its MUX Reference line (same position), its BOM and its line endings. It commits that as chore(<id>): Copy <Title> from WinUI <version> and moves the baseline. The issue and PR get a Copied from upstream section that names the area's other Uno files for a person to check: for Generic.xaml, that's UnoGenericOverlay.xaml, whose GridView/FlipView copies may need to follow.
  • Open sync PRs: detection compares against the branch's copies, as it already does for strings.
  • Port prompt: if an area also has ported code, the agent is told not to edit its mirrored files.
  • Manifest: an area made only of mirrors needs no upstream.sources.
  • Seed: seed-area.ps1 -Mirror 'upstream path=uno path'.

Fix found on real data: seeding failed with "Cannot bind argument to parameter 'References' because it is an empty array" when no header names a version. That is now the normal state of a tracked area's XAML, since #26474 dropped header versions. It works now, given -Baseline.

genericxaml is now mirror: dxaml/xcp/dxaml/themes/generic.xaml → src/Uno.UI/UI/Xaml/Style/Generic/Generic.xaml, with UnoGenericOverlay.xaml as its Uno source. The baseline is unchanged (2.6.5).

README and the /winui-sync-onboard skill describe when to map a file as a mirror. The workflow YAML needs no change: the publish job already runs for every selected area, and mirrors are applied there unconditionally.

PR Checklist ✅

Other information ℹ️

  • Runtime (tooling): 129 Pester tests pass, 11 of them new: manifest round-trip and validation, detection (header/CRLF-only differences ignored, upstream change flagged as a mirror change and not a code change, open-branch copies, matrix selection), Sync-AreaMirror (header line, BOM and line endings kept; missing upstream file throws and leaves the copy alone), a mirror-only publish with no agent artifact, and the seed cases. Each failed before the change.
  • Runtime (real data, local):
    • Detection reports genericxaml up to date through the mirror comparison.
    • A copy at 2.6.5 changes nothing.
    • A copy from WinUI 1.5.5 (whose generic.xaml differs by 6 lines) into a scratch copy replaced the file: header kept on line 2, BOM and CRLF intact, the rest equal to upstream 1.5.5.
  • Not verified: a workflow run with a mirror change. 2.6.5 is the latest stable release, so the first real one comes with the next WinUI release that touches generic.xaml.

🤖 Generated with Claude Code

https://claude.ai/code/session_01TXMNu2Uow7dC9EJ2fL3Hkw

MartinZikmund and others added 3 commits November 14, 2026 12:24
An area can list files Uno keeps as verbatim copies of upstream files (mirror: { upstream, uno }). Like the Strings folder, they are replaced with upstream's version by the publish job, with no agent and no port:

- detection compares each copy with upstream (ignoring line endings, BOM and the Uno MUX Reference line) and selects the area on a difference, while code diffs never include mirrored files, so the agent does not run
- publish keeps the Uno file's MUX Reference line, BOM and line endings and replaces the rest, commits it as 'Copy <Title> from WinUI <version>', and the PR names the area's other Uno files to check by hand
- an area made only of mirrors needs no upstream sources; seed-area.ps1 takes -Mirror 'upstream=uno'
- seeding no longer fails when no header names a version (the normal state of a tracked area's XAML)

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01TXMNu2Uow7dC9EJ2fL3Hkw
The new publish test clones without autocrlf, so files publish does not touch stay unchanged on Windows.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01TXMNu2Uow7dC9EJ2fL3Hkw
Generic.xaml is WinUI's generic.xaml verbatim, so it is now a mirror: syncs replace it with upstream's version (keeping its MUX Reference line) instead of having an agent port it. UnoGenericOverlay.xaml stays in the Uno sources, so sync PRs name it for a person to check. Verified on real data: detection reports the area up to date, a copy at 2.6.5 changes nothing, and a copy from 1.5.5 (6 differing lines) replaced the file with the header kept on line 2 and BOM and CRLF intact.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01TXMNu2Uow7dC9EJ2fL3Hkw
Copilot AI balanced review requested due to automatic review settings November 14, 2026 11:24

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing. Review the Copilot code review billing settings.

@github-actions github-actions Bot added area/build Categorizes an issue or PR as relevant to build infrastructure kind/documentation labels Nov 14, 2026
@github-actions

github-actions Bot commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @MartinZikmund's task in 27s —— View job


Review of #26481

Verdict: ship after one fix. I found 1 medium issue (inline). I did not run the Pester suite. This is a static review.

Reviewed: mirror manifest parsing, detection, Sync-AreaMirror, publish, the prompt change, the seed script and the genericxaml mapping. It's coherent. Preserving the MUX header, BOM and line endings looks right, and reading all upstream files before writing any means a missing file changes nothing.

Cross-cutting notes

  • Detection compares the Uno copy against upstream, so any intentional local edit to Generic.xaml will be flagged and overwritten on every sync. This is fine if the file really is verbatim, as the PR says. The overlay file should stay the only place for Uno-specific changes.
  • The mirror-change path with a real workflow run is unverified, as the PR notes. After merge, watch the first real run closely.

@mergify

mergify Bot commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

This pull request is merged.

$copy = @(Invoke-Git $UnoRoot @('show', "${branchRef}:$($m.uno)") -AllowExitCodes 128)
if ((Get-LastGitExitCode) -ne 0) { continue }
$dest = Join-Path $mirrorRoot $m.uno
New-Item -ItemType Directory -Force -Path (Split-Path $dest) | Out-Null

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The open-branch copy is rebuilt from git show text output (via Invoke-Git), which is lossy in two ways:

  1. PowerShell decodes native output with [Console]::OutputEncoding, so non-ASCII characters in Generic.xaml can be mangled on hosts that aren't UTF-8. The result is a false "copied files changed".
  2. The -join "n" + "n" always appends a trailing newline. If upstream's file has none, the branch copy never compares equal, so the area is re-selected on every run.

Get the exact bytes instead, for example git -C $UnoRoot cat-file blob "${branchRef}:$($m.uno)" redirected to a file, or git archive as in Get-UpstreamFileBytes. Then feed them through ConvertFrom-FileBytes.

The new "open-branch copies" test only uses ASCII text with a trailing newline, so it doesn't cover either case.

@MartinZikmund
MartinZikmund merged commit 86cf133 into master Nov 14, 2026
18 of 20 checks passed
@MartinZikmund
MartinZikmund deleted the dev/mazi/winui-sync-mirror branch November 14, 2026 12:05
@unodevops

Copy link
Copy Markdown
Contributor

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/build Categorizes an issue or PR as relevant to build infrastructure kind/documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

WinUI Port Sync: copy verbatim files instead of porting them

3 participants