Start does nothing visible in the lobby when site data is blocked
维护者通常 1 天内回复
评估
这个 Issue 还没有评估数据。
描述
Problem
Where site data is blocked, touching the sessionStorage global throws instead of returning a storage that refuses. The lobby's Start handler passes the global itself to resetAssignments, storeGroundingPacket and storeSharedFocus (web/app.js lines 829 to 831 at 4de45b1), so the exception is raised while the arguments are evaluated. The handler's catch writes the message into #grounding-error, which sits inside the collapsed "Optional interview context" <details> (web/index.html lines 1907 to 1979). The candidate sees a Start button that does nothing.
Current behavior
Reproduced on 4de45b1 in Practice with a problem selected, using the same override tests/browser/candidate-cases.test.js uses for unreachable storage:
- Make
sessionStoragethrow:Object.defineProperty(window, "sessionStorage", { get() { throw new DOMException("blocked", "SecurityError"); } }). - Press Start. The page stays in the lobby, the button reads "Start interview" again, and
#grounding-errorholds"blocked", hidden in the collapsed section. Every later press does the same. - After a reload, make the same getter return
null, which is whatstorageArea("sessionStorage")inweb/audio-output.jsanswers in that situation, and press Start. The lobby navigates to the interview page.
Cause
The callees already handle a missing storage: storeSharedFocus() treats a failure as an unshared focus, and storeGroundingPacket() with no packet ignores one. In Strict, previousAssignment() checks !storage and throws its own storageError. The bare global throws before any of that runs. d5ad668 fixed the same class of failure on the interview page and added storageArea() for it, but the lobby was not converted.
Nothing stops the next such reference either. The rule in .claude/skills/codetrial-review/rules/browser.md ("Browser storage: guard it") is enforced only by review. At 4de45b1, 18 references name a storage global directly:
web/app.jslines 829, 830, 831 and 910web/history.jslines 37, 46, 76, 197, 304, 351 and 377 (storage ||= localStorage)web/peer-lobby.jslines 25, 182, 247, 255 and 258.claude/skills/codetrial-review/workbench/app.jslines 713 and 732
The history.js and workbench ones are inside a try and harmless today. The peer-lobby.js ones are not: three run outside any try, one at module scope. Converting them to storageArea() would still throw on the null it returns, so fixing that page needs a decision about where the invite token lives when storage is unreachable.
Desired outcome
- With storage unreachable, Start in Practice opens the interview, and Strict reaches
storageErrorinstead of the raw exception. - A storage global named directly under
web/fails the ESLint gate with a message pointing atstorageArea(). Built-inno-restricted-globalsandno-restricted-propertiescover this. Against 4de45b1 that configuration reports exactly the 18 references above and nothing else. Against the parent of d5ad668, it reports the module-scope reads inweb/interview.js(lines 194 and 196) and the default parameters inweb/audio-output.js(lines 105 and 116) that d5ad668 fixed.
Proposed scope
- Convert the
web/app.jsandweb/history.jsreferences tostorageArea(...).history.jsimports it fromweb/audio-output.js; moving the storage helpers to a module of their own is a separate refactor. - Add the two rules to the browser tier of
eslint.config.mjs, forweb/**/*.jsonly, withweb/peer-lobby.jsexempt and the reason stated in a comment. - Add browser tests for Start with storage unreachable, in Practice and in Strict.
- Deliver this as one pull request with two commits: the Start fix with its tests, then the rule with the
history.jsconversion.
Out of scope
web/peer-lobby.js, which needs its own fix (see Cause).- The review workbench, a local developer tool that does not import
audio-output.js. - Where a storage failure is shown (see Open question).
- Other storage behavior (quota handling, key scoping), CSS, and the color-token rule in #578.
Open question
In Strict, storageError reaches #grounding-error, but that element is inside the collapsed "Optional interview context" <details>, so the message is still not visible. Should a storage failure be shown elsewhere, for example next to Start, or should the catch open the <details>? The section is about grounding, so opening it for an unrelated storage error may confuse a candidate.
Acceptance criteria
- The new Start tests fail on
mainand pass with the change. eslint .passes on the converted tree, and reintroducing the module-scope read that d5ad668 removed fails it.- The existing unreachable-storage tests in
tests/browser/candidate-cases.test.jsstill pass. ./scripts/test.shpasses, apart from checks that fail onmainas well, with skipped checks reviewed.
Related
d5ad668 (the interview-page fix this follows), #578 (mechanizes a different review rule), #593 (adds a lobby storage write through storageArea(), which the proposed rule already accepts; it does not touch the Start lines above).
Edited: the first version listed 13 references and index.html lines 1904 to 1976, taken from an older checkout; both are now verified against 4de45b1, which adds web/peer-lobby.js. The scope now records the choices made where the open questions went unanswered: history.js imports from audio-output.js, the rule covers web/ only with peer-lobby.js exempt, and the work lands as one pull request with two commits.
- 主要语言
- Rust
- 星标
- 223
- 派生
- 148
- 平均合并
- 1 天 10 小时
- 30 天内合并 PR
- 227
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
sysprog21/codetrial 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 78/100
sysprog21/codetrial#604 · 1 条评论 ·
维护者通常 1 天内回复
-
Compare code semantically across a force push in review bundles可能已有人在做 @Alan52254 今天认领。 未关闭
sysprog21/codetrial#606 · 已指派 1 人 ·
维护者通常 1 天内回复
-
Calculator % disagrees with // on negative operands可能已有人在做 @YunJ-Chang 今天认领。 未关闭
sysprog21/codetrial#602 · 1 条评论 · 已指派 1 人 ·
维护者通常 1 天内回复
-
Add a Copy results action to the coding test panel可能已有人在做 @seallllllllll 今天认领。 未关闭
sysprog21/codetrial#598 · 1 条评论 · 已指派 1 人 ·
维护者通常 1 天内回复
-
Review history drops older reports that still fit可能已有人在做 @HellHBBD 今天认领。 未关闭
sysprog21/codetrial#596 · 2 条评论 · 已指派 1 人 ·
维护者通常 1 天内回复
查看 sysprog21/codetrial 的全部 Issue
相似的 Issue
-
bug: merge_insert does not detect concurrent inserts of the same FixedSizeBinary primary key可能已有人在做 @lance-gatefixer 今天认领。 未关闭bug
难度 2/5 1-3 小时 新手友好度 84/100
lance-format/lance#10811 ·
维护者通常 2 天内回复
-
provider testing
难度 2/5 1-3 小时 新手友好度 78/100
mishraprafful/multihull#234 ·
维护者通常 1 天内回复
-
comp-documentation
难度 1/5 1 小时以内 新手友好度 84/100
ClickHouse/ClickHouse#129829 ·
维护者通常 1 天内回复
-
bug needs triage python
难度 2/5 1-3 小时 新手友好度 65/100
维护者通常 1 天内回复
-
state:needs triage
难度 2/5 1-3 小时 新手友好度 87/100
zed-industries/zed#66628 ·
维护者通常 1 天内回复