Repository navigation
Keep the final code in the local history - #321
Conversation
982c13a to
a094fb4
Compare
| method: "POST", | ||
| headers: { "content-type": "application/json" }, | ||
| body: JSON.stringify(entry), | ||
| body: JSON.stringify(withoutCode(entry)), |
There was a problem hiding this comment.
Leaving code out of the account body is consistent with what the description says, but it means a signed-in candidate sees the placeholder even on the device that holds the code: renderServerHistory never looks at local storage. A follow-up could fill in code from readLocalHistory() by id before showProgress. That shows the code wherever the device has it, without touching the server body or the open question on #221.
There was a problem hiding this comment.
Included here rather than as a follow-up: renderServerHistory passes the account rows through withLocalCode (web/history.js), which fills code in by report id from this device's history. The server body is unchanged, and the lobby test covers a signed-in candidate.
"disabled execution hides the test drawer divider" read isHidden() once right after DOMContentLoaded. The page hides the divider and the drawer in init(), which runs only after interview.js finishes its top-level await on the problem fetch, and DOMContentLoaded does not wait for that. On a loaded runner the read lands first and sees the divider still visible; this failed once in CI on #321 while passing locally and on main. Wait for both elements to become hidden instead. With the problem fetch delayed by 1.5 s, the old read fails with the same "actual: false" and the wait passes.
a094fb4 to
1a49585
Compare
1a49585 to
7c532b9
Compare
7c532b9 to
2cfed75
Compare
2cfed75 to
776c8a9
Compare
jserv
left a comment
There was a problem hiding this comment.
Before asking someone to review, you MUST resolve any regressions flagged by GitHub Actions.
jserv
left a comment
There was a problem hiding this comment.
Rebase latest main branch and explain how the CI result changes.
The gates (browser) failure here is Strict delayed judge language restoration respects end in tests/browser/strict-selection.test.js. This branch did not break it: the test was flaky on main itself. After End it waited for the ending overlay, but its room has no interviewer, so the offline summary replaced that overlay a moment later and a loaded runner missed the window. #461 (merge b0059b2) fixed the test by pausing a fake clock before End, and main passes the browser lane again at that commit. This branch is based on a commit before b0059b2, so it still runs the old test. After rebasing, reply here with the new CI result, and if anything still fails, say whether it comes from this branch or also fails on main.
The same lane also fails the lobby fits on one screen instead of a wall of problems, which passes on main, so that one comes from this branch and a rebase alone will not clear it.
776c8a9 to
4f079f6
Compare
jserv
left a comment
There was a problem hiding this comment.
Rebase latest main branch and resolve conflicts.
|
Add screenshots to the pull request description to illustrate your work, as @ColtenOuO suggests. Example: #349 |
A report reopened from Past attempts always showed "(final code was not saved)", on the page and in its download. saveHistory never put the editor contents in the history entry, and normalizeProgressEntry would have dropped them before the lobby saw them. The entry now carries the code, or null at a whiteboard, which has none, and the reopened report and its download use it. It joins the entry after the unclear lines are bounded, since that bound is the account body's and the account copy never carries the code. Only the short history of the newest 20 attempts keeps it: the review store is built without it, so its 164 KB budget holds as many older attempts as before, and those keep the placeholder. When the quota refuses the history, or the review store write that follows it, the history is written again with the older rows' code left out, then without this report's own, so the attempt just finished keeps its code longest and the code never costs an attempt the device would keep. When no step lets the review store in, the refusal was not the code's, and the history goes back to the step it first landed at. The /api/reports body leaves it out, since the server keeps that body as sent; a signed-in lobby fills it in by report id from this device's history instead. README.md says the browser keeps it. Closes sysprog21#221 Co-Authored-By: Fang-Yu Zhang <nancy99b@gmail.com>
4f079f6 to
dbe686f
Compare
|
Thank @Patriciaath999 for contributing! |
A report reopened from Past attempts always shows "(final code was not saved)", on the page and in its
.mddownload, even for the attempt just finished.saveHistorynever put the editor contents in the history entry, andnormalizeProgressEntrywould have dropped them before the lobby saw them.saveHistoryaddscodeto the entry: the editor contents, or null at a whiteboard, which has no code.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.saveLocalReportwrites the history again with the older rows' code left out, then without this report's own, retrying the review store each time, so the attempt just finished keeps its code longest and the code never costs an attempt the device would otherwise keep. When no step lets the review store in, the refusal was not the code's, and the history goes back to the step it first landed at.saveHistoryadds the code afterwithUnclearLineshas bounded the unclear lines, since that bound is the account body's and the account copy never carries the code, so a long solution does not cost the attempt its unclear lines./api/reportsbody leavescodeout, since the server stores that body as sent. A signed-in lobby fills it in by report id from this device's history (withLocalCodeinrenderServerHistory), so the code shows wherever the device has it, without changing the server body.normalizeProgressEntrycarriescodeas a string or null, and the reopened report and its download use it, falling back to the placeholder when it is null.Validation on Windows 11, Node, Playwright Chromium, rebased on
mainat 6b739c5: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, a stored__proto__field survives the copy, a quota-limited storage still saves every attempt, keeps each new report's own code and drops the oldest code first, a review store that would not fit beside a history full of code still keeps every attempt, a review store that refuses every write leaves each attempt its code, and account rows take the code this device kept by report id (account.test.js);normalizeProgressEntrykeeps only a string (progress.test.js); device and account attempts reopen with the code this device kept, 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, twenty-eight breaks in all, and pass once restored.node --test tests/browser/*.test.js: 112 failures on this branch and the same 112 by name onmainat 6b739c5, from vendored assets not fetched on this machine and fromthe lobby fits on one screen instead of a wall of problems, which measures 802px against 800px here on both. The branch adds 10 tests, all passing.main.scripts/test.shas a whole, including the Rust lanes, which need a toolchain this machine does not have. No Rust file changed.Closes #221