Skip to content

test(cards): #204 DocumentCardSet CMYK Debug/Release resolver contract - #493

Merged
jsboige merged 1 commit into
masterfrom
test/204-documentcardset-cmyk-contract
Jun 16, 2026
Merged

test(cards): #204 DocumentCardSet CMYK Debug/Release resolver contract#493
jsboige merged 1 commit into
masterfrom
test/204-documentcardset-cmyk-contract

Conversation

@jsboige

@jsboige jsboige commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

What

Primaire #204 (dispatch kg1op0) — next 0-coverage fragile zone, new file. Pins the CMYK color-space resolver on DocumentCardSet: 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"):

Mode CMYK conversion
Debug (dotnet run) Disabled — RGB, preview-friendly, smaller files
Release (-c Release) Enabled — CMYK, printer quality

DocumentCardSet.GetConvertToCmyk(config) resolves it:

config.UseDebugParams ? ConvertToCmykDebug : ConvertToCmykRelease

where UseDebugParams = (isInDebugMode || ForceDebugParams) && !ForceReleaseParams.

No test exercised this resolver (GetConvertToCmyk/ConvertToCmyk had zero references in the test project). A swapped ternary, a drifted default, or a regression that lets the legacy ConvertToCmyk field 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:

  • HarvestManager expectedImageCount: the ceil(cardIds.Count/rscount) formula is real and documented, but it is inline in the Playwright harvest flow (DownloadImages, needs IFrameLocator) — 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 in PdfManager.cs. Dropped.

The five tests

All deterministic across build modes — the ForceDebugParams/ForceReleaseParams flags drive UseDebugParams directly, so assertions hold whether the test assembly is compiled Debug or Release (independent of the #if DEBUG isInDebugMode term).

  1. Defaults — Debug→RGB: ConvertToCmykDebug defaults false; GetConvertToCmyk(forcedDebug) is false. Catches a drifted default shipping CMYK-sized Debug previews.
  2. Defaults — Release→CMYK: ConvertToCmykRelease defaults true; GetConvertToCmyk(forcedRelease) is true. Catches Release shipping RGB print output.
  3. Resolver is a pure passthrough: custom inverted values (Debug=true, Release=false) are forwarded verbatim per mode — catches a regression that hardcodes the color space instead of reading the pair.
  4. Legacy ConvertToCmyk field is decoupled: setting the legacy field has no effect on the resolved value; only the Debug/Release pair governs. Pins the decoupling.
  5. ForceReleaseParams override wins: with both force flags set, Release wins (UseDebugParams gated by && !ForceReleaseParams) → Release CMYK value, even in a Debug build. The documented override priority.

Verification

  • New tests: 5/5 green.
  • Full suite: 275 passed / 0 failed / 5 skipped (5 skips = the usual Playwright/Freeplane interactive tests).
  • No production code changed; no config/CSV/templates touched.

Constraints held

0 merges / 0 regen / 0 API runs. Additive only. Release gate intact. Worker po-2024 — signaling, not declaring PASS.

🤖 Worker po-2024

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>
@jsboige
jsboige merged commit eb66b9b into master Jun 16, 2026
3 checks passed
@jsboige
jsboige deleted the test/204-documentcardset-cmyk-contract branch June 16, 2026 08:09
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