From 07b83fa7e9c8eb73fc8a83c4b492113436847f86 Mon Sep 17 00:00:00 2001 From: Nico Wiedemann Date: Sun, 27 Sep 2026 03:36:41 +0200 Subject: [PATCH] Give dialogs a side margin, and stop import misreading its own rules as a conflict The export, import and confirmation dialogs had a maximum width but no side margin, so below about 670px wide the panel touched both edges of the window with no gap. Added the same px-4 the other two dialogs already use. Separately, the import conflict check compared imported and current rules as JSON text. An export writes a rule's fields in a different order than the app builds them in - alphabetical, from serde_json::Value - so any context with auto-switch rules was reported as conflicting with itself on every import. Added sameRules(), which compares rules by what they do: field order and a missing matchCase/useRegex (same as false) no longer count as a difference; the order of the rules themselves still does. 5 new unit tests for sameRules. Frontend: 224 tests, svelte-check clean. Co-Authored-By: Claude Opus 5 (1M context) --- CHANGELOG.md | 10 ++++ src/lib/components/ConfirmationDialog.svelte | 2 +- src/lib/components/ExportDialog.svelte | 2 +- src/lib/components/ImportDialog.svelte | 14 ++--- src/lib/utils/__tests__/rules.test.ts | 54 ++++++++++++++++++++ src/lib/utils/rules.ts | 45 ++++++++++++++++ 6 files changed, 116 insertions(+), 11 deletions(-) create mode 100644 src/lib/utils/__tests__/rules.test.ts create mode 100644 src/lib/utils/rules.ts diff --git a/CHANGELOG.md b/CHANGELOG.md index 3fd201f..014ec1f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,16 @@ popover, not for the person who wrote the commit. ## [Unreleased] +### Fixed +- **Importing a context whose rules match your current ones no longer reports a conflict.** + The check compared the imported and current rules as JSON text, and an export writes a + rule's fields in a different order than the app does - so any context with auto-switch + rules was flagged as conflicting with itself on every import, asking you to pick between + two copies of the same rule +- **Export, import and confirmation dialogs no longer touch the window edges on a narrow + window.** Each had a maximum width but no side margin, so below about 670px wide the panel + ran edge to edge with no gap on either side + ## [1.8.10] - 2026-09-27 ### Changed diff --git a/src/lib/components/ConfirmationDialog.svelte b/src/lib/components/ConfirmationDialog.svelte index 576a3a4..6d6e739 100644 --- a/src/lib/components/ConfirmationDialog.svelte +++ b/src/lib/components/ConfirmationDialog.svelte @@ -113,7 +113,7 @@