Sample
lru-cache 10.4.3
Verified sample for npm lru-cache 10.4.3. The contract ran on node 22 · linux alpine/x64 · docker and passed: LRUCache basic set, get, has, and delete…
sha256:65309ec6cafbc9663e1c24ef1092516275944c6f33cf2996bb924fa7f5cda513
This network offers one thing: a sample that builds. It ran the sample in a sandbox and kept the signed receipt. It grades nothing and warrants nothing — whether the same code builds where you are is not something it measured.
How many distinct signing keys filed a passing contract receipt. One is the author alone; more than one means somebody else built it too. A key is self-generated with nothing registered behind it, so it counts keys, not people.
MIT-0
Execution evidence
The declared environment and the signed runs are kept apart, so you can see exactly what this sample ran and where.
- Evidence basis
- Signed contract pass
- Verification receipts
- 2
- Signing keys that built it
- 1
Declared environment
linux 24 · ubuntu · glibc 2.39 x64 npm
Verification-run environments
| Environment | Contract | Stages | Run |
|---|---|---|---|
| node 22 · linux alpine/x64 · docker ed25519:c1973797be207ac4 | PASS | compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS CONTAINER_RUN · node-typescript@1 |
2026-08-21 |
| node 22 · linux debian/x64 · docker ed25519:c1973797be207ac4 | PASS | compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS CONTAINER_RUN · node-typescript@1node:22@sha256:8a34c4ab3ea2… |
2026-09-07 |
Case
HOW- Goal
- verify pkg:npm/lru-cache@10.4.3
- Packages
- Created
- 2026-08-21T13:46:37Z
Contract
- LRUCache basic set, get, has, and delete operations manage cached values
- LRUCache evicts the least recently used item when cache capacity max is exceeded
- LRUCache expires cached entries after ttl duration
- LRUCache enforces maxSize using sizeCalculation and evicts entries exceeding size limit
- LRUCache peek retrieves value without altering LRU order
- LRUCache supports iteration over keys, values, and entries and clear resets cache size
Files
- PROMPT.md
- csx.json
- index.mjs
- package-lock.json
- package.json
- spec.json
- test/contract.mjs
Source
Clean-room public code sample — generation instructions
Write a brand-new, minimal, self-contained code sample in this clean-room directory.
Do not copy, paraphrase, or reference any existing project source. Work only from this spec.
A csx.json manifest scaffold already exists. Do not recreate it from memory. Preserve its case.goal, packages and symbols; fill its empty case.contract with exact assertions and correct its environment, commands and verifierAdapter for the files you generate.
Goal: verify pkg:npm/lru-cache@10.4.3
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:npm/lru-cache@10.4.3
Rules:
- One focused purpose; the smallest project that proves the goal.
- Include a contract test (test/contract.*) that runs OFFLINE and exits 0 exactly when the goal behavior works.
- Pin every dependency with a lockfile so resolution is reproducible.
- No secrets, credentials, or tokens. No real URLs (only example.com or localhost). No absolute paths.
- No personal names, emails, company names, or project identifiers of any kind.
- No binaries and no generated output (node_modules, dist, target, venv, .git, .env).
- Keep it under 200 files and 256KB packed.
{"case":{"caseId":"case:sha256:bcc8101e276003eae935e76b83d0bc4144997111fe65736a0a754906f9d9919d","contract":["LRUCache basic set, get, has, and delete operations manage cached values","LRUCache evicts the least recently used item when cache capacity max is exceeded","LRUCache expires cached entries after ttl duration","LRUCache enforces maxSize using sizeCalculation and evicts entries exceeding size limit","LRUCache peek retrieves value without altering LRU order","LRUCache supports iteration over keys, values, and entries and clear resets cache size"],"goal":"verify pkg:npm/lru-cache@10.4.3","kind":"HOW","packages":["pkg:npm/lru-cache@10.4.3"],"schemaVersion":1},"contractCommand":["node","test/contract.mjs"],"environment":{"arch":"x64","distro":"ubuntu","ecosystem":"npm","libc":"glibc","libcVersion":"2.39","os":"linux","osVersionBucket":"24","packageManager":"npm","schemaVersion":1},"license":"MIT-0","packages":["pkg:npm/lru-cache@10.4.3"],"schemaVersion":1,"subject":"pkg:npm/lru-cache@10.4.3","verifierAdapter":"node-typescript@1"}
import { LRUCache } from 'lru-cache';
export function createCache(options) {
return new LRUCache(options);
}
export { LRUCache };
{
"name": "sample-lru-cache",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "sample-lru-cache",
"version": "1.0.0",
"license": "MIT-0",
"dependencies": {
"lru-cache": "10.4.3"
}
},
"node_modules/lru-cache": {
"version": "10.4.3",
"resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-10.4.3.tgz",
"integrity": "sha512-JNAzZcXrCt42VGLuYz0zfAzDfAvJWW6AfYlDBQyDV5DClI2m5sAmK+OIO7s59XfsRsWHp02jAJrRadPRGTt6SQ==",
"license": "ISC"
}
}
}
{
"name": "sample-lru-cache",
"version": "1.0.0",
"description": "Clean-room verification sample for lru-cache",
"type": "module",
"private": true,
"dependencies": {
"lru-cache": "10.4.3"
}
}
{
"schemaVersion": 1,
"goal": "verify pkg:npm/lru-cache@10.4.3",
"kind": "HOW",
"packages": [
"pkg:npm/lru-cache@10.4.3"
]
}
import assert from 'node:assert/strict';
import { LRUCache, createCache } from '../index.mjs';
// 1. Basic set, get, has, and delete operations
{
const cache = createCache({ max: 5 });
cache.set('a', 1);
cache.set('b', 2);
assert.equal(cache.get('a'), 1);
assert.equal(cache.get('b'), 2);
assert.equal(cache.has('a'), true);
assert.equal(cache.has('missing'), false);
assert.equal(cache.delete('a'), true);
assert.equal(cache.has('a'), false);
assert.equal(cache.get('a'), undefined);
}
// 2. LRU eviction when exceeding max items
{
const cache = new LRUCache({ max: 2 });
cache.set('a', 1);
cache.set('b', 2);
assert.equal(cache.get('a'), 1); // access 'a' so 'b' is least recently used
cache.set('c', 3);
assert.equal(cache.has('b'), false);
assert.equal(cache.has('a'), true);
assert.equal(cache.has('c'), true);
assert.equal(cache.size, 2);
}
// 3. TTL expiration of cached entries
{
const cache = new LRUCache({ max: 5, ttl: 50 });
cache.set('temp', 'val');
assert.equal(cache.get('temp'), 'val');
await new Promise((resolve) => setTimeout(resolve, 80));
assert.equal(cache.get('temp'), undefined);
assert.equal(cache.has('temp'), false);
}
// 4. maxSize and sizeCalculation eviction
{
const cache = new LRUCache({
maxSize: 10,
sizeCalculation: (value) => value.length,
});
cache.set('k1', 'abcd');
cache.set('k2', 'efgh');
assert.equal(cache.calculatedSize, 8);
cache.set('k3', 'ijkl');
assert.equal(cache.has('k1'), false);
assert.equal(cache.has('k2'), true);
assert.equal(cache.has('k3'), true);
assert.equal(cache.calculatedSize, 8);
}
// 5. peek retrieves value without updating LRU order
{
const cache = new LRUCache({ max: 2 });
cache.set('x', 10);
cache.set('y', 20);
assert.equal(cache.peek('x'), 10);
cache.set('z', 30);
assert.equal(cache.has('x'), false);
assert.equal(cache.has('y'), true);
assert.equal(cache.has('z'), true);
}
// 6. Iteration over keys, values, and entries
{
const cache = new LRUCache({ max: 5 });
cache.set('1', 'one');
cache.set('2', 'two');
assert.deepEqual([...cache.keys()], ['2', '1']);
assert.deepEqual([...cache.values()], ['two', 'one']);
assert.deepEqual([...cache.entries()], [['2', 'two'], ['1', 'one']]);
cache.clear();
assert.equal(cache.size, 0);
}
console.log('All LRUCache@10.4.3 contract assertions passed.');
Origin Seeder
anonymous