Let the candidate restore the starter code
维护者通常 1 天内回复
@RWong04 已经在做这个了。
开始于 2026年10月18日。
评估
这个 Issue 还没有评估数据。
描述
Who is affected
A candidate in a coding interview who has edited the editor into a state they want to start over from. The starter is the only template they have, and nothing on the interview page puts it back.
Observed
On main at 1ba82f9, with cargo run -- web and ?problem=chargeback-pair-match, I replaced the Python buffer with my own text, clicked JavaScript and then Python again, and the buffer still held my text. Ctrl+Z at that point did not bring the starter back either. The page has no control with a reset, restore or starter label: I listed every button and summary on the interview page and found none. codeByLanguage is seeded from problem.starterCode once (web/interview.js:422), and setLanguage only swaps buffers between tabs (web/interview.js:2209).
Desired outcome
The candidate can put the starter code of the language they are in back into the editor, without leaving the interview.
Present workaround
Select all, delete, and retype the signature and the class wrapper.
Scope
The editor toolbar and the editor buffer on the interview page, in web/interview.html and web/interview.js. Not the agent, the recording contract, the judges or the problem bank. I have no data on how often candidates want this, so this issue rests on the missing path, not on a measured need.
Approaches
- A button that replaces the buffer at once. Smallest change, but one misclick discards the candidate's work with no way back.
- The same button behind a confirmation. Safe, but adds a step, and a modal competes with the Meet presentation flow.
- A button that replaces the buffer through
document.execCommand("insertText"), as the editor's own programmatic edits already do (web/interview.js:817), so Ctrl+Z restores the previous buffer. No extra step, but undo depends on the browser accepting the command, and the existing fallback assigns.value, which drops the undo history.
I prefer 3 with the fallback taking the confirmation of 2, so the case where undo is unavailable is the only one that asks.
Compatibility
No new message type or recording kind is needed. A reset is a new code_update, and the recording's editor event is already a whole-buffer snapshot that replaces the previous one (docs/recording-contract.md). On the agent side, a code change that does not arrive with a language switch is already read as the candidate editing, and the comment in src/agent/events.rs covers a candidate clearing the editor and starting over.
Open question
Interview contract version 17 records Test only while the editor still holds the code the run executed. I have not checked what happens to a Test credit that was already recorded when the buffer is reset afterwards. I will measure that before the pull request and report it here.
Acceptance criteria
- A control on the interview page replaces the editor buffer of the current language with that language's starter. The buffers of the other languages are unchanged.
- A reset cannot silently destroy work: it is either undone with Ctrl+Z or confirmed first.
- The reset reaches the interviewer and the recording through the normal code publish.
- The control is unavailable whenever the editor is disabled, including after the interview ends.
- A browser test fails if the reset leaves the buffer unchanged or discards the other languages' buffers.
Related: #252 added the editor options and states that the editor preserves native undo and redo; approach 3 keeps that.
I will work on this and can open a pull request with the test first. Please assign it to me.
- 主要语言
- Rust
- 星标
- 177
- 派生
- 100
- 平均合并
- 1 天 10 小时
- 30 天内合并 PR
- 135
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
sysprog21/codetrial 的其他 Issue
-
Audio output can be confirmed without playing a test sound可能已有人在做 @ChenYingHan1121 于 1 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 62/100
sysprog21/codetrial#359 · 3 条评论 · 已指派 1 人 ·
维护者通常 1 天内回复
-
Add a Copy code button to the final report可能已有人在做 @yansawu 于 2 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 80/100
sysprog21/codetrial#318 · 5 条评论 · 2 个 reaction · 已指派 1 人 ·
维护者通常 1 天内回复
-
C tests accept a wrong next pointer on the last node in Org Chart Row Navigation可能已有人在做 @winter77777 今天认领。 未关闭
sysprog21/codetrial#370 · 已指派 1 人 ·
维护者通常 1 天内回复
-
"Let me think about it for a moment" does not start a thinking hold可能已有人在做 @PeteChiang1211 今天认领。 未关闭
sysprog21/codetrial#369 · 已指派 1 人 ·
维护者通常 1 天内回复
-
难度 4/5 3-5 天 新手友好度 48/100
sysprog21/codetrial#368 · 1 条评论 ·
维护者通常 1 天内回复
查看 sysprog21/codetrial 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 64/100
维护者通常 2 天内回复
-
难度 2/5 1-3 小时 新手友好度 72/100
维护者通常 8 天内回复
-
难度 2/5 1-3 小时 新手友好度 82/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 78/100
swc-project/swc#12576 ·
维护者通常 1 天内回复
-
good first issue gpu serve
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复