46 lines
3.5 KiB
Markdown
46 lines
3.5 KiB
Markdown
# Handoff: issue #20 (save writes a 0-byte file)
|
|
|
|
Written 2026-11-23. Read `OVERVIEW.md` first for the app itself. This file covers only the open problem.
|
|
|
|
## The problem
|
|
|
|
Issue #20 (https://gitea.ericthered.tech/eric/final-wishes/issues/20), a follow-up to #19 (`?reset=1`).
|
|
|
|
After unlocking, adding `#reset=1` and erasing the secrets, the Save button (Chrome) creates a 0-byte file. The status line shows:
|
|
|
|
> Save failed: Failed to execute 'createWritable' on 'FileSystemFileHandle': The request is not allowed by the user agent or the platform in the current context.
|
|
|
|
## What is established
|
|
|
|
- It is **not** caused by reset. Save after reset uses the same `save()` path as any edit (`src/app.js`, `async function save`). The user has not yet tried a plain save without `#reset=1` on the SSD.
|
|
- The picker succeeds and Chrome creates the empty file. Then `state.handle.createWritable()` throws `NotAllowedError`. Nothing is written.
|
|
- Headless Chrome with a stubbed `showSaveFilePicker` (OPFS) wrote a full file, so assemble/encrypt is fine. A real picker can't be driven headless.
|
|
- The user says **saving to a thumbdrive works fine**, while every SSD location tried fails. This contradicts the theory that Chrome blocks the `file://` site as a whole (`chrome://settings/content/filesystem`). Treat that theory as unlikely.
|
|
|
|
## What was changed (commit 613f039, not pushed)
|
|
|
|
`save()` now catches `NotAllowedError`/`SecurityError` on the write, clears `state.handle`, downloads `final-wishes.html` as a fallback and sets an explanatory status. `docs/MAINTENANCE.md` has a matching line. Tests pass (63 pass, 1 skipped). This is a workaround, not a diagnosis. Issue #20 is still open.
|
|
|
|
Also committed this session: `c480ff1` (OVERVIEW.md refresh for `?reset=1`). Neither commit is pushed.
|
|
|
|
## Open hypotheses (why the SSD fails and the thumbdrive works)
|
|
|
|
1. Overwriting an existing file (thumbdrive, probably) versus creating a new one (SSD).
|
|
2. Real filesystem permissions: a folder the user doesn't own, or a read-only or odd mount. Chrome can report OS "permission denied" as this same `NotAllowedError`.
|
|
3. Chrome's blocked-folder list on Linux (home folder itself, system or config folders).
|
|
|
|
## Next steps
|
|
|
|
1. Ask the user for the **exact SSD path** tried, and whether it was a new filename or an existing file. Check ownership and mount options (`ls -ld`, `findmnt`, `stat`).
|
|
2. Have the user try a **new filename on the thumbdrive**. If that fails too, the problem is creating new files, not the location.
|
|
3. Have the user try a plain save (no reset) on the SSD, and check the DevTools console.
|
|
4. If the cause stays unclear, add a small diagnostic that shows the exact error name and `location.href` in the status line.
|
|
5. Fallback the user may prefer: always download instead of saving in place. A download is Chrome writing the file, so it is allowed by default. The cost is that the old file is not overwritten.
|
|
6. The user must **rebuild and carry their data across** to get the fallback. A saved file keeps the code it was saved with. Run `npm run build` (done, `dist/final-wishes.html`), then use "Open your existing Final Wishes file" on the start screen.
|
|
|
|
## Housekeeping
|
|
|
|
- Issue tooling: `gt` is not installed. Use `tea` (`tea issues create`, `tea comment N "..."`).
|
|
- Scratch files from this session are in the session scratchpad: `d.json` (plaintext test data), `fw.html` and `t.mjs` (the CDP test script). Delete `d.json` when done. None are in the repo.
|
|
- Close #20 only after the user confirms a real Chrome save works or the download fallback behaves.
|