Keep the final code in the local history
A report reopened from Past attempts always shows "(final code was not saved)", on the page and in its .md download, even for the attempt just finished. saveHistory never put the editor contents in the history entry, and normalizeProgressEntry would have dropped them before the lobby saw them. This is the local half of the change proposed on #221.
saveHistoryaddscodeto the entry: the editor contents, or null at a whiteboard, which has no code.- The short history (
codetrial_history, newest 20) keeps it.boundedReviewsstrips it, so the review store is byte for byte what it was and its 164 KB budget holds as many older attempts as before. Attempts older than the newest 20 keep the placeholder. - The
/api/reportsbody leaves it out. README.md says code snapshots stay in memory unless recording is enabled, and the server stores that body as sent, so a signed-in lobby still shows the placeholder. normalizeProgressEntrycarriescodeas a string or null, and the reopened report and its download use it, falling back to the placeholder when it is null.
What remains for #221: whether the account copy should carry the code too, which would let Past attempts show it on another device but changes what README.md says the server keeps. That decision is open on the issue, and this PR does not touch it.
Validation on Windows 11, Node, Playwright Chromium:
- New tests: a saved entry carries the code and a whiteboard entry does not (
interview-lifecycle.test.js); the short history keeps it while the review store and the account request body are identical to a save without code (account.test.js);normalizeProgressEntrykeeps only a string (progress.test.js); a device attempt reopens with its code on the page and in the download, and one without code still shows the placeholder (lobby.test.js). Each was seen to fail with the behavior it covers broken, twelve breaks in all, and pass once restored. node --test tests/browser/*.test.js: 93 failures on this branch and the same 93 by name onmainat 6b6cdfe, all from vendored assets not fetched on this machine and thedom-contract.test.jsESM URL scheme failure on Windows. The branch adds 4 tests, all passing.- ESLint and Prettier pass on the changed files.
- Not run here:
scripts/test.shas a whole, including the Rust lanes, which need a toolchain this machine does not have. No Rust file changed.
Refs #221
Summary by cubic
A report reopened from Past attempts now shows the final code instead of the "(final code was not saved)" placeholder, in the page and in its .md download. saveHistory stores the editor contents in the history entry, and normalizeProgressEntry carries it through to the reopened report and download.
- The code lives only in the short local history (newest 20 attempts). The review store and the
/api/reportsbody are built without it, so their budgets and behavior are unchanged. - Whiteboard attempts get
nullcode and keep the placeholder, as do attempts older than the newest 20. - Whether the account copy should carry the code too is still open on #221 and is not touched here.