fix: Windows command quoting, atomic JSON/log writes, restore dropped test
Implements items 1-3 of the whole-project review's suggested order (docs/PROJECT_REVIEW_PLAN.md): - Restore TestJobListViewIsCompact, accidentally dropped by 5b0e6fe; drop the redundant TestDefaultConfigUsesDetailedJobList row from TESTS.md and document the two other doc gaps the review found. - Fix quoteLeadingWindowsProgramPath to find the earliest file-extension match at a word boundary instead of the first extension in list order, so a .bat/.cmd command whose argument ends in .exe no longer has its whole command line mistaken for the program path. - Write gosentry.json, jobs.json, and run log files atomically (temp file + rename) so a crash or power loss mid-write can no longer leave a truncated file. Wire Service.Stop() into the app shutdown path so it actually runs, cancelling the run context for in-flight runs. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -21,6 +21,17 @@ the app icon (experimental).**
|
||||
- On Windows, failure toasts can show the app icon: after `NewWindow`,
|
||||
`AppMetadata.Icon` is registered so Fyne picks up artwork without calling
|
||||
`SetIcon`, which would override the PE multi-size window/taskbar icon.
|
||||
- Fixed a Windows quoting bug where a job whose **Command** field held a whole
|
||||
command line (a `.bat`/`.cmd` wrapper followed by an argument that itself
|
||||
ended in `.exe`) had its entire command line mistaken for the program path,
|
||||
so the run failed with an unmappable shell error. The program path is now
|
||||
found by the earliest file-extension match at a word boundary, not the first
|
||||
extension in list order.
|
||||
- `gosentry.json` and `jobs.json` (and run log files) are now written
|
||||
atomically — to a temp file, then renamed into place — so a crash or power
|
||||
loss mid-write can no longer leave a truncated or empty file. `Service.Stop()`
|
||||
is now called when the app quits, which also makes the run context
|
||||
cancellation reach in-flight runs on shutdown.
|
||||
|
||||
**Jobs:**
|
||||
|
||||
|
||||
+14
-2
@@ -100,7 +100,6 @@ Tests autostart argument helpers and the jobs-list density normalization rule.
|
||||
| `TestAutostartArguments` | Verifies `AutostartArguments` returns `--start-in-tray` when the tray is enabled and an empty string when it is off. |
|
||||
| `TestResolveStartHidden` | Verifies hidden autostart requires both the CLI flag and `KeepRunningInTray`. |
|
||||
| `TestJobListViewIsCompact` | Verifies only the exact `"compact"` value selects one-line rows: empty, differently-cased, and unrecognised values all read as detailed. |
|
||||
| `TestDefaultConfigUsesDetailedJobList` | Verifies `DefaultConfig` selects the detailed job list. |
|
||||
|
||||
---
|
||||
|
||||
@@ -554,6 +553,19 @@ Tests main view construction with an injected `*app.Service`.
|
||||
|
||||
---
|
||||
|
||||
### src/ui/notify_timing_test.go
|
||||
|
||||
**Package:** `ui`
|
||||
|
||||
Tests the failure-notification timing diagnostics added in 1.0.2.
|
||||
|
||||
| Test | Purpose |
|
||||
|------|---------|
|
||||
| `TestNotificationTimingFormatLine` | Verifies `notificationTiming.formatLine` renders the job name and the three millisecond deltas (`ms_after_run`, `ms_fyne_do`, `ms_send`) plus their sum (`ms_app_total`). |
|
||||
| `TestAppendNotificationTimingLogWritesHeaderAndRow` | Verifies `appendNotificationTimingLog` creates `notify-timing.log` with its header on first write and appends a row containing the job name. |
|
||||
|
||||
---
|
||||
|
||||
## Test Design Principles
|
||||
|
||||
1. **Isolation** — Tests use `t.TempDir()` for file operations and `t.Setenv()` for environment variables to avoid affecting system state.
|
||||
@@ -603,6 +615,6 @@ A coverage run over the non-UI packages reports these as uncovered. All are
|
||||
intentional; none is an oversight to be "fixed" with a test.
|
||||
|
||||
- The real `Clock` — a fake is injected everywhere it is used.
|
||||
- `storage.OpenStore`, `storage.ResolvePaths`, `app.Service.Start`, `app.Service.Open` — process entry points, exercised by running the app.
|
||||
- `storage.OpenStore`, `storage.ResolvePaths`, `storage.PeekKeepRunningInTray`, `app.Service.Start`, `app.Service.Open` — process entry points, exercised by running the app.
|
||||
- The autostart and desktop-icon wrappers — OS integration, driven only on a real desktop.
|
||||
- `app.Service.ShouldNotifyOnFailure` — a getter under the mutex.
|
||||
|
||||
Reference in New Issue
Block a user