ColorSync suppression engine — six layers (#14) #45

Merged
gronod merged 1 commits from feat/14-colorsync into milestone/m3-printing 2026-09-09 00:19:31 +01:00
Owner

Six-layer unmanaged-printing engine (docs/11):

  1. Session binding (issue 13).
  2. Private SPI PMSessionSetColorMatchingMode{Lock,,NoLock} via dlsym(RTLD_DEFAULT) — 2-arg (PMPrintSession, CFStringRef) signature, modes AP_ApplicationColorMatchingApplicationColorMatching, first 0 wins. Attempt order is Core data so the sequence is unit-testable; missing symbols degrade to layer 3.
  3. PMPrintSettingsSetValue both AP_ColorMatchingMode and AP.ColorMatchingMode = AP_ApplicationColorMatching, locked.
  4. Driver bypass pre-select from lpoptions -l keys, unlocked — Canon CNIJIntent2=4/CNIJIntent=4, Epson EPIJ_CCor=0/EPIJ_CMat=3, Gutenprint/generic …=Uncorrected, EpsonColorMode=Off.
  5. Mirror ③+④ into NSPrintInfo.printSettings for the PDE.
  6. PMPrintSettingsToOptionsCupsOptionsFilter (drops com.apple.*, collate/copies/job-sheets, empty values, both AP_* keys; keeps unknown vendor keys) → capturedCupsOptions + mediaType.

PMPrintSettingsToOptions is resolved via dlsym like the SPI (symbol verified present). Suppression runs only on the PM-bound path; the NSPrinter fallback skips SPI/locked-keys (no session printer to attach to).

Tests: filter fixtures + injected-resolver suites covering attempt order, first-zero-wins, mode fallback, and all-symbols-missing.

Closes #14.

Generated with Devin

Six-layer unmanaged-printing engine (docs/11): 1. Session binding (issue 13). 2. Private SPI `PMSessionSetColorMatchingMode{Lock,,NoLock}` via `dlsym(RTLD_DEFAULT)` — 2-arg `(PMPrintSession, CFStringRef)` signature, modes `AP_ApplicationColorMatching` → `ApplicationColorMatching`, first `0` wins. Attempt order is Core data so the sequence is unit-testable; missing symbols degrade to layer 3. 3. `PMPrintSettingsSetValue` both `AP_ColorMatchingMode` **and** `AP.ColorMatchingMode` = `AP_ApplicationColorMatching`, locked. 4. Driver bypass pre-select from `lpoptions -l` keys, unlocked — Canon `CNIJIntent2=4`/`CNIJIntent=4`, Epson `EPIJ_CCor=0`/`EPIJ_CMat=3`, Gutenprint/generic `…=Uncorrected`, `EpsonColorMode=Off`. 5. Mirror ③+④ into `NSPrintInfo.printSettings` for the PDE. 6. `PMPrintSettingsToOptions` → `CupsOptionsFilter` (drops `com.apple.*`, collate/copies/job-sheets, empty values, both AP_* keys; keeps unknown vendor keys) → `capturedCupsOptions` + `mediaType`. `PMPrintSettingsToOptions` is resolved via `dlsym` like the SPI (symbol verified present). Suppression runs only on the PM-bound path; the `NSPrinter` fallback skips SPI/locked-keys (no session printer to attach to). Tests: filter fixtures + injected-resolver suites covering attempt order, first-zero-wins, mode fallback, and all-symbols-missing. Closes #14. Generated with [Devin](https://devin.ai)
gronod added the Kind/Feature
Priority
Critical
1
Project/ICCery-v2Feature/Backend
labels 2026-09-09 00:19:23 +01:00
gronod added 1 commit 2026-09-09 00:19:24 +01:00
- ColorMatchingAttempts (Core): dlsym order Lock -> Mode -> NoLock and
  modes AP_ApplicationColorMatching -> ApplicationColorMatching as data;
  both AP_ print-settings keys; 2-arg (PMPrintSession, CFStringRef)
  signature — never integer 1 (#188).
- ColorSyncSuppressor (app): layer 2 SPI via injectable dlsym resolver,
  first 0 wins; layer 3 PMPrintSettingsSetValue both keys locked;
  layer 4 driver bypass from lpoptions -l keys, unlocked; layer 5
  NSPrintInfo.printSettings mirror; layer 6 PMPrintSettingsToOptions
  (dlsym'd) -> filter -> captured cupsOptions + mediaType.
- CupsOptionsFilter (Core): drops com.apple.*, collate/copies/
  job-sheets/pserrorhandler-requested, empty values, both AP_* keys;
  keeps relevant + unknown non-com.* keys; extractMediaType prefers
  MediaType then EPIJ_Medi.
- PrintPanelService: suppression runs between session binding and
  runModal on the PM path; capture feeds PrintPropertiesResult.

Tests: filter fixtures + injected-resolver call-order/first-win/
mode-fallback/missing-symbol suites.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
gronod merged commit 597fd897ed into milestone/m3-printing 2026-09-09 00:19:31 +01:00
Sign in to join this conversation.
No Reviewers
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: gronod/iccery-v2-mac#45