Problem #
On /automations/new, the autosave key includes the live ?lexicon= param. Picking a lexicon rewrites the URL (history.replaceState in fetchFields), and the draft moves to the ?lexicon=X key. Every entry point other than a reload ("New" in the header, the home CTA) goes to plain /automations/new, which reads a different key. So after a closed tab, or a crash without session restore, the user's draft is not restored and stays invisible until it expires after 7 days.
Evidence #
app/islands/AutomationForm.tsx:autosaveContext([viewerHandle, initial ?? null, initial ? null : getInitialParam("lexicon")]) andlastAutosaveContextRefinwriteAutosave;fetchFieldsrewrites?lexicon=(about lines 869-875).app/components/Layout/Header/index.tsx:39andapp/routes/index.tsx:50link to plain/automations/new.- Tests in
app/islands/AutomationForm.test.tsx: "keeps a blank form's draft to the ?lexicon= it was started from" (a draft under?lexicon=does not restore on the plain path) and "moves a blank form's draft along when picking a lexicon rewrites ?lexicon=". Commit 5e1491f (#33).
Expected #
A blank-form draft comes back on the next visit to /automations/new, whichever way the user arrives. A link that asks for a specific, different lexicon does not silently load another lexicon's draft.
Acceptance criteria #
Out of scope #
The edit-page key (separate issue), cross-tab sync, and the scope-upgrade stash.
Optional, low, can be folded in: keep header values that are exactly a lone {{secret:NAME}} reference when blanking headers in app/islands/step-drafts/header-values.ts:33-38.
Queued: the loop will work on this version of the issue.
loop:queued cid=bafyreig4eftjnz6c7ssrc3st3jtogstvdgx2hl2iw3gk7k6d4336knpjyq