Skip to content
Back to skills

Audit Linearizability

ASecurity

Analyze the cache for linearizability violations across all public methods

  • 17,959 stars
  • 0 votes
  • 0 copies
  • 2 views
  • Added November 7, 2026
documentation

Security analysis

A100/100

Scanned November 7, 2026

npx -y skills add ben-manes/caffeine --skill audit-linearizability --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Audit Linearizability?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Audit Linearizability
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/ben-manes-audit-linearizability/badge)](https://www.skillsdirectory.com/skills/ben-manes-audit-linearizability)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: audit-linearizability
description: Analyze the cache for linearizability violations across all public methods
context: fork
agent: auditor
disable-model-invocation: true
---

Analyze the cache for linearizability violations. For each public method below,
identify its LINEARIZATION POINT — the single atomic step at which the operation
appears to take effect.

Methods to analyze:

Single-key operations:
- get(key), getIfPresent(key)
- put(key, value), putIfAbsent(key, value)
- remove(key), remove(key, value)
- replace(key, value), replace(key, oldValue, newValue)
- computeIfAbsent(key, function), compute(key, function), merge(key, value, function)

Bulk / aggregate operations:
- getAll(keys) / getAllPresent(keys)
- putAll(map)
- invalidateAll(keys) / invalidateAll()
- size(), containsKey(key), containsValue(value)

Note: Bulk operations are typically NOT linearizable as a unit. State whether each
provides any atomicity beyond per-element linearizability.

For each method:
1. State the linearization point (e.g., "CAS on CHM bin at line X").
2. If conditional, enumerate all cases.
3. Construct a 2-thread scenario confirming the linearization point.

Then attempt to construct violations:
4. Can two threads observe operations in an inconsistent order?
   - put(k, v1) / put(k, v2) / get(k): Can C see v2 then v1?
   - computeIfAbsent(k, f): Can f execute twice concurrently?
   - remove(k) / get(k): Can get return a value after remove linearized?
5. Is size() linearizable or documented as an estimate? Bounds on error?
6. For async cache variants: is the linearization point the future insertion
   or completion? Can get() return an already-replaced future?

For each candidate violation:
- Provide the full interleaving
- Show the sequential history it violates
- Verify the interleaving is JMM-legal
- For a time-based violation (an entry expiring early or late), include a thread that observes
  the key inside the window. Without one, the operation can linearize anywhere in its interval,
  including at its own clock read, and the history is legal. Exclude the configurations that
  allow other removals (a size bound, weak or soft references), since they also explain a miss.

Do not analyze internal consistency, only external observability.

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in documentation →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.