Edge Thumbnail Store accepts a store that does not refresh a key on overwrite
维护者通常 1 天内回复
@BOBOGUAGUA428 已经在做这个了。
开始于 2026年11月26日。
评估
这个 Issue 还没有评估数据。
描述
Observed behavior
Edge Thumbnail Store (lru-cache) accepts a ThumbnailStore whose put overwrites an existing key without marking it most recently used. Such a store passes all five built-in cases, even though the scenario requires an overwrite to refresh recency.
The case labeled "put updates refresh recency" (capacity 2: put(1,1) put(2,2) put(1,10) get(1) get(2)) never inserts a new key after the overwrite, so nothing is evicted and the order of keys 1 and 2 never affects the result.
Expected behavior
A store that does not refresh a key on overwrite should fail at least one case. A correct LRU store should still pass. The contract in problem-bank/variants.json states that put(key, value) "inserts or overwrites the key and marks it most recently used".
Reproduction
- Use a source checkout at revision e30d6284d0f1cf8d4777d455e94c95e40e69156b.
- Load the judge specification for
lru-cachefrom problem-bank/judges.json. - Run each case's operation sequence against the incorrect store below, and grade the returned outputs with
checkAnswerfrom web/lib.js. Observe that all five cases pass. - Run the sequence
put(1,1) put(2,2) put(1,10) put(3,3) get(2) get(1) get(3)on a capacity-2 store. A correct store returns-1, 10, 3, because the overwrite makes key 1 most recent andput(3,3)evicts key 2. The incorrect store returns2, -1, 3, because key 1 keeps its old position and is evicted.
The incorrect JavaScript store used in step 3:
class ThumbnailStore {
constructor(capacity) {
this.capacity = capacity;
this.map = new Map();
}
get(key) {
if (!this.map.has(key)) return -1;
const value = this.map.get(key);
this.map.delete(key);
this.map.set(key, value);
return value;
}
put(key, value) {
if (this.map.has(key)) {
// Map.set on an existing key keeps its old insertion order.
this.map.set(key, value);
return;
}
if (this.map.size === this.capacity) {
this.map.delete(this.map.keys().next().value);
}
this.map.set(key, value);
}
}
CodeTrial version
Not built: neither codetrial --version nor cargo run -- --version was run. Reproduced from a source checkout at e30d6284d0f1cf8d4777d455e94c95e40e69156b (Cargo.toml version 0.1.0); the bug is in judge data, so no binary is involved.
Environment
OS: macOS arm64
Browser: Not used; runner-level reproduction
Language: JavaScript (the judge cases are shared by every language)
Interview loop: Not applicable
Problem: Edge Thumbnail Store (lru-cache)
REACTO or STAR step: Not applicable
Reconnect: Not applicable
Node.js v24.22.1.
Sanitized evidence
The stale-recency store passed all five built-in cases:
PASS capacity 2, classic eviction sequence
PASS capacity 1, immediate eviction
PASS put updates refresh recency
PASS new cache
PASS missing key
I plan to add the sequence above as a case in problem-bank/judges.json, regenerate web/judges/edge-thumbnail-store.json with scripts/gen-problems.py, and add a test in tests/browser/compiler-explorer.test.js that checks every expected value against a reference store and requires the new case, looked up by label, to reject the stale-recency store. The test fails against the five cases on main. Please assign this issue to me.
Public data confirmation
- I removed credentials, session tokens, candidate recordings, and personal interview content from this public report.
- 主要语言
- Rust
- 星标
- 236
- 派生
- 153
- 平均合并
- 1 天 9 小时
- 30 天内合并 PR
- 187
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
sysprog21/codetrial 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复
-
难度 3/5 1-2 天 新手友好度 70/100
维护者通常 1 天内回复
-
Unify Java harness validation error messages可能已有人在做 @weichieh0204 今天认领。 未关闭
sysprog21/codetrial#872 · 1 条评论 · 已指派 1 人 ·
维护者通常 1 天内回复
-
Inferred void class operations are never checked against the starter's return type可能已有人在做 @papaya0112 今天认领。 未关闭
sysprog21/codetrial#871 · 1 条评论 · 已指派 1 人 ·
维护者通常 1 天内回复
-
Highway Billboard Leasing accepts a solution that greedily leases the largest offer first可能已有人在做 @PeteChiang1211 今天认领。 未关闭
sysprog21/codetrial#868 · 1 条评论 · 已指派 1 人 ·
维护者通常 1 天内回复
查看 sysprog21/codetrial 的全部 Issue
相似的 Issue
-
bug bugfix
难度 2/5 1-3 小时 新手友好度 78/100
storytold/photocraft#17140 ·
维护者通常 1 天内回复
-
难度 1/5 1-3 小时 新手友好度 70/100
-
bug command Java Edition protocol
难度 2/5 1-3 小时 新手友好度 78/100
Pumpkin-MC/Pumpkin#4733 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 82/100
维护者通常 2 天内回复
-
area:parity status:ready-for-agent
难度 2/5 1-3 小时 新手友好度 75/100
neilsh/stunt-reel#1133 ·
维护者通常 1 天内回复