You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Note: subscribers must be resilient; HookManager will catch and surface handler results without throwing.
26
+
27
+
Demo additions in this branch:
28
+
29
+
-`src/runtime/subscribers/demo-persistence.js` — writes debug `.save` artifacts to `src/.saves/` on `post_checkpoint` and `on_rollback` (dev/demo only).
30
+
-`web/demo/js/runtime-hooks-shim.js` — attempts to register the demo persistence subscriber when loaded in a bundler/node-like environment so debug saves are produced during local dev and CI.
31
+
-`web/demo/js/inkrunner.js` — shows a lightweight rollback toast UI when a load fails. The toast is demo-only and displays a pointer to `src/.saves/` where debug artifacts are written.
32
+
33
+
How to test the rollback toast in a browser:
34
+
35
+
1) Start the demo server:
36
+
-`npm run serve-demo -- --port 4173`
37
+
- Open `http://127.0.0.1:4173/demo` in your browser.
38
+
39
+
2) Cause a load failure to trigger rollback handling. Two quick options:
40
+
- Corrupt the saved payload:
41
+
a) Open DevTools → Console
42
+
b) Run: `localStorage.setItem('ge-hch.smoke.save', 'not-a-json')`
43
+
c) Click the "Load" button in the demo page or run: `window.__inkrunner.loadState()`
44
+
d) You should see a red toast at the bottom-right with a message referencing `/src/.saves/`.
45
+
46
+
- Remove InkJS or simulate an error during load:
47
+
a) In DevTools Console run: `delete window.inkjs` then click "Load" or call `window.__inkrunner.loadState()`.
48
+
b) The toast should appear when the load fails and `on_rollback` is emitted.
49
+
50
+
3) Inspect debug saves:
51
+
- On successful `post_checkpoint` events the demo persistence subscriber writes files to `src/.saves/`.
52
+
- On failures the subscriber writes a small rollback debug save you can inspect.
53
+
- Inspect saved files from your shell: `ls -l src/.saves && cat src/.saves/<file>.save`.
54
+
55
+
Notes & caveats:
56
+
- The toast and demo persistence are intentionally lightweight and for development only; they rely on the bundler/node environment to register persistence. Plain static-only page loads may not register the demo persistence subscriber.
57
+
- The debug save directory is `src/.saves/` in the repository root. CI artifacts may be stored elsewhere depending on CI config.
58
+
59
+
If you want, I can also add a query-parameter toggle (e.g., `?demo_persistence=1`) so the demo registers the subscriber even on static loads. Would you like that?
0 commit comments