test(cards): #204 DocumentCardSet CMYK Debug/Release resolver contract - #493
Merged
Merged
Conversation
Pin the CMYK color-space resolver on DocumentCardSet — the documented Debug=RGB / Release=CMYK contract (CLAUDE.md "Debug vs Release Builds") that had zero test coverage. GetConvertToCmyk(config) => config.UseDebugParams ? ConvertToCmykDebug : ConvertToCmykRelease. Five tests, all deterministic across build modes (the ForceDebugParams/ForceReleaseParams flags drive UseDebugParams directly, independent of the #if DEBUG compile flag): 1. Defaults: Debug resolution yields RGB (ConvertToCmykDebug=false), Release yields CMYK (ConvertToCmykRelease=true) — the documented table. 2. Resolver is a pure passthrough — custom inverted values forwarded verbatim per mode (catches a regression that hardcodes the color space). 3. Legacy ConvertToCmyk field is DECOUPLED — does not feed the resolver; only the Debug/Release pair governs. 4. ForceReleaseParams override wins over ForceDebugParams — the documented "use Release params in Debug builds" override priority. A swapped ternary, drifted default, or legacy-field leak would silently flip the color space per build mode (Debug previews balloon to CMYK, or Release print output ships as RGB). These guards catch that. Additive only: 1 new file, 5 tests, zero production code and zero existing test modified. Verified: 5/5 new tests green; full suite 275 passed / 0 failed / 5 skipped. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.
What
Primaire #204 (dispatch
kg1op0) — next 0-coverage fragile zone, new file. Pins the CMYK color-space resolver onDocumentCardSet: the documented Debug=RGB / Release=CMYK contract. Additive only (1 new file, 0 prod code, 0 existing test touched).Why this zone
The pipeline emits different color spaces per build mode (CLAUDE.md "Debug vs Release Builds"):
dotnet run)-c Release)DocumentCardSet.GetConvertToCmyk(config)resolves it:where
UseDebugParams = (isInDebugMode || ForceDebugParams) && !ForceReleaseParams.No test exercised this resolver (
GetConvertToCmyk/ConvertToCmykhad zero references in the test project). A swapped ternary, a drifted default, or a regression that lets the legacyConvertToCmykfield leak into the resolution would silently flip the color space per build mode — Debug previews would balloon to CMYK size, or Release print output would ship as RGB. Same silent-regression class as the contracts pinned by #477/#488/#491.I evaluated ai-01's other two candidates and set them aside with reasons:
HarvestManagerexpectedImageCount: theceil(cardIds.Count/rscount)formula is real and documented, but it is inline in the Playwright harvest flow (DownloadImages, needsIFrameLocator) — not isolable into a unit test without a production refactor or a Playwright run. Not "additive only". Left for a future extraction PR.PdfManager.GetMetadata: no such member exists by that name inPdfManager.cs. Dropped.The five tests
All deterministic across build modes — the
ForceDebugParams/ForceReleaseParamsflags driveUseDebugParamsdirectly, so assertions hold whether the test assembly is compiled Debug or Release (independent of the#if DEBUGisInDebugModeterm).ConvertToCmykDebugdefaultsfalse;GetConvertToCmyk(forcedDebug)isfalse. Catches a drifted default shipping CMYK-sized Debug previews.ConvertToCmykReleasedefaultstrue;GetConvertToCmyk(forcedRelease)istrue. Catches Release shipping RGB print output.Debug=true, Release=false) are forwarded verbatim per mode — catches a regression that hardcodes the color space instead of reading the pair.ConvertToCmykfield is decoupled: setting the legacy field has no effect on the resolved value; only the Debug/Release pair governs. Pins the decoupling.ForceReleaseParamsoverride wins: with both force flags set, Release wins (UseDebugParamsgated by&& !ForceReleaseParams) → Release CMYK value, even in a Debug build. The documented override priority.Verification
Constraints held
0 merges / 0 regen / 0 API runs. Additive only. Release gate intact. Worker po-2024 — signaling, not declaring PASS.
🤖 Worker po-2024