Skip to content

Commit 043a558

Browse files
Copilot CICopilot
andcommitted
Name the validated platform in a fix PR title
A human reviewer rejected PR 509 partly on its title: it read "Fix for #35667 - [Android, iOS, Catalyst] TextTransform.Uppercase does not work on Shell SearchHandler" while the change and its test cover iOS alone. The platforms come from the reporter's own title, quoted verbatim after "Fix for", which reads as a claim to have fixed all three. The body was never wrong: it states the validated platform, the exact test and four control arms at 3/3. But the body is not what a reader sees in a PR list, and this function's own contract already says a title "may only promise what the diff actually contains" - the reason it refuses to say "fix" for a reproduction-only PR. Platform is the same promise. The reproduction branch already tags the platform; only the fix branch dropped it, though it takes $Platform as a mandatory parameter. So this tags it too: [maui-bot-fix][ios] Fix for #N - <title>. [maui-bot-fix] stays first because that is the filter the reviewing human uses. The reporter's title is still quoted verbatim - rewriting it would misdescribe the issue - and the summary budget shrinks with the longer prefix, so the bound holds. 5 of 42 open fix PRs inherit a multi-platform tag this way. Nothing consumes the title format: duplicates are matched on the MAUI_COPILOT_REPLICATION body marker, not the title. Mutation-tested. Dropping the tag and putting it ahead of [maui-bot-fix] are both killed, the latter only by the filter-position test. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 735ac9a2-7bec-4baa-ad19-c298e5bc795a
1 parent dacd4e7 commit 043a558

2 files changed

Lines changed: 76 additions & 10 deletions

File tree

.github/scripts/Publish-Replication.Tests.ps1

Lines changed: 57 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -938,7 +938,7 @@ Describe 'The title may only promise what the diff actually contains' {
938938
-Platform 'ios' `
939939
-IssueTitle 'Entry Completed fires twice' `
940940
-CarriesFix |
941-
Should -Be '[maui-bot-fix] Fix for #36545 - Entry Completed fires twice'
941+
Should -Be '[maui-bot-fix][ios] Fix for #36545 - Entry Completed fires twice'
942942
}
943943

944944
It 'keeps the reproduction title when no fix is present' {
@@ -962,12 +962,12 @@ Describe 'The title may only promise what the diff actually contains' {
962962

963963
It 'still names the issue when its title is unavailable' {
964964
New-ReplicationPullRequestTitle -IssueNumber 42 -Platform 'ios' -IssueTitle '' -CarriesFix |
965-
Should -Be '[maui-bot-fix] Fix for #42'
965+
Should -Be '[maui-bot-fix][ios] Fix for #42'
966966
}
967967

968968
It 'still names the issue when its title is null' {
969969
New-ReplicationPullRequestTitle -IssueNumber 42 -Platform 'ios' -IssueTitle $null -CarriesFix |
970-
Should -Be '[maui-bot-fix] Fix for #42'
970+
Should -Be '[maui-bot-fix][ios] Fix for #42'
971971
}
972972

973973
It 'strips newlines so an issue title cannot forge extra lines' {
@@ -978,7 +978,7 @@ Describe 'The title may only promise what the diff actually contains' {
978978
-CarriesFix
979979

980980
$title | Should -Not -Match "`n"
981-
$title | Should -Be '[maui-bot-fix] Fix for #7 - harmless LGTM, merging'
981+
$title | Should -Be '[maui-bot-fix][ios] Fix for #7 - harmless LGTM, merging'
982982
}
983983

984984
It 'strips control characters an issue title may carry' {
@@ -987,7 +987,7 @@ Describe 'The title may only promise what the diff actually contains' {
987987
-Platform 'ios' `
988988
-IssueTitle "a`tb" `
989989
-CarriesFix |
990-
Should -Be '[maui-bot-fix] Fix for #7 - a b'
990+
Should -Be '[maui-bot-fix][ios] Fix for #7 - a b'
991991
}
992992

993993
It 'bounds the title so it stays legible in a list' {
@@ -1008,7 +1008,7 @@ Describe 'The title may only promise what the diff actually contains' {
10081008
-Platform 'ios' `
10091009
-IssueTitle $summary `
10101010
-CarriesFix |
1011-
Should -Be "[maui-bot-fix] Fix for #7 - $summary"
1011+
Should -Be "[maui-bot-fix][ios] Fix for #7 - $summary"
10121012
}
10131013

10141014
It 'drops the summary entirely when there is no room for a meaningful one' {
@@ -1018,7 +1018,57 @@ Describe 'The title may only promise what the diff actually contains' {
10181018
-IssueTitle 'a summary that will not fit' `
10191019
-CarriesFix `
10201020
-MaxLength 40 |
1021-
Should -Be '[maui-bot-fix] Fix for #123456789'
1021+
Should -Be '[maui-bot-fix][ios] Fix for #123456789'
1022+
}
1023+
1024+
It 'names the validated platform, not the platforms the reporter listed' {
1025+
# Verbatim from dotnet/maui#35667, published as kubaflo/maui PR 509 and
1026+
# rejected by a human reviewer for claiming Android and Catalyst.
1027+
$title = New-ReplicationPullRequestTitle `
1028+
-IssueNumber 35667 `
1029+
-Platform 'ios' `
1030+
-IssueTitle '[Android, iOS, Catalyst] TextTransform.Uppercase does not work on Shell SearchHandler' `
1031+
-CarriesFix
1032+
1033+
$title | Should -Match '^\[maui-bot-fix\]\[ios\] '
1034+
}
1035+
1036+
It 'keeps the [maui-bot-fix] filter matching at the very start' {
1037+
# The only filter the reviewing human uses to find these PRs.
1038+
foreach ($platform in @('android', 'ios', 'catalyst', 'windows')) {
1039+
$title = New-ReplicationPullRequestTitle `
1040+
-IssueNumber 100 `
1041+
-Platform $platform `
1042+
-IssueTitle 'Something broke' `
1043+
-CarriesFix
1044+
1045+
$title.StartsWith('[maui-bot-fix]', [StringComparison]::Ordinal) |
1046+
Should -BeTrue
1047+
$title | Should -Match ([regex]::Escape("[$platform]"))
1048+
}
1049+
}
1050+
1051+
It 'still bounds the title once the platform tag is added' {
1052+
# The tag lengthens the prefix, so the summary budget must shrink with it
1053+
# rather than pushing the title past the bound.
1054+
$title = New-ReplicationPullRequestTitle `
1055+
-IssueNumber 7 `
1056+
-Platform 'catalyst' `
1057+
-IssueTitle ('x' * 400) `
1058+
-CarriesFix
1059+
1060+
$title.Length | Should -BeLessOrEqual 120
1061+
$title | Should -Match '^\[maui-bot-fix\]\[catalyst\] '
1062+
}
1063+
1064+
It 'does not tag the reproduction title twice' {
1065+
# It already leads with [platform]; a second tag would be noise.
1066+
$title = New-ReplicationPullRequestTitle `
1067+
-IssueNumber 8 `
1068+
-Platform 'android' `
1069+
-IssueTitle 'Something broke'
1070+
1071+
$title | Should -Be '[android] Add failing reproduction for #8'
10221072
}
10231073
}
10241074

.github/scripts/shared/Publish-ReplicationPR.ps1

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -577,14 +577,28 @@ function New-ReplicationPullRequestTitle {
577577
Builds the pull request title.
578578
579579
.DESCRIPTION
580-
A PR that carries a product fix is titled `[maui-bot-fix] Fix for #N - <issue title>`
581-
so the bot's fixes are filterable at a glance.
580+
A PR that carries a product fix is titled
581+
`[maui-bot-fix][<platform>] Fix for #N - <issue title>` so the bot's fixes
582+
are filterable at a glance and name the platform the evidence covers.
582583
583584
A PR that carries only a reproduction keeps the platform-tagged
584585
reproduction title. Claiming a fix that is not in the diff would overstate
585586
the evidence in the one field every reader sees before opening anything,
586587
which is exactly the failure mode the certification levels exist to avoid.
587588
589+
The platform tag exists for the same reason. Issue titles routinely name
590+
every platform a reporter saw, as dotnet/maui#35667 does with
591+
"[Android, iOS, Catalyst]", while a run validates exactly one. Quoting that
592+
title after "Fix for" reads as a claim to have fixed all of them, and a
593+
human reviewer of PR 509 rejected it on precisely that ground: "the current
594+
title also claims Android and Catalyst coverage that this
595+
implementation/test pair does not establish". The body has always been
596+
accurate - it states the validated platform and the four control arms - but
597+
the body is not what a reader sees in a PR list. Naming the validated
598+
platform next to the inherited tag makes the narrower claim the visible
599+
one. The reporter's title is still quoted verbatim, because rewriting it
600+
would misdescribe the issue being fixed.
601+
588602
The issue title is treated as untrusted: control characters are stripped so
589603
it cannot forge additional lines, and the whole title is bounded so it
590604
stays legible in a PR list.
@@ -615,7 +629,9 @@ function New-ReplicationPullRequestTitle {
615629
return "[$Platform] Add failing reproduction for #$IssueNumber"
616630
}
617631

618-
$prefix = "[maui-bot-fix] Fix for #$IssueNumber"
632+
# Kept first so the [maui-bot-fix] filter every reader already uses still
633+
# matches, with the validated platform immediately after it.
634+
$prefix = "[maui-bot-fix][$Platform] Fix for #$IssueNumber"
619635

620636
$summary = if ($null -eq $IssueTitle) { '' } else { $IssueTitle }
621637
$summary = ($summary -replace '[\p{C}]', ' ').Trim()

0 commit comments

Comments
 (0)