ADR 0007: Per-file conversion options with selective persistence

Decision: Dual-layer options model (global defaults + per-file overrides) with a strict persist allowlist (themeMode, showEditor only). Why: Batch processing requires per-file tuning; restoring session state on relaunch causes more confusion than it saves.

Context

The app started single-file: one image, one set of conversion options (threshold, corner policy, artifact area, smoothness, path optimisation), one preview. The store held a single conversionOptions object bound to the UI controls, and that was enough.

While implementing the batch flow I hit the bug during testing: selecting a file in the list, adjusting its threshold, switching to another file, and finding the second file’s threshold had moved too. The single shared conversionOptions was being applied across every file in the batch. That is obviously wrong: different images need different settings (a sharp-edged logo wants a different threshold from a soft photograph), and a batch with one shared control makes per-file tuning impossible.

Fixing this surfaced a second, separate question: what persists across restarts? Conversion options, the file list, the SVG cache, these are context that belongs to a specific working session. Restoring them would likely be confusing or wrong (stale files, cached SVGs from conversions the user doesn’t remember). But some states are user-level: the theme mode, the code-editor panel visibility. Forcing the user to re-set those every launch is friction with no purpose.

Two distinct requirements, one store.

Options considered

For the options model:

For persistence scope:

Decision

Rationale

Why dual-layer instead of per-file only. The global layer is inheritance root. When the user drags in a new file, they expect it to start from “where I was just working,” not from hard-coded defaults. Dual-layer gives that behaviour: the global state mirrors the UI controls, a new file inherits the current global, and once the user adjusts anything for that specific file, the override is recorded in fileOptionsByPath and the file owns its own settings from then on. No extra UI needed, switching files is the interaction.

Why these two fields persist, and not others. The allowlist is short:

Everything else is session-scoped by design:

Consequences

Positive

Negative

Follow-up

Code: src/renderer/store/useAppStore.ts, fileOptionsByPath, updateConversionOptions, partialize