Repository navigation
Keep a surrogate pair at the cap's head/tail split when the output fits - #127
Merged
Merged
Conversation
…fer only in case A case-sensitive [hashtable]::new() job with 'canceltoken' got the kit's own token in its place, since the check used the job's own comparer and the worker's copy is case-insensitive. Two keys differing only in case collapsed into one, the later silently winning; such a job is now refused, up front for -JobParams and as it arrives for -NextJobProvider.
When -MaxOutputChars' head would end on the first half of a surrogate pair, it turned that half away but the tail kept its own size, so output exactly as long as the cap lost the pair. The tail now takes the slot the head turns away.
This was referenced Dec 3, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Depends on #126, merge after it.
What was wrong
With
-MaxOutputChars, the kit keeps a head (the first half of the cap) and a tail (the rest). When the head would end on the first half of a surrogate pair, it turns that half away, but the tail kept its own size. So output exactly as long as the cap, with a pair where the head ends, lost that pair:a😀bunder a cap of 4 came back asab, with 2 counted as dropped, and a lone emoji under a cap of 2 came back empty.What changed
When the head turns away a pair's first half, the tail takes its slot (set before the tail is allocated). Output that fits the cap is kept whole, and the total kept still never exceeds the cap. A C# change in
PkStreamReadTask, under the type version 4.3 already bumped.How it was tested
Harness section BE: a real program's output (
cmd /u /c echo ab😀c, 7 characters) under a cap of 7 comes back whole;PkStreamReadTaskkeeps an emoji under a cap of 2,a😀bunder 4 andab😀cdunder 6 whole. The existing surrogate test now uses a cap of 7, so the head's end and the tail's start both land inside pairs.Before the fix (main's kit with the new harness), 5.1 and 7 alike:
After: the full harness passes on Windows PowerShell 5.1 and PowerShell 7 (799 assertions each), and
Build/Update-ParallelKitCSharp.ps1 -Compilebuilds the C# with no warnings under csc (C# 5) and dotnet (LangVersion 5).