소스 정보
- 저장소
- ben-manes/caffeine
- 최근 소스 활동
- 2026년 7월 7일 04:34
- 감지된 SKILL.md 언어
- 영어
- 스타
- 17,831
- 포크
- 1,709
설치 방법
기본적으로 소스를 먼저 확인하는 Prompt가 선택됩니다. 직접 명령으로 전환하거나 로컬 사본을 다운로드할 수도 있습니다.
소스 파일 검토
설치 여부를 결정하기 전에 SKILL.md와 SkillsMP에 표시된 보조 파일을 읽어 보세요.
메뉴
기본적으로 소스를 먼저 확인하는 Prompt가 선택됩니다. 직접 명령으로 전환하거나 로컬 사본을 다운로드할 수도 있습니다.
설치 여부를 결정하기 전에 SKILL.md와 SkillsMP에 표시된 보조 파일을 읽어 보세요.
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
직접 명령은 검토 Prompt를 거치지 않습니다. 실행하기 전에 소스를 확인하세요.
npx skills add https://github.com/ben-manes/caffeine --skill audit-map-contract명령은 한 줄로 유지됩니다. 복사하기 전에 가로로 스크롤해 전체 내용을 확인하세요.
로컬 사본을 원하시나요? SkillsMP에서 현재 제공할 수 있는 파일을 다운로드하세요.
Regenerate the window climber's adversarial trap traces and run the behavioral gate against the real cache in the simulator
Adversarial workload search for eviction-policy regret. Crafts, shrinks, and classifies workloads on which the adaptive window climber fails to close the gap to its achievable optimum, and routes each failure class to the mechanism responsible (controller, policy structure, or recovery layer)
Price each algorithmic step of the window climber by removing it, to find steps that no longer earn their keep and branches that no longer fire
SOC 직업 분류 기준
SKILL.md 표시 중
| name | audit-map-contract |
| description | Audit ConcurrentMap and Map contract compliance for asMap() view |
| context | fork |
| agent | auditor |
| disable-model-invocation | true |
Audit compliance with java.util.concurrent.ConcurrentMap and java.util.Map contracts,
and Caffeine's alignment with the Java Collections Framework.
The JavaDoc is silent or ambiguous on the behaviors that actually bite (null inside a bulk
collection arg, containsAll(self), equals across map types, the optional NPE points,
default-method bodies). WebFetch the real source and read the method body before
asserting a contract. Track master (latest) — we stay pragmatically current, not pinned
to a JDK version. Fetch the raw form (raw.githubusercontent.com/openjdk/jdk/master/src/ java.base/share/classes/…), not the blob page. These files are large (CHM ~6500 lines)
and WebFetch answers a prompt over the content with a small model, so a generic "dump the
file" truncates — prompt for the specific method ("quote the exact body of
CollectionView.containsAll"), one method per fetch:
asMap() is a ConcurrentMap and closest
to CHM:
https://raw.githubusercontent.com/openjdk/jdk/master/src/java.base/share/classes/java/util/concurrent/ConcurrentHashMap.javaConcurrentMap; the tie-breaker on whether a
divergence from CHM is legal (e.g. it also throws UOE on entrySet().add, where CHM's
put-through is a nonstandard v8-rewrite addition):
https://raw.githubusercontent.com/openjdk/jdk/master/src/java.base/share/classes/java/util/concurrent/ConcurrentSkipListMap.javagetOrDefault, compute*, merge,
replaceAll):
https://raw.githubusercontent.com/openjdk/jdk/master/src/java.base/share/classes/java/util/concurrent/ConcurrentMap.javahttps://raw.githubusercontent.com/openjdk/jdk/master/src/java.base/share/classes/java/util/Map.javaAbstractMap.equals,
and via AbstractCollection/AbstractSet the containsAll/removeAll/retainAll loops):
https://raw.githubusercontent.com/openjdk/jdk/master/src/java.base/share/classes/java/util/AbstractMap.javaequals/hashCode comparison target:
https://raw.githubusercontent.com/openjdk/jdk/master/src/java.base/share/classes/java/util/HashMap.javahttps://raw.githubusercontent.com/openjdk/jdk/master/src/java.base/share/classes/java/util/IdentityHashMap.javahttps://raw.githubusercontent.com/openjdk/jdk/master/src/java.base/share/classes/java/util/WeakHashMap.javaLocalCache — the reference for Caffeine's Guava-compat behavior (the
CaffeinatedGuava facade + the uniform null-leniency the philosophy below cites; its
views, removal causes, loader/exception translation):
Be pragmatically close to CHM, but Caffeine may diverge where its behavior is better — and when it does, the divergence must be coherent and recorded (design-decisions.md / the cross-model ledger). Do not treat "differs from CHM" as a bug by itself:
removeAll([null]) throws NPE while
containsAll([null]) returns false — an artifact of which methods happened to get an
explicit null-guard, not a contract. Don't chase CHM's inconsistencies.put/get/containsKey/contains(null) →
NPE — nulls are rejected), but null-tolerant of a null element in a bulk collection
arg (containsAll/removeAll skip it — a null is trivially absent); weakly-consistent
views; size() is an estimate; expired/collected entries filtered from queries and
iteration. The CaffeinatedGuava facade is the deliberate exception — uniformly
null-lenient (Guava-compat), overriding native null-hostility only where Guava diverges.equals across types) has a
legal spread — check several impls (CHM / CSLM / HashMap / Guava), not one, and note
that the collections testlibs usually tolerate both legal choices (e.g. guava-testlib
testContainsAll_nullNotAllowed does assertFalse(...) with catch (NPE tolerated)).
Flag a divergence only when Caffeine is the incoherent one, or diverges from both CHM
and Guava with no better rationale.For any "does Caffeine match CHM/Guava?" question, compile a tiny harness and run Caffeine
side-by-side with real CHM / CSLM / Guava — don't guess (this session, "we mirror CHM"
on containsAll([null]) was empirically wrong — both CHM and Guava return false, Caffeine
NPE'd; and the CHMv8 entrySet().add history was non-obvious):
caffeine/build/libs/caffeine-*.jar (it has the generated
node classes like SSMS; build/classes/java/main does NOT → factory reflection throws),
plus real guava from ~/.gradle/caches/**/guava-*.jar.~/.gradle/jdks/*26*/**/bin/java) — the classes are that bytecode level.timeout … | grep pipeline reports grep's exit code, not gradle's — read the
BUILD line.AsMapTest's map param is polymorphic: compute=ASYNC yields the
async sync-view (LocalAsyncCache.AsMapView), not BLC/ULC — a view change must cover it.:caffeine:googleTest/apacheTest/eclipseTest,
:guava:test) — they encode the contract's tolerated spread.Map contract: equals/hashCode consistency (and across map types — HashMap, TreeMap, IdentityHashMap), putAll atomicity (if weigher throws mid-batch), replaceAll per-entry atomicity, containsValue consistency.
ConcurrentMap contract: compute/computeIfAbsent/merge atomicity ("mapping function applied at most once"), getOrDefault on expired entries, forEach with concurrent mutations, compute returning null (should remove entry), the interface default methods.
Null handling: NPE at the correct points for null keys/values on direct ops;
null elements in bulk args (containsAll/removeAll/retainAll) per the philosophy
above; mapping functions returning null (compute→remove, merge→remove); putIfAbsent(key,
null).
Entry/EntrySet contracts: Map.Entry.setValue() write-through, entrySet remove/contains checking both key AND value, snapshot vs live entries, entrySet().add UOE.
Collection view contracts: keySet()/values()/entrySet() backed by the cache
(bidirectional), contains/containsAll/remove/removeAll/retainAll/removeIf,
containsAll(self) short-circuit, view equals/hashCode over the logical (filtered) set.
Cache semantics interaction: expired-but-present entries visible via asMap()? Collected weak keys visible? asMap() operations triggering listeners? asMap().put() vs cache.put() differences (access time, stats, refresh)? Async raw view vs sync view.
For each finding: quote the requirement from the fetched OpenJDK source (the method + actual body, not remembered JavaDoc), show Caffeine's behavior (ideally via the harness), name the reference spread (CHM / CSLM / HashMap / Guava) and whether Caffeine is coherent, and provide a test case. If Caffeine's divergence is intentional and better, the output is a design-decisions.md / ledger note, not a bug.
asMap()https://raw.githubusercontent.com/google/guava/master/guava/src/com/google/common/cache/LocalCache.java