Validate current macOS and Windows canvas color contracts - #448
Merged
coneilen merged 3 commits intoSep 24, 2026
Merged
Conversation
…-capture scaffold - investigation/visual-baseline/manifest.json: additive currentThemeContract section tracking today's graphcode/Sources/Features/App/Theme.swift (canvasTone #0A0C0B, canvasGridLine #151816), separate from and never overwriting the immutable historical tokenContracts/baseCommit pin at ece55b6 (verified against Theme.swift as it existed at that exact commit). - Tools/windows/visual-baseline.ps1: re-derives the two current tokens from the actual worktree Theme.swift on disk every run and asserts an exact (zero-tolerance) match against currentThemeContract -- a static source-drift check, distinct from a separate, still-gated live pixel tolerance check. Adds a tested ConvertFrom-Colorref (COLORREF BGR decode) and a tolerance-boundary self-check using synthetic threshold/threshold+1 values, plus an off-by-default -Live/-AllowLaunch capture scaffold (reuses windows-shell.ps1 for build/launch; throws until a capture slot and fixture-region wiring are in place -- not executed by this change). - Tools/windows/Tests/VisualBaseline.Tests.ps1: adds regression coverage for drift detection, COLORREF byte order, and the tolerance boundary using independent synthetic copies of the logic. - investigation/ui-parity-matrix.md: Per-monitor DPI row records that this session's environment has a single 96 DPI monitor, so a live multi-monitor transition cannot be captured here; no status change. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Signed-off-by: Colin Neilens <coneilen@microsoft.com>
…ve scaffold, provenance, revert ledger - Extract the comparator into Tools/windows/Test-CurrentThemeContract.ps1, a standalone, mandatory-parameter script dot-sourced by visual-baseline.ps1 for the real run and invoked directly (own pwsh process) by VisualBaseline.Tests.ps1 against temporary fixture files. Tests no longer re-declare Test-* copies of the comparator; they exercise the exact production code, so breaking/deleting the real drift assertion now makes the tests fail (verified locally by temporarily neutering the comparison and confirming VisualBaseline.Tests.ps1 fails, then restoring it and confirming PASS again). - Enforce exact required token identity/cardinality/no-duplicates (an empty or partial token list no longer passes vacuously), RGB shape (3 channels) and range (0-255), and hex-vs-rgb consistency. - Get-ThemeSwiftTokenRgb now strips line comments before matching (a commented-out/obsolete declaration is treated as absent, not matched) and rejects any trailing expression after the Color(...) literal (e.g. an ".opacity(...)" suffix) instead of silently validating just the base RGB. - Replace the manifest-vs-manifest crossChecks array with a real per-token windowsToken cross-source check: the comparator reads the actual named graphcode-windows/src/DesignTokens.zig Color constant, decodes its COLORREF byte order, and compares it against the independently Theme.swift-derived expectation. - Record hemeSwiftBlobSha256 (SHA-256 over the file's current text with CRLF normalized to LF) as an approved-blob provenance check, validated last (after the more specific per-token diagnostics) so an edit a per-token regex would miss is still caught, without needing any historical git object. - Remove the unfinished -Live/-AllowLaunch scaffold, the hard-coded D:\zigpin default, and the unused liveToleranceRegions manifest section -- this lands a complete static checker with no dead launch scaffolding or speculative tolerance prose. - Revert the unrelated Per-monitor DPI ledger prose edit; the static stage was approved with no ledger changes. - Add Tools/windows/VISUAL-BASELINE.md documenting the actual static command/contract; trim verbose inline comments in visual-baseline.ps1 and the new comparator. Signed-off-by: Colin Neilens <coneilen@microsoft.com> Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Signed-off-by: Colin Neilens <coneilen@microsoft.com>
…apping, integral RGB, block comments, cleanup - windowsToken is now mandatory for both required tokens with an exact expected mapping (canvasTone -> canvas_tone, canvasGridLine -> canvas_grid_line); a blank, missing, or wrongly-mapped field fails outright instead of silently skipping the Windows/macOS cross-check. Added remove/blank/wrong-map mutation tests. - Enforce currentThemeContract.schemaVersion == 1. - Validate each recorded RGB channel is an integral numeric byte before any [int] coercion: null and fractional channel values are now rejected explicitly instead of being silently rounded/converted. Added fractional- and null-channel negative tests. - Remove-SwiftComments now strips Swift /* ... */ block comments (which may span multiple lines), not just //, so a declaration commented out either way is treated as absent -- and fails explicitly if an unterminated/ unsupported block-comment delimiter survives, rather than silently misparsing the rest of the file. Added block-commented-declaration and unterminated-block-comment tests. Verified the real canvasBackground alias in Theme.swift is in fact a bare (non-opacity) alias of canvasTone, matching the manifest's documentation note. - VisualBaseline.Tests.ps1 now wraps fixture creation/use in try/finally so the temporary fixture directory is removed on both pass and failure, not only when every assertion happens to succeed. - Folded Tools/windows/VISUAL-BASELINE.md into the existing investigation/visual-baseline/README.md instead of a second documentation location; the standalone file is removed. Signed-off-by: Colin Neilens <coneilen@microsoft.com> Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Signed-off-by: Colin Neilens <coneilen@microsoft.com>
coneilen
force-pushed
the
coneilen-microsoft-ui-parity-cross-cutting-evidence
branch
from
September 24, 2026 23:10
7da69fa to
cd81d9a
Compare
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.
Summary
Adds static validation of the current canvas color contract across macOS
Theme.swift and Windows DesignTokens.zig.
Preserves the historical visual baseline unchanged and records the current-source
contract separately, including source provenance and required Windows mappings.
The production validator checks:
Fixture tests invoke the production validator rather than duplicating its logic.
Documentation is consolidated into the existing visual-baseline README.
Regression evidence
RED: mutate fixture sources or contract fields -> the production validator rejects invalid colors, mappings, schema versions, RGB channels, and commented-out declarations.
GREEN: restore each fixture -> validation passes.
REGRESSION: run Tools/windows/visual-baseline.ps1 and Tools/windows/Tests/VisualBaseline.Tests.ps1 -> both pass, with 18 fixture-driven scenarios reported; the coordinator independently reran the regression suite.
Scope and limitations
source edit, including changes outside the checked tokens.
Reviewed head: 31deeb4.
All commits are signed off; the sign-off rebase preserved the reviewed tree.