# ADR-103 Print Bridge Runs Over a Syncthing Job Folder With a Self-Updating Watcher

## Status

Accepted, 2026-07-02.

## Status History

```yaml
status_history:
  - date: 2026-07-02
    status: Accepted
    changed_by: hkl
    reason: Phase 2 of the creative pipeline built; contract recorded (implements ADR-101/102)
    changed_via: adr-kit (360lm)
```

## Context

ADR-102 requires CorelDRAW (designer PC) as the conversion source for modern `.cdr`. The VPS
and the designer PC need a transport + execution contract that (a) needs no inbound access to
either machine, (b) survives reboots/offline periods, and (c) can be maintained without ever
touching the designer PC again after one 15-minute setup.

## Decision

- **Transport**: Syncthing folder `print-bridge` (VPS path `/var/www/360lm/print-bridge`,
  designer path `D:\PrintBridge`). Subdirs: `jobs/ processing/ out/ failed/ logs/ setup/`.
- **Job contract**: a job = `jobs/<id>.job.json` + `jobs/<id>.cdr`. Fields: `id`, `op`
  (`to_pdf` | `resize+to_pdf` | `…+save_cdr`), `src`, `target_in {w,h}`, `tif {dpi,mode,compression}`.
  Results: `out/<id>/<id>.pdf` (+ optional `-adjusted.cdr`) + `<id>.result.json`
  (status/artwork_in/corel_version/error). Failures → `failed/`; nothing is ever deleted.
- **Designer-PC watcher is self-updating**: `setup/watcher.ps1` lives INSIDE the synced
  folder; a Scheduled Task ("VCC Print Bridge", every 5 min, non-admin) executes whatever
  version is currently synced. All maintenance happens from the VPS by editing the synced
  script. Never edited locally.
- **COM surface kept minimal**: open → optional proportional resize → `PublishToPDF` →
  optional `SaveAs`. Deliberately NO `ExportBitmap` (fragile enum/parameter surface).
- **Rasterization is VPS-side**: `vcc-print-finish` (cron */5) converts bridge PDFs to the
  print TIF via Ghostscript `tiff32nc` @ 100 DPI, LZW (profile per MDD §2) — verified
  3500×7200 px CMYK on a synthetic 35×72 in PDF. Enqueue via `vcc-print-job` (`--selftest`).

## Alternatives Considered

1. **SSH/WinRM from VPS into the designer PC.** Rejected: inbound access to a personal
   Windows machine, credential handling, firewall/NAT pain.
2. **TIF exported by CorelDRAW directly.** Rejected: `ExportBitmap` COM parameters vary by
   version and fail opaquely; Ghostscript on the VPS gives deterministic, iterable
   CMYK/DPI/compression control.
3. **Email/manual file handoff.** The status quo this pipeline replaces.

## Consequences

- One-time designer-PC setup (SyncTrayzor + install.ps1); afterwards zero-touch.
- Jobs queue harmlessly while the designer PC is off; watcher drains the queue when it returns.
- First-run calibration risk is confined to the resize COM calls — fixed remotely via the
  self-updating watcher; errors land verbatim in synced `logs/`.
- The laptop may join the folder as an optional monitor/drop node (never runs the watcher —
  a second watcher would double-process jobs).
