m8-load-and-guard-rails.md 4.0 KB

M8: load and guard rails

Branch: m8-load-guard-rails → main

Load itself, the unsaved-changes prompt on New and Load, the overwrite confirmation and Go's error messages for bad WAVs and limits came in M5–M7. This PR adds the rest of M8 and the checklist for device checkpoint B.

What changed

  • Missing sample files. A loaded project's samples are expected in its _[ProjectData] folder, and a sample assigned from elsewhere can be moved or deleted later. The state now says, per pad, where the sample comes from and whether that file still exists.
    • The grid shows missing (in red) on such pads.
    • The pad panel shows the expected path and says to replace the sample or put the file back and load again. Play is disabled.
    • The footer counts missing files.
    • Export zip and Export to folder are disabled while any sample file is missing, and the footer says so ("1 sample file missing: export is disabled"). The buttons' tooltip gives the reason too. Go still refuses such an export and lists every missing file, as since M3, if it's ever asked.
    • Replacing the sample clears the warning.
  • Closing the window with unsaved changes. A Go hook stops the close and sends a close event. The app asks "Close without exporting?"; Close discards the changes and quits, Cancel stays. Without unsaved changes the window closes straight away.
  • Device checkpoint B checklist (docs/checkpoint-b.md, linked from the build plan). Five projects (MpckitB1–B5), each made from DemoFile in the app: no changes, moving a pad with notes, copying across banks and swapping pads with notes, removing the current sequence and adding one in bank B, and shortening a sequence with notes. Each lists what to listen for, plus an empty results table. It also covers open question 7 (currentSequence) and B5 (notes past a new end).
  • Go service: CloseWindow for the frontend. Dirty and SetCloser are for main.go only and kept out of the bindings.

Change after the first laptop run (bajdev, 2026-11-11: checks 1–3 passed): disable the export buttons while a sample is missing. Before, a user could choose a folder and miss the error text.

Checkpoint B results (bajdev, 2026-11-11): all five projects loaded and worked on the device, so M8's done-when is met. Recorded in docs/checkpoint-b.md, the format doc (section 7, open questions 4 and 7) and the build plan (checkpoint B, risk table).

  • Open question 4 is answered (B5): notes past a shortened end are kept, and play again when the sequence is lengthened. The shorten dialog now says so, instead of "not yet known".
  • Open question 7 (currentSequence slot or list position) is still open: in MpckitB4 both readings point at Sequence 02.

Testing

On the server: go vet and go test ./... pass. New tests:

  • Missing files: load a copy of DemoFile with one sample deleted. The count is 1 and the right pad is marked (no preview URL, source path set). Export fails naming the file and writes nothing. After replacing the sample, the count is 0 and export works.
  • Close: CloseWindow calls the closer, and Dirty follows edits.

The frontend is untested here (no Node). On the laptop:

  1. npm run check in frontend: 0 errors, 0 warnings.
  2. Missing file: copy DemoFile.xpj and its DemoFile_[ProjectData] folder somewhere, delete 80s-Snr-Dreamer SA.wav from the copy, and Load it. A02 shows missing, A02's panel shows the path, and Play is disabled. Both export buttons are disabled, and the footer says "1 sample file missing: export is disabled". Replace A02 with any WAV: the warning goes and both export buttons work again.
  3. Close: make any change and close the window. The app asks; Cancel stays open. Close again and choose Close: the app quits. With no changes (or right after exporting) the window closes without asking.
  4. Checkpoint B (M8 done-when): build the five projects in docs/checkpoint-b.md, try them on the device, and send me the results. I'll record them in the format doc and build plan.