Skip to content

Fix legacy Green/Blue lightbar channels parsing the Red element's value#47

Open
anagnorisis2peripeteia wants to merge 1 commit into
hbashton:mainfrom
anagnorisis2peripeteia:fix/ledcolor-legacy-channels
Open

Fix legacy Green/Blue lightbar channels parsing the Red element's value#47
anagnorisis2peripeteia wants to merge 1 commit into
hbashton:mainfrom
anagnorisis2peripeteia:fix/ledcolor-legacy-channels

Conversation

@anagnorisis2peripeteia

@anagnorisis2peripeteia anagnorisis2peripeteia commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

In ProfileDTO.PostProcessXml, the legacy per-channel lightbar colour path parses the wrong source strings: the green and blue channels both read RedColorString instead of GreenColorString / BlueColorString. A profile that stores its colour as the old separate <Red>/<Green>/<Blue> elements (rather than the combined <Color>) loads with all three channels set to the red value, so the lightbar shows the wrong colour.

The fix: parse each channel from its own element (two-line change), plus a regression test that deserializes a legacy per-channel profile (Red=10, Green=20, Blue=30) and asserts the mapped DS4Color channels individually.

Before/after:

  • Before: the new test fails — Assert.AreEqual failed. Expected:<20>. Actual:<10> (green channel received red's value).
  • After: it passes; the full suite (with the repo's documented CI exclusions) shows no new failures.

Bug 2 of #46 — found while mutation-testing the profile-serialization code (#37): the surviving mutants pointed at this block being unasserted, and reading it turned up the copy-paste slip.


Local review history: https://gist.github.com/anagnorisis2peripeteia/b97ed542427a5e3fe0184c8074873a24

Proof manifest

Before / After (same command, same machine)

dotnet test DS4WindowsTests\DS4WindowsTests.csproj -c Release -p:Platform=x64 --filter "Name=CheckLegacyPerChannelColorRead"
Run Result
Base (ba4bdcb) Assert.AreEqual failed. Expected:<20>. Actual:<10>. — green channel received the Red element's value
This branch (aef33d4) ✅ passes; full suite shows no new failures; x64/x86 publishes clean

Structured before/after manifest for the red-green evidence already in this description (regression test Expected:<20> Actual:<10> on base; passes on this branch; no new failures in the full suite).

Manifest + raw run outputs: https://gist.github.com/anagnorisis2peripeteia/5f618fc106fac64e4baa18fc28636a8e

In PostProcessXml's legacy per-channel colour path, the green and blue
channels both parsed RedColorString instead of their own GreenColorString /
BlueColorString, so a profile using the old separate <Red>/<Green>/<Blue>
elements loaded with all three channels set to the red value and the
lightbar showed the wrong colour.

Parse each channel from its own element, and add a regression test that
deserializes a legacy per-channel profile and asserts the mapped
DS4Color channels individually.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant