Skip to content

Commit 755c545

Browse files
Copilot CICopilot
andcommitted
Stop a presentation bound destroying the attempt it describes
The test-proposal reader bounds each reproduction step at 300 characters and throws past a 25% tolerance window. Nothing reads that value: the call discards its result, and both downstream consumers already trim the same field to the same 300. So the throw cannot protect a caller; it only destroys the attempt. Measured over 838 complete logs: 4 attempts died on this bound at 380-398 characters, every one descriptive prose, and build 15105015 spent its final attempt on one. The window's own comment justifies 25% by citing overages of 15 and 13 characters (~1.02x); live overages sit at 1.27-1.36x, systematically just outside, so the justification is stale. The publisher's sibling validator had already reached this conclusion for the same field. The authoring reader never learned it. Chosen over widening the window because the window is shared: for a -match guard a silent trim can remove a match and disable a check without saying so. The strict siblings are named in the test and stay strict - the verifier matches the failure signature against printed assertion text, and three guards match the trigger and behavior fields. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 735ac9a2-7bec-4baa-ad19-c298e5bc795a
1 parent 91b56e4 commit 755c545

2 files changed

Lines changed: 66 additions & 1 deletion

File tree

.github/scripts/Replicate-Issue.Tests.ps1

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3711,6 +3711,59 @@ PS-STEP-FAILED: step 3 did not find its target
37113711
$script:Source | Should -Match 'Test reproduction step \$\(\$stepIndex \+ 1\)'
37123712
}
37133713

3714+
It 'reserves the prose path for the proposal field that nothing reads' {
3715+
# The identity of the opted-in site is the invariant, not the count: the fix
3716+
# panel legitimately marks eight of its own model-written fields prose, and a
3717+
# ninth may be added. What must never drift is the strict set below. Each of
3718+
# these is read: the verifier -match's the failure signature against the text
3719+
# the assertion prints; the orientation, safe-area and visual guards -match the
3720+
# trigger and behavior fields; and the sandbox step feeds the timing-sensitive
3721+
# -notmatch check. A silent trim there can remove a match and disable a guard
3722+
# without saying so, or add one and throw spuriously.
3723+
$ast = [System.Management.Automation.Language.Parser]::ParseFile(
3724+
$script:ScriptPath, [ref]$null, [ref]$null)
3725+
$calls = $ast.FindAll({
3726+
param($node)
3727+
$node -is [System.Management.Automation.Language.CommandAst] -and
3728+
$node.GetCommandName() -eq 'ConvertTo-BoundedAgentLine'
3729+
}, $true)
3730+
3731+
$prose = @{}
3732+
foreach ($call in $calls) {
3733+
$elements = @($call.CommandElements)
3734+
$description = $null
3735+
for ($i = 0; $i -lt $elements.Count - 1; $i++) {
3736+
if ($elements[$i] -is [System.Management.Automation.Language.CommandParameterAst] -and
3737+
$elements[$i].ParameterName -eq 'Description') {
3738+
$description = $elements[$i + 1].Extent.Text.Trim("'", '"')
3739+
}
3740+
}
3741+
if ($null -ne $description) {
3742+
$prose[$description] = @($elements | Where-Object {
3743+
$_ -is [System.Management.Automation.Language.CommandParameterAst] -and
3744+
$_.ParameterName -eq 'Prose'
3745+
}).Count -gt 0
3746+
}
3747+
}
3748+
3749+
$stepKey = @($prose.Keys | Where-Object { $_ -like 'Test reproduction step*' })
3750+
$stepKey.Count | Should -Be 1 -Because 'the test reader bounds its steps in one place'
3751+
$prose[$stepKey[0]] | Should -BeTrue -Because 'nothing reads a test reproduction step'
3752+
3753+
$guarded = @(
3754+
'Sandbox reproduction step'
3755+
'Test expected behavior'
3756+
'Test observed behavior'
3757+
'Reported issue trigger'
3758+
'Automated test trigger'
3759+
'Test expected failure signature'
3760+
)
3761+
foreach ($field in $guarded) {
3762+
$prose.ContainsKey($field) | Should -BeTrue -Because "$field must still be bounded"
3763+
$prose[$field] | Should -BeFalse -Because "a guard matches against $field"
3764+
}
3765+
}
3766+
37143767
It 'neutralises a logging command it echoes back to the agent' {
37153768
$message = { ConvertTo-BoundedAgentLine `
37163769
-Value 'a ##vso[task.setvariable variable=x]y' `

.github/scripts/Replicate-Issue.ps1

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5693,10 +5693,22 @@ function Read-TestProposal {
56935693
throw 'The test proposal must contain 1-10 reproduction steps.'
56945694
}
56955695
for ($stepIndex = 0; $stepIndex -lt $steps.Count; $stepIndex++) {
5696+
# -Prose, unlike every sibling in this reader. A test reproduction step is
5697+
# read by nothing: Publish-ReplicationPR renders it into the PR body and no
5698+
# guard matches against it, unlike the sandbox reader's steps (which feed the
5699+
# timing-sensitive check) or the trigger and behavior fields below (which feed
5700+
# the orientation, safe-area and visual guards). Both stages downstream already
5701+
# trim it to exactly 300 without complaint - the manifest writer via
5702+
# ConvertTo-ReplicationSafeLog, and the publisher via ConvertTo-NormalizedPlainStep
5703+
# -Prose - and this call discards its result, so refusing here cannot protect
5704+
# anything a caller reads. It only destroys the attempt. Measured over 838
5705+
# complete logs: 4 attempts died on this bound at 380-398 characters, every one
5706+
# of them descriptive prose, and build 15105015 spent its final attempt on one.
56965707
$null = ConvertTo-BoundedAgentLine `
56975708
-Value $steps[$stepIndex] `
56985709
-Description "Test reproduction step $($stepIndex + 1)" `
5699-
-MaximumLength 300
5710+
-MaximumLength 300 `
5711+
-Prose
57005712
}
57015713
$null = ConvertTo-BoundedAgentLine -Value $proposal.expectedBehavior -Description 'Test expected behavior'
57025714
$null = ConvertTo-BoundedAgentLine -Value $proposal.observedBehavior -Description 'Test observed behavior'

0 commit comments

Comments
 (0)