Start does nothing visible in the lobby when site data is blocked
I maintainer di solito rispondono entro 1 giorno
Valutazione
Questa issue non è ancora stata valutata.
Descrizione
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.
- Lingua principale
- Rust
- Stelle
- 223
- Fork
- 148
- Merge medio
- 1g 10h
- PR unite (30g)
- 227
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di sysprog21/codetrial
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
sysprog21/codetrial#604 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Compare code semantically across a force push in review bundlesForse già presa @Alan52254 l’ha presa oggi. Aperta
sysprog21/codetrial#606 · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
-
Calculator % disagrees with // on negative operandsForse già presa @YunJ-Chang l’ha presa oggi. Aperta
sysprog21/codetrial#602 · 1 commento · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
-
Add a Copy results action to the coding test panelForse già presa @seallllllllll l’ha presa oggi. Aperta
sysprog21/codetrial#598 · 1 commento · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
-
Review history drops older reports that still fitForse già presa @HellHBBD l’ha presa oggi. Aperta
sysprog21/codetrial#596 · 2 commenti · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di sysprog21/codetrial
Issue simili
-
multiple issues priority: low
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
storytold/pdfcraft#6469 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 83/100
I maintainer di solito rispondono entro 1 giorno
-
parity priority: low ui
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
storytold/photocraft#11680 · 1 commento ·
I maintainer di solito rispondono entro 2 giorni
-
triage/needs-triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
praxis-proxy/grid#564 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 66/100
ScoopInstaller/Extras#19275 ·
I maintainer di solito rispondono entro 1 giorno